| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 5 |
<meta name="keywords" lang="en" content="debtree debian package build dependency graph"> |
| 6 |
<title>debtree - Package dependency graphs</title> |
| 7 |
</head> |
| 8 |
|
| 9 |
<body> |
| 10 |
<h1>debtree — package dependency graphs on steroids</h1> |
| 11 |
|
| 12 |
<table> |
| 13 |
<tbody valign="top"> |
| 14 |
<tr> |
| 15 |
<td> |
| 16 |
<h2>Introduction</h2> |
| 17 |
|
| 18 |
<p> |
| 19 |
This started with the simple question "how exactly does package X pull in |
| 20 |
package Y when I install it". The only way I knew of was to use |
| 21 |
<tt>aptitude</tt> interactively and just guess which package was the most |
| 22 |
likely culprit. |
| 23 |
</p><p> |
| 24 |
So I set out to create a simple script to recurse through dependencies... |
| 25 |
</p><p> |
| 26 |
Basically this meant building a dependency tree. I'd long wanted to play |
| 27 |
with <tt>dot</tt>, and this seemed like a good opportunity as visualizing |
| 28 |
the trees looked like a nice way to check their correctness. |
| 29 |
</p><p> |
| 30 |
To make a long story short, after the basic functionality had been implemented, |
| 31 |
it turned out to be fairly easy (and irresistible) to extend the functionality |
| 32 |
bit by bit. |
| 33 |
</p><p> |
| 34 |
So now we have a script that can generate dependency graphs in the form of |
| 35 |
<tt>.dot</tt> files that serve as input for <tt>dot</tt> (from the |
| 36 |
<tt>graphviz</tt> package). |
| 37 |
</p><p> |
| 38 |
The commands <tt>apt-cache</tt> and <tt>apt-rdepends</tt> have similar options, |
| 39 |
but <tt>debtree</tt> is a lot more powerful. |
| 40 |
</p> |
| 41 |
|
| 42 |
<h3 id="examples">Examples</h3> |
| 43 |
|
| 44 |
<p> |
| 45 |
The examples below show the different levels of detail that can be |
| 46 |
obtained using <tt>debtree</tt> and explain the graphs. Please view |
| 47 |
them in the indicated order. |
| 48 |
</p><p> |
| 49 |
Note that Postscript viewers may not display some of the larger graphs until |
| 50 |
you zoom out one or more times. I've used <tt>kghostview</tt> and that at |
| 51 |
least always showed the thumbnail correctly. |
| 52 |
</p> |
| 53 |
<ul> |
| 54 |
<li><a href="debconf1.html">debconf</a></li> |
| 55 |
<li><a href="aptitude1.html">aptitude</a></li> |
| 56 |
<li><a href="usage1.html">advanced usage</a></li> |
| 57 |
</ul> |
| 58 |
|
| 59 |
<p> |
| 60 |
Other packages for which (mostly default) graphs have been produced, roughly |
| 61 |
in ascending order of complexity:<br /> |
| 62 |
<tt>bind9</tt>, <tt>debmirror</tt>, <tt>gettext</tt>, <tt>iceweasel</tt>, |
| 63 |
<tt>logcheck</tt>, <tt>logrotate</tt>, <tt>mutt</tt>, |
| 64 |
<tt>mysql-client</tt>, <tt>mysql-server</tt>, <tt>ssh</tt>, <tt>subversion</tt>, |
| 65 |
<tt>debiandoc-sgml</tt>, <tt>exim4</tt>, <tt>cupsys</tt>, <tt>gimp</tt>, |
| 66 |
<tt>lintian</tt>, <tt>apache2</tt>, <tt>wesnoth</tt>, <tt>vlc</tt>. |
| 67 |
</p><p> |
| 68 |
To get usable graphs for some of these, a number of packages have been added |
| 69 |
to the <tt>/etc/debtree/endlist</tt> configuration file. If you try other |
| 70 |
packages, you may need to do the same. Try to add only packages for which it |
| 71 |
is "logical" not to expand the graph any further. |
| 72 |
</p><p> |
| 73 |
Another option is to limit the number of dependency levels (the "depth" of the |
| 74 |
graph) by specifying a maximum depth or to reduce the amount of information |
| 75 |
included in the graph using the available command line options. |
| 76 |
</p> |
| 77 |
|
| 78 |
<h2 id="download">Download</h2> |
| 79 |
|
| 80 |
<p> |
| 81 |
The <tt>debtree</tt> package is available from the |
| 82 |
<a href="http://packages.debian.org/debtree">Debian archive</a> for 'Sqeeze' |
| 83 |
and later. The package for 'Squeeze' can be installed without any problems on |
| 84 |
systems running 'Lenny'. |
| 85 |
</p><p> |
| 86 |
You can also check out the source code from the |
| 87 |
<a href="http://git.debian.org/?p=collab-maint/debtree.git;a=summary">git |
| 88 |
repository</a> using:<br /> |
| 89 |
<tt><font size="-1"> |
| 90 |
$ git clone git://git.debian.org/collab-maint/debtree.git |
| 91 |
</font></tt> |
| 92 |
</p><p> |
| 93 |
The dependencies are <tt>perl</tt>, <tt>libapt-pkg-perl</tt>, |
| 94 |
<tt>dctrl-tools</tt> and <tt>ucf</tt>; <tt>graphviz</tt> is recommended. |
| 95 |
</p><p> |
| 96 |
Comments to: <a href="mailto:elendil%40planet.nl">Frans Pop</a>. |
| 97 |
Please submit bugs and patches via the Debian Bug Tracking System. |
| 98 |
</p><p> |
| 99 |
<b>Note</b><br /> |
| 100 |
The option to print dependency paths has been dropped in version 0.9.0. |
| 101 |
I doubt anybody used that, and the same is possible using |
| 102 |
'<tt>aptitude why</tt>', which does a better job. |
| 103 |
</p> |
| 104 |
|
| 105 |
<h2 id="issues">Known issues</h2> |
| 106 |
|
| 107 |
<ul> |
| 108 |
<li> |
| 109 |
In some cases graphs can get fairly messy when there are alternatives that |
| 110 |
have very similar dependencies. Good examples are <tt>apache</tt> and |
| 111 |
<tt>wesnoth</tt> (although the last looks to have been cleaned up in Squeeze). |
| 112 |
</li> |
| 113 |
</ul> |
| 114 |
|
| 115 |
<h2 id="future">Future development</h2> |
| 116 |
|
| 117 |
<p> |
| 118 |
There is still a lot of improvement possible. See also the comments in the |
| 119 |
current script. |
| 120 |
</p> |
| 121 |
|
| 122 |
<ul> |
| 123 |
<li> |
| 124 |
Option to generate sub-graphs on separate pages. |
| 125 |
</li><li> |
| 126 |
Accept multiple packages as input to generate combined graphs. |
| 127 |
</li><li> |
| 128 |
Have the tool automatically determine points where to stop recursing or |
| 129 |
where to create sub-graphs on a separate page. |
| 130 |
</li><li> |
| 131 |
Maybe show aggregated package sizes. |
| 132 |
</li> |
| 133 |
</ul> |
| 134 |
|
| 135 |
</td> |
| 136 |
<td width="10" /> |
| 137 |
<td width="500"> |
| 138 |
|
| 139 |
<pre> |
| 140 |
$ debtree dpkg |
| 141 |
</pre> |
| 142 |
<hr /> |
| 143 |
<img src="thumbs/dpkg.png" alt="Dependency graph for dpkg" /> |
| 144 |
<hr /> |
| 145 |
|
| 146 |
<h3 id="usage">Usage</h3> |
| 147 |
|
| 148 |
<p> |
| 149 |
See the <b>debtree</b>(1) man page for detailed usage information. |
| 150 |
</p> |
| 151 |
|
| 152 |
<p> |
| 153 |
<b>Examples</b> |
| 154 |
</p> |
| 155 |
<ul> |
| 156 |
<li><b>Create a <tt>.dot</tt> file</b><br /> |
| 157 |
<tt>$ debtree --with-suggests <package> >out.dot</tt></li> |
| 158 |
<li><b>Create a graph (PNG) from a <tt>.dot</tt> file</b><br /> |
| 159 |
<tt>$ dot -T png -o out.png out.dot</tt></li> |
| 160 |
<li><b>Create a graph (Postscript) and view it using <tt>kghostview</tt></b><br /> |
| 161 |
<tt>$ debtree <package> | dot -Tps | kghostview - &</tt></li> |
| 162 |
</ul> |
| 163 |
|
| 164 |
<p> |
| 165 |
<b>Option summary</b> |
| 166 |
</p> |
| 167 |
<dl> |
| 168 |
<dt><tt>--show-installed | -I</tt></dt> |
| 169 |
<dd>Show which packages are installed on the system</dd> |
| 170 |
<dt><tt>--show-rdeps | -R</tt></dt> |
| 171 |
<dd>Also show reverse dependencies of the package and any virtual packages it provides</dd> |
| 172 |
<dt><tt>--build-dep | -b</tt></dt> |
| 173 |
<dd>Generate a graph showing build dependencies instead of package dependencies</dd> |
| 174 |
<dt><tt>--arch=<arch></tt></dt> |
| 175 |
<dd>Specify the architecture (or 'all') for the build dependency graph |
| 176 |
(default is the architecture of the system)</dd> |
| 177 |
<dt><tt>--with-suggests | -S</tt></dt> |
| 178 |
<dd>Include suggested packages; dependencies of suggested packages are never included</dd> |
| 179 |
<dt><tt>--no-recommends</tt></dt> |
| 180 |
<dd>Don't show recommended packages</dd> |
| 181 |
<dt><tt>--no-alternatives</tt></dt> |
| 182 |
<dd>Only show the first dependency from a set of alternatives (i.e. show what would |
| 183 |
be installed by default)</dd> |
| 184 |
<dt><tt>--no-provides</tt></dt> |
| 185 |
<dd>Do not show virtual packages provided by the requested package</dd> |
| 186 |
<dt><tt>--max-providers=<num></tt></dt> |
| 187 |
<dd>Limit the display of packages that provide a virtual package (default: 3)</dd> |
| 188 |
<dt><tt>--no-versions</tt></dt> |
| 189 |
<dd>Don't show the versions for versioned dependencies</dd> |
| 190 |
<dt><tt>--no-conflicts</tt></dt> |
| 191 |
<dd>Don't show unversioned conflicts</dd> |
| 192 |
<dt><tt>--versioned-conflicts | -VC</tt></dt> |
| 193 |
<dd>Include versioned conflicts; by default only unversioned conflicts are shown</dd> |
| 194 |
<dt><tt>--max-depth=<num></tt></dt> |
| 195 |
<dd>Limit the number of levels of dependencies</dd> |
| 196 |
<dt><tt>--rdeps-depth=<num></tt></dt> |
| 197 |
<dd>The maximum number of levels for reverse dependencies (default: 1)</dd> |
| 198 |
<dt><tt>--max-rdeps=<num></tt></dt> |
| 199 |
<dd>Limit the display of indirect reverse dependencies (default: 5)</dd> |
| 200 |
<dt><tt>--no-skip</tt></dt> |
| 201 |
<dd>Also display packages that are suppressed by default (e.g. libc6)</dd> |
| 202 |
<dt><tt>--show-all</tt></dt> |
| 203 |
<dd>Generate full dependency tree (recurse for <em>all</em> packages); implies <tt>--no-skip</tt></dd> |
| 204 |
<dt><tt>--rotate | -r</tt></dt> |
| 205 |
<dd>Draw the graph top-town instead of left-to-right</dd> |
| 206 |
<dt><tt>--condense</tt></dt> |
| 207 |
<dd>Condense the graph by merging lines (relationships) between packages</dd> |
| 208 |
<dt><tt>--quiet | -q</tt></dt> |
| 209 |
<dd>Suppress any informational/warning messages</dd> |
| 210 |
<dt><tt>--verbose | -v</tt></dt> |
| 211 |
<dd>Increase verbosity to display debug messages; can be repeated</dd> |
| 212 |
</dl> |
| 213 |
|
| 214 |
<p> |
| 215 |
<b>Configuration</b> |
| 216 |
</p> |
| 217 |
<dl> |
| 218 |
<dt><tt>/etc/debtree/skiplist</tt></dt> |
| 219 |
<dd>Packages that by default will be excluded from dependency graphs.</dd> |
| 220 |
<dt><tt>/etc/debtree/endlist</tt></dt> |
| 221 |
<dd>Packages for which by default no dependencies will be shown on graphs.</dd> |
| 222 |
</dl> |
| 223 |
|
| 224 |
<p> |
| 225 |
See the comments in these files and the examples on these pages for information |
| 226 |
on how they are used. The configuration can be overruled on a per-user basis by |
| 227 |
creating a directory <tt>~/.debtree/</tt> and adding custom versions of these |
| 228 |
files there. |
| 229 |
</p><p> |
| 230 |
Suggestions for packages to add are welcome. Please mail both the command for the |
| 231 |
graph you'd like to reduce and the packages you're proposing to add to the lists. |
| 232 |
</p><p> |
| 233 |
The current list of 'skip' packages is:<br /> |
| 234 |
<tt>libc6</tt>, <tt>libgcc1</tt>, <tt>libstdc++6</tt>, <tt>zlib1g</tt>, |
| 235 |
<tt>libx11-6</tt>, <tt>libc6-dev</tt>, <tt>libc-dev</tt>.<br /> |
| 236 |
Reason these packages are excluded is that they are so common that including |
| 237 |
them only result in cluttering the graph without adding any real information. |
| 238 |
An option is available that allows to generate a full graph that includes |
| 239 |
these packages. |
| 240 |
</p> |
| 241 |
|
| 242 |
<p> |
| 243 |
<b>Tips</b> |
| 244 |
</p> |
| 245 |
|
| 246 |
<p> |
| 247 |
The <tt>graphviz</tt> suite includes utilities that can be used to manipulate |
| 248 |
graphs after they have been generated. See for example the man pages for |
| 249 |
<tt>prune</tt> and <tt>gvpr</tt>. |
| 250 |
</p> |
| 251 |
|
| 252 |
</td> |
| 253 |
</tr> |
| 254 |
</tbody> |
| 255 |
</table> |
| 256 |
|
| 257 |
</body> |
| 258 |
</html> |