makepkg: print files with refs to $srcdir/$pkgdir

Since rewriting build_references() anyway, tweaked quoting.
Implements FS#31558.

Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Ivy Foster 2016-10-15 18:34:49 -05:00 committed by Allan McRae
parent 4c4ce473d6
commit e8c35bea2b
1 changed files with 9 additions and 7 deletions

View File

@ -25,14 +25,16 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/message.sh"
lint_package_functions+=('warn_build_references')
warn_build_references() {
if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${srcdir}" ; then
warning "$(gettext "Package contains reference to %s")" "\$srcdir"
fi
if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${pkgdirbase}" ; then
warning "$(gettext "Package contains reference to %s")" "\$pkgdir"
local refs
for var in srcdir pkgdir; do
mapfile -t refs < <(find "$pkgdir" -type f -exec grep -l "${!var}" {} +)
if (( ${#refs} > 0 )); then
warning "$(gettext 'Package contains reference to %s')" "\$$var"
printf '%s\n' "${refs[@]}" >&2
fi
done
}