[pacman-dev] Delete just $pkgdir instead of whole $pkgdirbase

Allan McRae allan at archlinux.org
Mon Feb 23 09:31:51 UTC 2015


On 20/02/15 10:59, David Macek wrote:
> Hi.
> 
> makepkg deletes the whole $pkgdirbase directory before starting build(). <https://github.com/elieux/pacman/blob/upstream/scripts/makepkg.sh.in#L3460>
> 
> I propose a change to delete just $pkgdir, and an addition of similar code before starting package*(). I don't see any downside to this (except for the time it takes to implement the change) and I give two reasons for the change:
> 
> Reason 1: in case $pkgdirbase is a symlink, it gets re-created as a regular directory, which is probably unwanted behavior. The MSYS2 guys even have a patch for this. <https://github.com/elieux/pacman/blob/master/scripts/makepkg.sh.in#L3378-3388>
> 
> Reason 2: in case makepkg is ran twice in the same directory (but with different configurations and different $pkgname), the second run deletes the $pkgdirbase of the first run, but sometimes it's beneficial to inspect the $pkgdir after makepkg has finished. This may seem as an obscure use-case, but it's very common with the MSYS2 project. <https://github.com/elieux/MSYS2-packages/blob/master/pacman/makepkg-mingw>
> 
> (Since this seems to be a fairly easy thing to change, I may even prepare a patch myself.)

Just a one line patch is needed:

-		rm -rf "$pkgdirbase"
+		rm -rf "$pkgdirbase/*"

The MSys2 patch is wrong (the empty permissions does not get reinstated
if the directory is already there).

Someone submit that for me...


Allan


More information about the pacman-dev mailing list