[pacman-dev] [PATCH 4/4] makepkg: Fixed sourceball creation of split packages

Allan McRae allan at archlinux.org
Fri Nov 6 10:36:43 EST 2009


Eric Bélanger wrote:
> In some case, the install script of split packages was not included in the sourceballs. This was due because split packages can specify their install script in the package functions.  They also can use several install scripts.
> 

Please add newlines to the commit message to keep them ~80 characters wide.

Note that this will need done for changelogs too as they are now handled 
like install files.

> Signed-off-by: Eric Bélanger <snowmaniscool at gmail.com>
> ---
>  scripts/makepkg.sh.in |   25 ++++++++++++++++++-------
>  1 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 8fc7c82..b77cc68 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1060,14 +1060,25 @@ create_srcpackage() {
>  	msg2 "$(gettext "Adding %s...")" "$BUILDSCRIPT"
>  	ln -s "${BUILDFILE}" "${srclinks}/${pkgbase}/${BUILDSCRIPT}"
>  
> -	if [ -n "$install" ]; then
> -		if [ -f $install ]; then
> -			msg2 "$(gettext "Adding install script...")"
> -			ln -s "${startdir}/$install" "${srclinks}/${pkgbase}/"
> -		else
> -			error "$(gettext "Install scriptlet (%s) does not exist.")" "$install"
> +	local install_files
> +	install_files=$(grep "install=" "$BUILDSCRIPT")
> +	for pkg in ${pkgname[@]}; do
> +		install_files+=' '
> +		install_files+=$(echo $install_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/")
> +		install_files=$(eval echo $install_files |tr '[:blank:]' '\n'|sort |uniq)
> +	done

This is too inclusive.  If I have one package with an install file 
$pkgname.install, then it will add an install file $pkg.install for 
every $pkg in $pkgname.  Some of these may not exist which will lead to 
trouble below when the files presence is tested for.

I do not know how to fix that issue... Two potential options are:
1) add install/changelog files to the source array
2) change the split PKGBUILD format to allow easier evaluation of 
variables within split packages.
Both have their drawbacks.

> +
> +	for f in $install_files; do
> +		install="${f#"install="}"
> +		if [[ -n "$install" ]]; then
> +			if [[ -f $install ]]; then
> +				msg2 "$(gettext "Adding install script...")"
> +				ln -s "${startdir}/$install" "${srclinks}/${pkgbase}/"
> +			else
> +				error "$(gettext "Install scriptlet (%s) does not exist.")" "$install"
> +			fi
>  		fi
> -	fi
> +	done
>  
>  	if [ -n "$changelog" ]; then
>  		if [ -f "$changelog" ]; then



More information about the pacman-dev mailing list