Brandon Invergo

Re-installing all reverse dependencies of packages in Arch Linux with Pacman

[note: this was originally entitled "Rebuilding all reverse dependencies…", which was obviously incorrect. it was supposed to be "Reinstalling…"]

This post is mainly a reminder for myself in case the situation ever comes up again but, of course, it could always prove useful for someone else.

Recently, updates to libpng and libtiff in Arch Linux required a rebuild of all packages that depend on them, thus they all needed to be re-installed manually. I knew there must be a more efficient way to do this than to search the package listing on the Arch website to find all the packages that depend on these two and then to manually check which ones of those I have installed (this is what I started doing at first).

So, that’s when I put together this:

    pacman -S `cat <(pactree -lrud1 libpng) <(pactree -lrud1 libtiff) | sort | uniq`

pactree -lrud1 lists all of the reverse dependencies of package to a depth of one (so only the ones that directly depend on it). If you have to do this for multiple packages, you can cat together their output. Then you just sort the list and get rid of duplicates with uniq.

Creative Commons License
Rebuilding All Reverse Dependencies of Packages in Arch Linux with Pacman by Brandon Invergo is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.