[pacman-dev] [PATCH] makepkg: list files containing $srcdir (FS#31558)

Allan McRae allan at archlinux.org
Fri May 17 21:23:10 EDT 2013


On 15/05/13 11:08, Phillip Smith wrote:
> From 2730cfde03792ad847343d7339b7a8cacc6ff81e Mon Sep 17 00:00:00 2001
> From: Phillip Smith <phillip.smith at naturesorganics.com.au>
> Date: Wed, 15 May 2013 11:04:03 +1000
> Subject: [PATCH] makepkg: list files containing $srcdir (FS#31558)
> 
> when checking for files in a built package that contain references to
> $srcdir or $pkgdir_base, show the files that match to assist in
> debugging.
> ---

Much easier to review if the patch is sent inline....

>  scripts/makepkg.sh.in | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 75ddfe5..70d39b7 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1606,11 +1606,15 @@ tidy_install() {
>  	done
>  
>  	# check for references to the build and package directory
> -	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"
> +	srcdir_refs=$(cd "${pkgdir}" && find -type f -print0 | xargs -0 grep -I -l "${srcdir}")
> +	if [[ -n $srcdir_refs ]] ; then
> +		warning "$(gettext "The following files within the package reference %s")" "\$srcdir"
> +		echo $srcdir_refs	# quotes are important to maintain line breaks

The lack of quotes indicates that they are not that important!  Also,
are there issues with files with spaces?

I think it should look like this  (falconindy will correct me if not...)

srcdir_refs=($(cd ...))
if [[ -n $s...
	warning...
	printf "  %s\n" "${srcdir_refs[@]}"


> +	fi
> +	pkgdir_refs=$(cd "${pkgdir}" && find -type f -print0 | xargs -0 grep -I -l "${pkgdirbase}")
> +	if [[ -n $pkgdir_refs ]] ; then
> +		warning "$(gettext "The following files within the package reference %s")" "\$pkgdir"
> +		echo "$pkgdir_refs"	# quotes are important to maintain line breaks
>  	fi
>  
>  	if check_option "zipman" "y" && [[ -n ${MAN_DIRS[*]} ]]; then



More information about the pacman-dev mailing list