Changeset View
Changeset View
Standalone View
Standalone View
Mk/Scripts/qa.sh
Show First 20 Lines • Show All 585 Lines • ▼ Show 20 Lines | proxydeps() { | ||||
# Some .so are not executable, but we want to check them too. | # Some .so are not executable, but we want to check them too. | ||||
while read file; do | while read file; do | ||||
# No results presents a blank line from heredoc. | # No results presents a blank line from heredoc. | ||||
[ -z "${file}" ] && continue | [ -z "${file}" ] && continue | ||||
while read dep_file; do | while read dep_file; do | ||||
# No results presents a blank line from heredoc. | # No results presents a blank line from heredoc. | ||||
[ -z "${dep_file}" ] && continue | [ -z "${dep_file}" ] && continue | ||||
dep_file=$(subst_dep_file ${dep_file}) | dep_file=$(subst_dep_file ${dep_file}) | ||||
# Skip files we already checked. | |||||
if listcontains ${dep_file} "${already}"; then | if listcontains ${dep_file} "${already}"; then | ||||
continue | continue | ||||
fi | fi | ||||
if $(pkg which -q ${dep_file} > /dev/null 2>&1); then | if $(pkg which -q ${dep_file} > /dev/null 2>&1); then | ||||
dep_file_pkg=$(pkg which -qo ${dep_file}) | dep_file_pkg=$(pkg which -qo ${dep_file}) | ||||
# Check that the .so we need has a SONAME | |||||
if [ "${dep_file_pkg}" != "${PKGORIGIN}" ]; then | |||||
if ! readelf -d "${dep_file}" | grep -q SONAME; then | |||||
warn "${file} is linked to ${dep_file} which does not have a SONAME. ${dep_file_pkg}!needs to be fixed." | |||||
fi | |||||
fi | |||||
# If we don't already depend on it, and we don't provide it | |||||
if ! listcontains ${dep_file_pkg} "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then | if ! listcontains ${dep_file_pkg} "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then | ||||
err "${file} is linked to ${dep_file} from ${dep_file_pkg} but it is not declared as a dependency" | err "${file} is linked to ${dep_file} from ${dep_file_pkg} but it is not declared as a dependency" | ||||
proxydeps_suggest_uses ${dep_file_pkg} ${dep_file} | proxydeps_suggest_uses ${dep_file_pkg} ${dep_file} | ||||
rc=1 | rc=1 | ||||
fi | fi | ||||
else | else | ||||
err "${file} is linked to ${dep_file} that does not belong to any package" | err "${file} is linked to ${dep_file} that does not belong to any package" | ||||
rc=1 | rc=1 | ||||
Show All 14 Lines | $(cd ${STAGEDIR} && find -s . -type f \( -perm +111 -o -name '*.so*' \) | \ | ||||
sed -e 's/^\.//') | sed -e 's/^\.//') | ||||
EOT | EOT | ||||
[ -z "${PROXYDEPS_FATAL}" ] && return 0 | [ -z "${PROXYDEPS_FATAL}" ] && return 0 | ||||
return ${rc} | return ${rc} | ||||
} | } | ||||
sonames() { | |||||
local found | |||||
found=0 | |||||
while read f; do | |||||
# No results presents a blank line from heredoc. | |||||
[ -z "${f}" ] && continue | |||||
# Ignore symlinks | |||||
[ -f "${f}" -a ! -L "${f}" ] || continue | |||||
files=$((files+1)) | |||||
if ! readelf -d ${f} | grep -q SONAME; then | |||||
warn "${f} doesn't have a SONAME." | |||||
warn "pkg(8) will not register it as being provided by the port." | |||||
warn "If another port depend on it, pkg will not be able to know where it comes from." | |||||
case "${f}" in | |||||
${STAGEDIR}${PREFIX}/lib/*/*) | |||||
warn "It is in a subdirectory, it may not be used in another port." | |||||
;; | |||||
*) | |||||
warn "It is directly in ${PREFIX}/lib, it is probably used by other ports." | |||||
;; | |||||
esac | |||||
fi | |||||
# Use heredoc to avoid losing rc from find|while subshell | |||||
done <<-EOT | |||||
$(find ${STAGEDIR}${PREFIX}/lib -name '*.so' -o -name '*.so.*') | |||||
EOT | |||||
} | |||||
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo" | checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo" | ||||
checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo" | checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo" | ||||
checks="$checks proxydeps" | checks="$checks proxydeps sonames" | ||||
ret=0 | ret=0 | ||||
cd ${STAGEDIR} | cd ${STAGEDIR} | ||||
for check in ${checks}; do | for check in ${checks}; do | ||||
${check} || ret=1 | ${check} || ret=1 | ||||
done | done | ||||
exit ${ret} | exit ${ret} |