[pacman-dev] [PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames

Allan McRae allan at archlinux.org
Wed Oct 28 01:04:15 EDT 2009


Cedric Staniewski wrote:
> Since commit fb97d32, which brought in this test, support for split
> PKGBUILDs was added, and therefore, all values of pkgname and also
> pkgbase have to be checked now.
>
> Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
> ---
>
>   
>> So it does....  I glad someone refers to the documentation! 
>>     
>
> :)
>
>  scripts/makepkg.sh.in |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 9cd7f2e..4c05ccc 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1139,10 +1139,17 @@ check_sanity() {
>  		error "$(gettext "%s is not allowed to be empty.")" "pkgrel"
>  		return 1
>  	fi
> -	if [ "${pkgname:0:1}" == "-" ]; then
> -		error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
> +	if [[ ${pkgbase:0:1} = "-" ]]; then
> +		error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgbase"
>  		return 1
>  	fi
> +	local name
> +	for name in "${pkgname[@]}"; do
> +		if [[ ${name:0:1} = "-" ]]; then
> +			error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
> +			return 1
> +		fi
> +	done
>  	if [ "$pkgver" != "${pkgver//-/}" ]; then
>  		error "$(gettext "%s is not allowed to contain hyphens.")" "pkgver"
>  		return 1
>   

Pushed to my working branch.  I changed the order of the check of 
pkgbase and pkgname so that pkgname comes first like in the PKGBUILD 
prototype for no particular reason....  it just seemed nicer to me.

Allan



More information about the pacman-dev mailing list