1 .\" $NetBSD: pkgdepgraph.1,v 1.11 2004/07/28 01:42:43 atatat Exp $
3 .\" Copyright (c) 2002, 2003, 2004 by Andrew Brown <atatat@netbsd.org>
4 .\" Absolutely no warranty.
10 .Nd visual representation of installed packages
13 .Op Fl AaCcDeFfgLloRrsv
29 language description of the locally installed packages, with the
30 inter-dependencies reduced to a minimal set of edges.
31 It scans each directory under the package database directory for files
36 in order to gather its data.
39 will also read any files passed to it as arguments (or stdin if it
40 is not connected to a tty), in search of output that resembles that
46 .Xr audit-packages 8 ,
47 or the output from a previous incantation of this program.
51 will recolor the graph passed as input based, as usual, on information
52 about currently installed pkgs.
53 Packages that are in the input graph, but not currently installed,
54 will be colored black, those that are installed will be colored green,
55 and those that remain out of date for some reason will remain red.
57 The graph defaults to black, but if data from
62 is given, or if a specific package is asserted to be out of date (via the
64 option), then nodes (and edges leading from them) will be colored in
66 .Bl -tag -width purple
68 The package is completely up to date.
70 The package is up to date, but some of its dependencies require updating.
72 The package is out of date or has had a security advisory issued
73 against it, and should be replaced.
75 The package was not found in the local pkgsrc tree.
77 The package depends on something not found in the local pkgsrc tree.
79 The package has been removed and not yet replaced, or the graph is
81 The difference between an uncolored graph and a graph that has been
82 recolored almost entirely black as a result of removing all the
83 packages can be visually detected by the color of the
85 package with which the graph was recolored.
88 It is important to note that all installed packages fall into one (or
89 more) of the following categories:
90 .Bl -tag -width out-of-date
92 Any installed package.
94 Any package that can be upgraded.
96 Any package that depends on a package that is out of date.
98 Any package that is not depended on by any other package.
101 Selecting the type or types of packages that are listed, and how the
102 information is put to use, can be controlled by the following options:
103 .Bl -tag -width package
105 This option modifies the output of
109 to reinstall deleted packages, instead of building directly from the
113 This option can be specified more than once to augment the meaning of
115 as it relates to the selected output mode.
116 For the default graph output, this option has no effect.
119 where the default output is the list of out of date packages, one
123 also list stale packages, and a second
125 will make it list all installed packages.
131 so that all rebuilt dependencies are cleaned as well.
135 command in the set of instructions to rebuild packages (see the
137 option) after they are installed.
140 option used to enable graph coloring, but now graph coloring is done
141 automatically if any coloring data is given.
143 Instead of the standard graph output,
145 lists the packages that need to be deleted, in
146 .Dq least required first
147 order, so that they can be deleted without any dependency problems.
148 This is a good first step to take before rebuilding all your packages
149 that are out of date (see the
152 This option is an alias for
154 .It Fl d Ar pkg_dbdir
155 The location of the package database files.
156 This defaults to the value of the
158 environment variable, if it is set, or to
163 to each of the lines of
165 style output so that commands can be skipped if the package is already
172 commands that will fetch all the required distfiles for rebuilding out
174 This option is an alias for
177 Force a rebuild of all dependent packages.
178 This option is for use in conjunction with the
180 option to force a rebuild of all the dependencies of a package to be
183 Add package subgraph groupings.
184 This places all packages with a common prefix (e.g.,
188 in a subgraph with a line around it so you can visually associate
191 Specify the impact you want to allow when rebuilding packages.
192 The impact of a given package being rebuilt is a number that reflects
193 the longest path from the
195 of the installed packages (those packages upon which most other
196 packages depend) to the
198 of the installed packages (those packages upon which no other packages
200 A package that needs to be rebuilt but has nothing above it in the
201 tree requiring rebuilding and nothing below it has an impact of 0.
202 Values of 10 or more for
204 will probably eliminate nothing from the rebuild list.
207 can also be the name of a package to be avoided when constructing the
208 list of things to be rebuilt.
210 The base location or url from which to install binary packages.
211 This defaults to the value of PKG_PATH, or to PACKAGES with
213 added to the end, or to the value determined for pkgsrcdir (see the
219 Limit the graph to those packages that are out of date
220 or ultimately depend on some package that is.
225 this limits the list to
227 packages that are out of date or stale.
231 information to the labels on the nodes.
232 This is the path to the package under the local pkgsrc tree.
234 Sets the name or path of the proper
238 commands generated by the
243 Some systems may have more than one
245 command or the correct choice might not be named
247 The default value for this is taken from the MAKE environment
248 variable, if it is set, or is simply
255 for each listed package.
256 One interesting target to specify is
258 since that will yield a script that will pass its own command
259 line arguments to make for processing.
263 as out of date so that you can see the impact of deleting dependent
264 packages and rebuilding everything.
265 This option can be used as a quick alternative to using the output
269 for graph coloring information.
273 number to each node's label.
274 The number indicates only the place of the node in the hierarchy, such
275 that each node has a number greater than that of anything which
276 depends on it, and with the
279 .It Fl P Ar pkgsrcdir
280 The root of the pkgsrc source tree.
281 This defaults to the value of the
283 environment variable, if it is set, or to
286 Instead of the standard graph output, emits a series of
288 commands that will rebuild all the out of date packages by rebuilding
289 all the deleted leaf packages.
290 Packages that are out of date should be deleted first (see the
293 This option is an alias for
297 option for a description of what value is used for
300 Reverses the order in which the packages are listed.
302 Selects a subgraph of the installed package base around which to
304 By default, if a subgraph of
308 and those packages immediately above and below it in the graph will be
310 To select only those immediately below, prefix a
313 To select all packages below
318 To select packages above
325 To select all packages remotely connected to
330 Note: take care when using this option with generated lists or sh
332 Since the subgraph of packages selected by this option may not include
333 all stale or out of date packages involved in a proper package update
334 procedure, the lists may be incomplete and can cause problems.
336 Print a simple list of packages instead of
339 The default output set for this command is out of date packages from
340 the entire package set.
347 to select more or other package lists.
349 Changes the target of the
357 or some other target.
359 Generates a graph with only the out of date dependencies of
361 marked in red (ie, packages that are out of date but not dependencies
364 will not be considered out of date).
365 This will show the entire effect of deleting all related packages in
366 order to update the dependencies of the given package.
369 option is used, then all the dependencies of
371 will be marked as out of date and the effect on the installed package
372 base will be accordingly greater.
374 Adds the package version number to the node's label in the graph.
378 The default name for the
382 commands generated by the
388 Where to find registered packages instead of
391 Where the pkgsrc tree is located instead of
395 Two variables that can be used as a location for binary packages.
400 options for more details.
403 .Bd -literal -offset indent
404 $ pkgdepgraph | dotty -
407 To generate graph output for later use, and a postscript image of it:
408 .Bd -literal -offset indent
409 $ lintpkgsrc -i \*[Gt] pkgdepgraph.in
410 $ audit-packages \*[Gt]\*[Gt] pkgdepgraph.in
411 $ pkgdepgraph -lv pkgdepgraph.in \*[Gt] pkgdepgraph.dot
412 $ dot -Tps pkgdepgraph.dot \*[Gt] pkgdepgraph.ps
415 To generate a graph of just the out of date nodes as a gif:
416 .Bd -literal -offset indent
417 $ pkgdepgraph -L pkgdepgraph.in \*[Gt] out-of-date.dot
418 $ dot -Tgif out-of-date.dot \*[Gt] out-of-date.gif
421 To make a list of packages that need to be removed in order to bring
422 all packages up to date:
423 .Bd -literal -offset indent
424 $ pkgdepgraph -D pkgdepgraph.in \*[Gt] delete_order
425 $ pkgdepgraph -R pkgdepgraph.in \*[Gt] rebuild.sh
428 To rebuild everything that has no other rebuild requirements:
429 .Bd -literal -offset indent
430 $ pkgdepgraph -D pkgdepgraph.in -i0 \*[Gt] delete_order
431 $ pkgdepgraph -R pkgdepgraph.in -i0 \*[Gt] rebuild.sh
434 Or, to rebuild everything except those things that would require
436 .Bd -literal -offset indent
437 $ pkgdepgraph -D pkgdepgraph.in -iperl \*[Gt] delete_order
438 $ pkgdepgraph -R pkgdepgraph.in -iperl \*[Gt] rebuild.sh
441 To subsequently delete all out of date and stale packages:
442 .Bd -literal -offset indent
443 $ pkg_delete `cat delete_order`
447 You may also find it useful to
449 all the required distfiles for the rebuild as below, so that you can
450 do all the rebuilding while off-line:
451 .Bd -literal -offset indent
452 $ pkgdepgraph -F pkgdepgraph.in \*[Gt] fetch.sh
456 Running the rebuild script will probably take a while, but if you
457 need to stop it or it stops by itself for any reason, you can rerun
458 the script, and it will pick up where it left off.
459 If there are certain packages that you want installed before others
460 are reinstalled, feel free to reorder the lines in the script.
464 wherever you like when the rebuild script is not running, or even
465 update your tree in between runs of the script, though in the latter
466 case, it would be prudent to resume the script in the following manner
467 so that any packages that are newly out of date are removed and
469 .Bd -literal -offset indent
470 $ pkgdepgraph -D pkgdepgraph.in \*[Gt] delete_order
471 $ pkgdepgraph -R pkgdepgraph.in \*[Gt]\*[Gt] rebuild.sh
472 $ pkg_delete `cat delete_order`
476 It is important to note that if you have specifically installed a
477 particular package that is a dependency, and another package (or other
478 packages) exist that can satisfy the same dependency, you should
479 probably pre-install that particular package.
480 There is no guarantee that the typical processing order will install
483 A similar task is to update all the out of date dependencies of an
484 package, rebuild the package, and any others that might share the same
486 .Bd -literal -offset indent
487 $ pkgdepgraph -U mozilla -D pkgdepgraph.in \*[Gt] delete_order
488 $ pkgdepgraph -U mozilla -R pkgdepgraph.in \*[Gt] rebuild.sh
489 $ pkg_delete `cat delete_order`
493 Or perhaps to rebuild a specific package and all packages which depend
495 .Bd -literal -offset indent
496 $ pkgdepgraph -O glib -D \*[Gt] delete_order
497 $ pkgdepgraph -O glib -R \*[Gt] rebuild.sh
498 $ pkg_delete `cat delete_order`
502 Finally, to see the current state of the installed packages after some
503 packages have been deleted, and some (but perhaps not all) have been
505 .Bd -literal -offset indent
506 $ pkgdepgraph out-of-date.dot | dot -Tps \*[Gt] current.ps
513 .An Andrew Brown Aq atatat@netbsd.org
518 but I believe the balance of code layout and comments is actually
519 reasonable, despite what you may think of perl.
525 output, and the generic
532 options) do not deal very well with packages that have moved within
534 Feeding the output of
539 can offset this (it contains the current paths to all packages under
541 but sometimes is necessary that you edit the generated scripts by hand