[pacman-dev] [PATCH v2] makepkg: Empty/create only $pkgdir's relevant to current PKGBUILD

David Macek david.macek.0 at gmail.com
Thu Mar 26 13:48:33 UTC 2015


Currently makepkg clears the whole $pkgbasedir which is needless. Moreover,
in the obscure case of multiple makepkg runs (with different $pkgname) that
share a $pkgdirbase, only $pkgdir's from the last run will remain. Since
I consider the contents of $pkgdir an important artifact, this commit restricts
the deletion to individual $pkgdir's.

When CLEANUP is set, the behavior is unchanged.

Discussed in:
https://lists.archlinux.org/pipermail/pacman-dev/2015-February/019939.html
---
 scripts/makepkg.sh.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2e6a0cc..e89d0ff 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -3413,10 +3413,12 @@ if (( NOBUILD )); then
 	msg "$(gettext "Sources are ready.")"
 	exit 0 #E_OK
 else
-	# clean existing pkg directory
+	# clean existing pkg directories
 	if [[ -d $pkgdirbase ]]; then
 		msg "$(gettext "Removing existing %s directory...")" "\$pkgdir/"
-		rm -rf "$pkgdirbase"
+		for pkg in $pkgname; do
+			rm -rf "$pkgdirbase/$pkg"
+		done
 	fi
 	mkdir -p "$pkgdirbase"
 	chmod a-srwx "$pkgdirbase"
-- 
1.9.4.msysgit.2

-- 
David Macek

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4234 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20150326/630b22f2/attachment.p7s>


More information about the pacman-dev mailing list