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

Allan McRae allan at archlinux.org
Mon Feb 23 15:23:36 UTC 2015


On 24/02/15 01:03, David Macek wrote:
> 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.
> 

I need case two explained to me more.  Why are you not using two PKGBUILDs?


More information about the pacman-dev mailing list