apt-rdepends is a great tool to list complete dependencies of a package. Beside of that, apt-rdepends has capability to produce graph-compatible output. In other words, user can use apt-rdepends to produce dependencies list then use dot to create dependencies map in an image file (whether it is PNG or else). In this article, we will create maps for some Ubuntu packages separately.


Preparation


sudo apt-get install apt-rdepends dot

Mapping nano


apt-rdepends --dotty nano | dot -Tpng > dependency-map.png



Mapping gcc


apt-rdepends --dotty nano | dot -Tpng > dependency-map.png



Mapping firefox


apt-rdepends --dotty firefox | dot -Tpng > dependency-map.png


Mapping scribus


apt-rdepends --dotty scribus | dot -Tpng > dependency-map.png


Map Explanation


  • Blue: pre-depends.
  • Black: depends. 
Both blue and black lines are symbols of dependency. For example, in the nano graph, nano package has black arrow to dpkg package. It means nano depends to dpkg. In simpler words, nano needs dpkg. But on the same graph, dpkg package has blue arrow to tar package. In simpler words, it means dpkg needs tar, but when installation happens, tar must be installed and configured completely before dpkg installed. For more explanation about pre-depends you can read Debian FAQ https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html.

Commands Explanation


  • apt-rdepends --dotty <package>: resolve dependencies recursively and output the list in dot-readable text format.
  • | dot -Tpng > dependency-map.png: receive dependency list output from another program and produce the graph in PNG file.

Notes


To save into SVG (so the image file will be scalable), use -Tsvg instead -Tpng.


, , , ,