[pacman-dev] [PATCH] makepkg: improve removal of installed dependencies

Cedric Staniewski cedric at gmx.ca
Sun Dec 13 21:13:05 EST 2009


On 12/10/2009 06:40 AM, Allan McRae wrote:
> Cedric Staniewski wrote:
>> On 12/03/2009 03:33 PM, Allan McRae wrote:
>>> Compare a list of packages on the system before and after dependency
>>> resolution
>>> in order to get a complete list of packages to remove.  This allows
>>> makepkg to
>>> remove packages installed due to provides.
>>>
>>> Bail in cases where packages that were on the system originally have
>>> been
>>> removed as there is a risk of breaking the system when removing the new
>>> packages
>>>
>>> Fixes FS#15144
>>>
>>> Signed-off-by: Allan McRae <allan at archlinux.org>
>>> ---
>>
>> I have not tested the patch yet, so just some comments on the code for
>> now.
>>
> 
> Thanks for the comments.  I have pushed the updated patch on my working
> branch:
> http://projects.archlinux.org/users/allan/pacman.git/commit/?h=working&id=ffc7b0dc
>

I tested your latest patch for the last few days and did not encountered
an issue so far. Looks good.

>>
>> You could use comm here. The advantage would be that it do not pull in
>> a new dependency as it is in coreutils too and you do not need grep to
>> get the unique lines.
>>
>> if [[ -n $(printf "%s\n" ${original_pkglist[@]} \
>>     | comm -23 - <(printf "%s\n" ${current_pkglist[@]})) ]]
>>
> 
> I went for:
>   if [[ -n $(comm -23 <(printf "%s\n" "${original_pkglist[@]}") \
>                       <(printf "%s\n" "${current_pkglist[@]}")) ]]; then
> 
> The only slight annoyance was when using comm the output of pacman -Qq
> needed sorted as pacman outputs in a very slightly different
> alphabetical order to what comm expects and "--nocheck-order" is not
> portable to BSD/OSX.

Oh, sorry. I thought the output of pacman -Qq is already sorted in the
correct way. Good catch.


More information about the pacman-dev mailing list