Single Repository Package Dependency Graph in Debian-based systems

Jurjen Bokma

July 2012

There are several ways (apt-rdepends, apt-cache (r)depends, debtree) to list Debian package dependencies for visualization. But I wish to only list those packages that are in my repository, and maybe the packages they directly depend on. I definitely want to skip all the dependencies deeper than that. Here 's how to do that:

# Create the debtree dotdir if (it doesn't exist)
mkdir ~/.debtree
# List the packages in the repository we're interested in (use another aptitude search pattern if it hasn't got Origin specified)
aptitude search '?origin (lwp)' -F '%p'|tr -d '\t ' > lwp-packages~
# List all other packages in the 'end list' of debtree. (Be sure to back that file up if need be)
apt-cache pkgnames |fgrep -xvf lwp-packages > ~/.debtree/endlist
# Run debtree
debtree -v --no-conflicts lwp|dot -Tsvg > lwp-deps.svg
# Clean up by removing the end list
rm ~/.debtree/endlist

Now, all packages that mine directly depend upon are still listed, but anything deeper is omitted:

Figure 1.  LWP Dependency Graph
Tree graph of the dependencies of package "lwp"

Loose links: