[pacman-dev] [PATCH 2/7] libmakepkg: stop printsrcinfo generating empty values

Eli Schwartz eschwartz at archlinux.org
Fri Jun 8 19:33:40 UTC 2018


On 06/08/2018 02:18 PM, morganamilo wrote:
> When a split package overriddes an array using += and the array does not
> exist globally, makepkg --printsrcinfo will print the field with an
> empty vlaue before printing the acual values.
> 
> For exampple: having `depends+=(foo bar)` will generate:
> 	depends =
> 	depends = foo
> 	depends = bar
> 
> Explicity check for empty array values and only print the values that
> are not empty.
> 
> Signed-off-by: morganamilo <morganamilo at gmail.com>
> ---
>  scripts/libmakepkg/srcinfo.sh.in | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/libmakepkg/srcinfo.sh.in b/scripts/libmakepkg/srcinfo.sh.in
> index 509c4860..6a49be37 100644
> --- a/scripts/libmakepkg/srcinfo.sh.in
> +++ b/scripts/libmakepkg/srcinfo.sh.in
> @@ -44,7 +44,11 @@ srcinfo_write_attr() {
>  	attrvalues=("${attrvalues[@]#[[:space:]]}")
>  	attrvalues=("${attrvalues[@]%[[:space:]]}")
>  
> -	printf "\t$attrname = %s\n" "${attrvalues[@]}"
> +	for val in "${attrvalues[@]}"; do
> +		if [[ ! -z ${val// /} ]]; then
> +			printf "\t$attrname = %s\n" "$val"
> +		fi
> +	done

This is odd, I wonder why get_pkgbuild_attribute is returning an
array=('' foo bar) in this case? We should probably fix it more directly.

-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20180608/b5e4cc22/attachment.asc>


More information about the pacman-dev mailing list