[pacman-dev] [PATCH 5/6] makepkg: put further restrictions on pkgbase

Andrew Gregory andrew.gregory.8 at gmail.com
Wed May 13 02:29:37 UTC 2015


On 05/13/15 at 12:02am, Allan McRae wrote:
> pkgbase should be subject to the same restrictions as pkgver

s/pkgver/pkgname/ ?

> Signed-off-by: Allan McRae <allan at archlinux.org>
> ---
>  doc/PKGBUILD.5.txt                             | 6 ++++--
>  scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in | 9 +++++++++
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
> index bc278f2..62ae5c7 100644
> --- a/doc/PKGBUILD.5.txt
> +++ b/doc/PKGBUILD.5.txt
> @@ -407,8 +407,10 @@ An optional global directive is available when building a split package:
>  *pkgbase*::
>  	The name used to refer to the group of packages in the output of makepkg
>  	and in the naming of source-only tarballs. If not specified, the first
> -	element in the `pkgname` array is used. The variable is not allowed to
> -	begin with a hyphen.
> +	element in the `pkgname` array is used. Valid characters for members of
> +	this variable are alphanumerics, and any of the following characters:
> +	```@ . _ + -`''. Additionally, the variable is not allowed to start with
> +	hyphens or dots.
>  
>  
>  Install/Upgrade/Remove Scripting
> diff --git a/scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in b/scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in
> index abb40e0..0d4361c 100644
> --- a/scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in
> +++ b/scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in
> @@ -34,4 +34,13 @@ lint_pkgbase() {
>  		error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
>  		return 1
>  	fi
> +	if [[ ${pkgbase:0:1} = "." ]]; then
> +		error "$(gettext "%s is not allowed to start with a dot.")" "pkgbase"
> +		ret=1
> +	fi
> +	if [[ $pkgbase = *[^[:alnum:]+_. at -]* ]]; then
> +		error "$(gettext "%s contains invalid characters: '%s'")" \
> +				'pkgbase' "${i//[[:alnum:]+_. at -]}"
> +		ret=1
> +	fi
>  }
> -- 
> 2.4.0


More information about the pacman-dev mailing list