[pacman-dev] [PATCH] makepkg: Fix the check for references to srcdir/pkgdir in BSDs

Nezmer git at nezmer.info
Tue Feb 1 12:02:50 EST 2011


At least in FreeBSD, find always returns 0 If It finds stuff
(imagine that). It doesn't care about the exit status of whatever is
passed to -exec.

This patch makes the checks compatible with this behaviour.

Using xargs and not using grep directly because packages with too many
files would cause grep to complain about argument list being too long.

This should also fix the false positive in packages with no files.

Signed-off-by: Nezmer <git at nezmer.info>
---
 scripts/makepkg.sh.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index b1b1b75..72b8035 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1000,10 +1000,10 @@ check_package() {
 	done
 
 	# check for references to the build and package directory
-	if find "${pkgdir}" -type f -exec grep -q -I "${srcdir}" {} +; then
+	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 -exec grep -q -I "${pkgdir}" {} +; then
+	if find "${pkgdir}" -type f -print0 | xargs -0  grep -q -I "${pkgdir}" ; then
 		warning "$(gettext "Package contains reference to %s")" "\$pkgdir"
 	fi
 
-- 
1.7.3.5



More information about the pacman-dev mailing list