1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
.\" $NetBSD: pkgdepgraph.1,v 1.3 2002/12/26 11:12:59 wiz Exp $
.\"
.\" Copyright (c) 2002 by Andrew Brown <atatat@netbsd.org>
.\" Absolutely no warranty.
.\"
.Dd November 6, 2002
.Dt PKGDEPGRAPH 1
.Sh NAME
.Nm pkgdepgraph
.Nd visual representation of installed packages
.Sh SYNOPSIS
.Nm
.Op Fl d Ar pkg_dbdir
.Op Fl cglov
.Op Pa data ...
.Sh DESCRIPTION
.Nm
emits a
.Pa dot
language description of the locally installed packages, with the
inter-dependencies reduced to a minimal set of edges.
It scans each directory under the package database directory for files
named
.Pa +BUILD_INFO
and
.Pa +REQUIRED_BY
in order to gather its data.
.Pp
.Nm
will also read any files passed to it as arguments (or stdin if it
is not connected to a tty), in search of output that resembles that
of either
.Xr lintpkgsrc 1 ,
.Xr audit-packages 1 ,
or the output from a previous incantation of this program.
.Pp
In the latter case,
.Nm
will recolor the graph passed as input based, as usual, on information
about currently installed pkgs.
Packages that are in the input graph, but not currently installed,
will be colored black, those that are installed will be colored green,
and those that remain out of date for some reason will remain red.
.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl c
Use colors.
The graph defaults to black, but if this option is used and the output
from
.Xr lintpkgsrc 1
or
.Pa audit-packages
is given, then nodes (and edges leading from them) will be colored in
the following manner:
.Bl -tag -width purple
.It green
The package is completely up to date.
.It orange
The package is up to date, but some of its dependencies require updating.
.It red
The package is out of date or has had a security advisory issued
against it, and should be replaced.
.It purple
The package was not found in the local pkgsrc tree.
.It blue
The package depends on something not found in the local pkgsrc tree.
.It black
The package has been removed and not yet replaced, or the graph is
uncolored.
The difference between an uncolored graph and a graph that has been
recolored almost entirely black as a result of removing all the
packages can be visually detected by the presence of the
.Nm
package.
.El
.It Fl d Ar pkg_dbdir
The location of the package database files.
This defaults to the value of the
.Pa PKG_DBDIR
environment variable, if it is set, or to
.Pa @PKG_DBDIR@ .
.It Fl g
Add package subgraph groupings.
This places all packages with a common prefix (e.g.,
.Dq p5
or
.Dq gimp )
in a subgraph with a line around it so you can visually associate
packages.
.It Fl l
Adds package
.Dq location
information to the labels on the nodes.
This is the path to the package under the local pkgsrc tree.
.It Fl o
Adds a package
.Dq order
number to each node's label.
The number indicates only the place of the node in the hierarchy, such
that each node has a number greater than that of anything which
depends on it, and with the
.Dq leaf
nodes numbered one.
.It Fl v
Adds the package version number to the node's label in the graph.
.El
.Sh ENVIRONMENT
.Ss PKG_DBDIR
Where to find registered packages instead of
.Pa @PKG_DBDIR@ .
.Sh EXAMPLES
The default output:
.Bd -literal -offset indent
$ pkgdepgraph | dotty -
.Ed
.Pp
To generate colored graph output for later use, and a postscript image
of it:
.Bd -literal -offset indent
$ lintpkgsrc -i \*[Gt] pkgdepgraph.in
$ audit-packages \*[Gt]\*[Gt] pkgdepgraph.in
$ pkgdepgraph -clv pkgdepgraph.in \*[Gt] pkgdepgraph.dot
$ dot -Tps pkgdepgraph.dot \*[Gt] pkgdepgraph.ps
.Ed
.Pp
To subsequently generate a graph of just the out-of-date nodes as a
gif:
.Bd -literal -offset indent
$ grep -v green pkgdepgraph.dot | \\
sed 's/"packages"/"out of date packages"/' \*[Gt] out-of-date.dot
$ dot -Tgif out-of-date.dot \*[Gt] out-of-date.gif
.Ed
.Pp
To make a list of packages that need to be removed in order to bring
all packages up to date:
.Bd -literal -offset indent
$ grep label out-of-date.dot | \\
sort -t\\# +1n | \\
sed 's/\\(.\\)".*/\\1/;s/"//' \*[Gt] delete_order
$ grep LEAF out-of-date.dot | \\
sort -t\\# +1nr | \\
sed 's/.*label="//;s/\\\\.*//' \*[Gt] rebuild_order
.Ed
.Pp
To see the current state of the installed packages after some packages
have been deleted, and some (but perhaps not all) have been
reinstalled:
.Bd -literal -offset indent
$ pkgdepgraph out-of-date.dot | dot -Tps \*[Gt] current.ps
.Ed
.Sh SEE ALSO
.Xr dot 1 ,
.Xr dotty 1 ,
.Xr lintpkgsrc 1
.Sh AUTHORS
.An Andrew Brown Aq atatat@netbsd.org
.Sh BUGS
.Nm
was written in
.Xr perl 1 ,
but I believe the balance of code layout and comments is actually
reasonable, despite what you may think of perl.
|