[pacman-dev] [PATCH 3/3] makepkg: Empty/create only $pkgdir's relevant to current PKGBUILD (unless CLEANUP is set)

Allan McRae allan at archlinux.org
Thu Mar 19 02:08:36 UTC 2015


On 18/03/15 03:19, David Macek wrote:
> ---

Provide a commit message explaining why this change is being made.

>  scripts/makepkg.sh.in | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 6ca678e..af8a606 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -2822,6 +2822,11 @@ run_split_packaging() {
>  	local pkgname_backup=${pkgname[@]}
>  	for pkgname in ${pkgname_backup[@]}; do
>  		pkgdir="$pkgdirbase/$pkgname"
> +		# clean existing pkg directory
> +		if [[ -d $pkgdir ]]; then
> +			msg "$(gettext "Removing existing %s directory...")" "\$pkgdir/"
> +			rm -rf "$pkgdir"
> +		fi
>  		mkdir "$pkgdir"
>  		backup_package_variables
>  		run_package $pkgname
> @@ -3276,6 +3281,11 @@ if (( INFAKEROOT )); then
>  	chmod 755 "$pkgdirbase"
>  	if (( ! SPLITPKG )); then
>  		pkgdir="$pkgdirbase/$pkgname"
> +		# clean existing pkg directory
> +		if [[ -d $pkgdir ]]; then
> +			msg "$(gettext "Removing existing %s directory...")" "\$pkgdir/"
> +			rm -rf "$pkgdir"
> +		fi
>  		mkdir "$pkgdir"
>  		if (( PKGFUNC )); then
>  			run_package
> @@ -3396,11 +3406,6 @@ else
>  		cd_safe "$startdir"
>  	fi
>  
> -	# clean existing pkg directory
> -	if [[ -d $pkgdirbase ]]; then

To avoid the duplication, why not loop over pkgname here? (note pkgname
contains only the packages being built if --pkg is used).

msg "$(gettext "Cleaning existing %s directory...")" "\$pkgdir/"
for pkg in $pkgname; do
...

> -		msg "$(gettext "Removing existing %s directory...")" "\$pkgdir/"
> -		rm -rf "$pkgdirbase"
> -	fi
>  	mkdir -p "$pkgdirbase"
>  	chmod a-srwx "$pkgdirbase"
>  
> 


More information about the pacman-dev mailing list