From f9423cfa5d5b9f2041b70676438082faad1cd1ee Mon Sep 17 00:00:00 2001 From: David Macek Date: Thu, 26 Mar 2015 19:59:41 +0100 Subject: makepkg: Empty/create only $pkgdir's relevant to current PKGBUILD 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 Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2e6a0cc2..fb1ef20f 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -3413,10 +3413,13 @@ 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 + unset pkg fi mkdir -p "$pkgdirbase" chmod a-srwx "$pkgdirbase" -- cgit v1.2.3-24-g4f1b