From: Ivy Foster <ivy.fos...@gmail.com>

grep -n output is used to match format of compiler warnings.
Since rewriting build_references() anyway, tweaked quoting.
Implements FS#31558.

Signed-off-by: Ivy Foster <ivy.fos...@gmail.com>
---
 scripts/libmakepkg/lint_package/build_references.sh.in | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/scripts/libmakepkg/lint_package/build_references.sh.in 
b/scripts/libmakepkg/lint_package/build_references.sh.in
index 67c14e6..32554b2 100644
--- a/scripts/libmakepkg/lint_package/build_references.sh.in
+++ b/scripts/libmakepkg/lint_package/build_references.sh.in
@@ -29,10 +29,17 @@ 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"
+       local srcdir_refs pkgdir_refs
+
+       mapfile -t srcdir_refs < <(find "$pkgdir" -type f -print0 | xargs -0 
grep -n "$srcdir")
+       mapfile -t pkgdir_refs < <(find "$pkgdir" -type f -print0 | xargs -0 
grep -n "$pkgdirbase")
+
+       if  [[ ${#srcdir_refs} -gt 0 ]]; then
+               warning "$(gettext 'Package contains reference to %s')" 
'$srcdir'
+               printf '%s\n' "${srcdir_refs[@]}" >&2
        fi
-       if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I 
"${pkgdirbase}" ; then
-               warning "$(gettext "Package contains reference to %s")" 
"\$pkgdir"
+       if [[ ${#pkgdir_refs} -gt 0 ]]; then
+               warning "$(gettext 'Package contains reference to %s')" 
'$pkgdir'
+               printf '%s\n' "${pkgdir_refs[@]}" >&2
        fi
 }
-- 
2.10.0

Reply via email to