[pacman-dev] [PATCH 4/7] libmakepkg: lint disallowed architecture specific variables

Allan McRae allan at archlinux.org
Tue Jun 19 12:23:07 UTC 2018


On 09/06/18 04:18, morganamilo wrote:
> Variables such as 'pkgdesc_x86_64' are invalid, instead of ignoring them
> raise an error.
> 
> Signed-off-by: morganamilo <morganamilo at gmail.com>
> ---
>  .../libmakepkg/lint_pkgbuild/variable.sh.in   | 24 ++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
> index 68512a62..b9264768 100644
> --- a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
> +++ b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
> @@ -69,6 +69,15 @@ lint_variable() {
>  				fi
>  			fi
>  		done
> +
> +		for i in ${array[@]} ${string[@]}; do
> +			v="${i}_${a}"
> +			eval "keys=(\"\${!${v}[@]}\")"
> +			if (( ${#keys[*]} > 0 )); then
> +				error "$(gettext "%s_%s can not be architecture specific")" "$i" "$a"

This patch looks OK.  I think the following error message would be more
clear:

error "$(gettext "%s can not be architecture specific: $s_$s")" "$i"
"$i" "$a"

> +				ret=1
> +			fi
> +		done
>  	done
>  
>  	for i in ${string[@]}; do
> @@ -93,6 +102,20 @@ lint_variable() {
>  		for a in ${arch[@]}; do
>  			[[ $a == "any" ]] && continue
>  
> +			for i in ${string[@]}; do
> +				if extract_function_variable "package_$pkg" "${i}_${a}" 0 out; then
> +					error "$(gettext "%s_%s can not be architecture specific")" "$i" "$a"
> +					ret=1
> +				fi
> +			done
> +
> +			for i in ${array[@]}; do
> +				if extract_function_variable "package_$pkg" "${i}_${a}" 1 out; then
> +					error "$(gettext "%s_%s can not be architecture specific")" "$i" "$a"
> +					ret=1
> +				fi
> +			done
> +>  			for i in ${no_overide_string[@]}; do
>  				if extract_function_variable "package_$pkg" "${i}_${a}" 0 out; then
>  					error "$(gettext "%s_%s can not be overridden in package function")" "$i" "$a"
> @@ -108,7 +131,6 @@ lint_variable() {
>  
>  			done
>  
> -
>  			for i in ${arch_array[@]}; do
>  				if extract_function_variable "package_$pkg" "${i}_${a}" 0 out; then
>  					error "$(gettext "%s_%s should be an array")" "$i" "$a"
> 


More information about the pacman-dev mailing list