Friday, September 23, 2011

Plotting a dependency graph

While working with building loads of packages, it is often necessary to visualise dependencies between them. Two years ago I suffered a lot trying to do just that and at best I came up with a python script that gives a textual list of deps. Today, I found an awesome tool to plot dependency graphs. Although useless for most of the people, it is quite a nifty trick for the few who work with thousands of packages.

Two RPMs need to be installed before anything else

# yum install rpmorphan graphviz

Now, assume you need all the deps for rebuilding "rpm" (The actual RPM rpm)
First, generate a textual dep graph using:

# rpmdep -dot rpm

The "dot" is a file-format which will be used by the "dot" program to plot a graph. To plot the graph

# dot -Tsvg -o rpm.svg

The command takes and plots the graph in an svg format.


A sample image I generated is here:


Kedar said...


Is this truncated at a certain depth? Why are dependencies of grep etc. on glibc not shown ?

Jitesh Shah said...

It is more like a dependency tree rather than a graph. glibc already appeared as a dep of zlib. So, it wasn't considered for any of the stuff later.

Jitesh Shah said...

basically, it does what RPM would do while resolving dependencies.

KS said...

Ah got it, left-child->left-1-child->...->right-child->parent traversal