On 09/06/18 04:18, morganamilo wrote:
> makepkpg will now error if disallowed variables are overridden inside of
> the package function.
> 
> Signed-off-by: morganamilo <[email protected]>
> ---
>  .../libmakepkg/lint_pkgbuild/variable.sh.in   | 36 +++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in 
> b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
> index 3266cb5e..68512a62 100644
> --- a/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
> +++ b/scripts/libmakepkg/lint_pkgbuild/variable.sh.in
> @@ -37,6 +37,12 @@ lint_variable() {
>                         replaces sha1sums sha256sums sha384sums sha512sums 
> source)
>       local string=(changelog epoch install pkgdesc pkgrel pkgver url)
>  
> +     local no_overide_string=(pkgbase pkgver pkgrel epoch)

override

Note the arrays above this have all variables in alphabetical order.

> +
> +     local no_overide_array=(checkdepends makedepends
> +                     noextract source validpgpkeys md5suns sha1sums

md5sums

> +                     sha224sums sha256sums sha384sums sha512sums)
> +
>       local i a v pkg keys out bad ret=0
>  
>       # global variables
> @@ -87,6 +93,22 @@ lint_variable() {
>               for a in ${arch[@]}; do
>                       [[ $a == "any" ]] && continue
>  
> +                     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"
> +                                     ret=1
> +                             fi
> +                     done

These are not variables being overridden...   pkgname_i686 is just not a
thing as far as makepkg is concerned.  Also, this is nothing to do with
overridding in a package function.  Get rid of this section.


> +
> +                     for i in ${no_overide_array[@]}; do
> +                             if extract_function_variable "package_$pkg" 
> "${i}_${a}" 1 out; then
> +                                     error "$(gettext "%s_%s can not be 
> overridden in package function")" "$i" "$a"
> +                                     ret=1
> +                             fi
> +
> +                     done
> +

As above.

> +
>                       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"
> @@ -95,6 +117,20 @@ lint_variable() {
>                       done
>               done
>  
> +             for i in ${no_overide_string[@]}; do
> +                     if extract_function_variable "package_$pkg" "$i" 0 out; 
> then
> +                             error "$(gettext "%s can not be overridden in 
> package function")" "$i"
> +                             ret=1
> +                     fi
> +             done
> +
> +             for i in ${no_overide_string[@]}; do

s/string/array

> +                     if extract_function_variable "package_$pkg" "$i" 1 out; 
> then
> +                             error "$(gettext "%s can not be overridden in 
> package function")" "$i"
> +                             ret=1
> +                     fi
> +             done
> +
>               for i in ${string[@]}; do
>                       if extract_function_variable "package_$pkg" $i 1 out; 
> then
>                               error "$(gettext "%s should not be an array")" 
> "$i"
> 

Reply via email to