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

David Macek david.macek.0 at gmail.com
Mon Feb 23 15:03:54 UTC 2015


On 23. 2. 2015 10:31, Allan McRae wrote:
> 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...

This only solves case 1, not case 2, which is actually more important to me.

-- 
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/20150223/4c672d8b/attachment.p7s>


More information about the pacman-dev mailing list