August 11, 2008

Viewing dependencies graphically on apt based systems

In trying to figure out how to create packages for Nexenta, I felt the need at multiple times to view the entire tree of dependencies for a package. A little bit of googling and I found that it is pretty simple.

The apt-cache command can be used to view dependencies graphically.

You will need to have the graphviz package installed for this.

$apt-cache dotty packagename > /tmp/dotfile
$dot -Tgif -o packagename.gif /tmp/dotfile

The complete dependency tree for the package packagename will be displayed in the file generated.

From the apt-cache manpage:

"The resulting nodes will have several shapes; normal packages are boxes, pure provides are triangles, mixed provides are diamonds, missing packages are hexagons. Orange boxes mean recursion was stopped [leaf packages], blue lines are pre-depends, green lines are conflicts."

An example for the hspell package:

hspell dependencies