summaryrefslogtreecommitdiffstats
path: root/scripts/libmakepkg/lint_package
diff options
context:
space:
mode:
authorIvy Foster <ivy.foster@gmail.com>2016-10-16 01:34:49 +0200
committerAllan McRae <allan@archlinux.org>2016-10-22 12:50:55 +0200
commite8c35bea2bc6cdf616af71806558034f08cb58a3 (patch)
treea9243666a854205603211f8eba9a679e57955c62 /scripts/libmakepkg/lint_package
parent4c4ce473d6a671234be534414ba3660c7267c9ee (diff)
downloadpacman-e8c35bea2bc6cdf616af71806558034f08cb58a3.tar.gz
pacman-e8c35bea2bc6cdf616af71806558034f08cb58a3.tar.xz
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>
Diffstat (limited to 'scripts/libmakepkg/lint_package')
-rw-r--r--scripts/libmakepkg/lint_package/build_references.sh.in16
1 files changed, 9 insertions, 7 deletions
diff --git a/scripts/libmakepkg/lint_package/build_references.sh.in b/scripts/libmakepkg/lint_package/build_references.sh.in
index 67c14e66..514ec053 100644
--- a/scripts/libmakepkg/lint_package/build_references.sh.in
+++ b/scripts/libmakepkg/lint_package/build_references.sh.in
@@ -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"
- fi
+ 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
}