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

Allan McRae allan at archlinux.org
Thu Dec 10 00:40:07 EST 2009

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 


 > 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.


More information about the pacman-dev mailing list