[pacman-dev] [PATCH] makepkg: check for references to build root in package

Allan McRae allan at archlinux.org
Sat Oct 24 22:15:04 EDT 2009


Cedric Staniewski wrote:
> Allan McRae wrote:
>   
>> Add a check that the package does not contain references to the
>> folder it was built in.
>>
>> Fixes FS#14751
>>
>> Signed-off-by: Allan McRae <allan at archlinux.org>
>> ---
>>  scripts/makepkg.sh.in |    6 ++++++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 820d81f..a5b8f87 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -971,6 +971,12 @@ check_package() {
>>  			warning "$(gettext "Invalid backup entry : %s")" "$file"
>>  		fi
>>  	done
>> +
>> +	# check for references to the build directory
>> +	grep -R "${srcdir}" "${pkgdir}" &>/dev/null
>> +	if [ $? -eq 0 ]; then
>> +		warning "$(gettext "Package contains reference to %s")" "\$srcdir"
>> +	fi
>>  }
>>  
>>  create_package() {
>>     
>
>
> I wonder why you do not use
>
> if grep -R "${srcdir}" "${pkgdir}" &>/dev/null; then
>
> Is there a special cause for that or is it only for cosmetic reasons? Thanks.
>   

No reason....   I was going to adjust my patch to this syntax.   
However, I have discovered, the patch causes makepkg to halt if there 
are no files in ${pkgdir}.  This is entirely possible with something 
like "meta-packages" which just contain a list of deps.  So I am going 
to need to use some sort of "grep ... || ret=" syntax anyway.

Allan



More information about the pacman-dev mailing list