Sometimes I wonder about a package and its dependencies, and more specifically
the (installed) size of it all. For a simple list of a package's dependencies,
pactree is a great tool that does the job fine.
But when I'm wondering about the size, something else is needed. In fact, quite
a few times I've found myself doing a
pacman -S/-Rs package in order to know
either how much size a package (and its "exclusive" (as in not needd by any
other packages) dependencies) are eating up, or how much would be needed to
This isn't, however, an ideal solution, obviously. It does require root privileges, even though I don' go through with the transaction, and adds useless entry in pacman.log
So I started thinking about it a bit, fast-forward a little and here comes pacdep
pacdep: Package Dependencies listing
pacdep is a little tool that will show the installed size of the package, its exclusive dependencies, and its shared dependencies; Optional dependencies can be shown as well.
By default pacdep searches the local database first, and if not found searches all sync databases, making it easy to use with packages installed or not all the same. Of course, there's an option to use sync databases only, should you need that.
Package names are prefixed by the repository name they were found in when they're not from the local database.
As hinted, pacdep creates groups of dependencies: exclusive ones, shared ones, and (optionally) optional ones. By default, only the total size of each group will be shown, but of course you can have packages of any of those groups be listed.
After the package's installed size, in parenthesis will be the installed size of
the package and its exclusive (and optional, if
--show-optional was used)
If the package is from local database (i.e. is installed), only dependencies from local database are taken into account. If it is from a sync database (i.e. is not installed), only dependencies from sync databases are taken into account.
In other words, this size represents either the size the package and its dependencies are using on the system (size that could potentially be freed if removing the package and its dependencies), or the size needed to install them.
--reverse is used, instead of listing the dependencies of the
specified packages, pacdep will list packages that require them (i.e. the
dependency tree is browsed in reverse).
By default only immediate "requirers" are listed, i.e. packages that have one of the specified packages as dependency.
Specifying the option a second time will go through the entire dependency tree, until a package that isn't required is found. All packages met will be listed.
Specifying the option a third time will go through the dependency tree all the same, but only the end packages (that aren't required) will be listed.
Just like in "regular" mode, you can have optional dependencies taken into account as well.
Instead of listing optional dependencies, you can list packages that have one of the specified packages as optional dependency.
To give you a quick idea of what you can get, here are a few examples.
Listing exclusive & optional dependencies of git :
% pacdep -eo git git 17.24 MiB ( 20.71 MiB) Exclusive dependencies: 2.76 MiB perl-convert-binhex 56.00 KiB perl-error 76.00 KiB perl-io-socket-ssl 140.00 KiB perl-io-stringy 148.00 KiB perl-mailtools 204.00 KiB perl-net-ssleay 1.93 MiB perl-timedate 228.00 KiB Optional dependencies: 732.00 KiB perl-authen-sasl 188.00 KiB perl-mime-tools 500.00 KiB perl-net-smtp-ssl 44.00 KiB Shared dependencies: 20.09 MiB Total dependencies: 23.57 MiB ( 40.81 MiB)
Listing optional dependencies of git, in quiet mode, using raw sizes :
% pacdep -oqw git git 18079744 perl-authen-sasl 192512 perl-mime-tools 512000 perl-net-smtp-ssl 45056
Listing packages (sorted by size) that (optionally) require git, from sync databases :
% pacdep -Roz --from-sync git extra/git 17.24 MiB Required by: 7.47 MiB community/giggle 2.41 MiB community/gitg 1.70 MiB extra/archboot 1.20 MiB community/qgit 948.00 KiB community/sparkleshare 880.00 KiB community/tig 232.00 KiB community/hub 160.00 KiB Optionally required by: 71.18 MiB community/qtcreator 50.10 MiB extra/kdevelop 13.02 MiB community/zim 7.01 MiB extra/kdesdk-dolphin-plugins 540.00 KiB community/luarocks 536.00 KiB Total dependencies: 78.65 MiB ( 95.89 MiB)
Listing optional dependencies of gparted (not installed), including all optional dependencies ;
% pacdep -oppp gparted extra/gparted 5.58 MiB ( 34.05 MiB) Exclusive dependencies: 29.37 MiB local: 8.12 MiB sync: 21.25 MiB Optional dependencies: 9.00 MiB local: 1.77 MiB polkit 1.77 MiB sync: 7.23 MiB extra/dosfstools 240.00 KiB extra/gpart 52.00 KiB core/jfsutils 1.03 MiB extra/mtools 412.00 KiB core/nilfs-utils 512.00 KiB extra/ntfsprogs 576.00 KiB core/reiserfsprogs 1.01 MiB core/xfsprogs 3.44 MiB Shared dependencies: 244.99 MiB Total dependencies: 283.35 MiB (288.93 MiB)
If you want to give it a try, go ahead. pacdep is released under GNU GPL v3+ The source code is available on this GitHub repository.
You can also find a PKGBUILD in the AUR.
And of course bug reports, suggestions or any other form of constructive criticism is very much welcome.