summaryrefslogtreecommitdiffstats
path: root/scripts/libmakepkg/lint_package/build_references.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/libmakepkg/lint_package/build_references.sh.in')
-rw-r--r--scripts/libmakepkg/lint_package/build_references.sh.in19
1 files changed, 11 insertions, 8 deletions
diff --git a/scripts/libmakepkg/lint_package/build_references.sh.in b/scripts/libmakepkg/lint_package/build_references.sh.in
index 67c14e66..9183fce9 100644
--- a/scripts/libmakepkg/lint_package/build_references.sh.in
+++ b/scripts/libmakepkg/lint_package/build_references.sh.in
@@ -2,7 +2,7 @@
#
# build_references.sh - Warn about files containing references to build directories
#
-# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2013-2017 Pacman Development Team <pacman-dev@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,14 +25,17 @@ 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
+ return 0
}