1.\" $NetBSD: pkg_info.1,v 1.2 2015/04/28 09:48:30 prlw1 Exp $
2.\"
3.\" FreeBSD install - a package for the installation and maintenance
4.\" of non-core utilities.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" Jordan K. Hubbard
16.\"
17.\"
18.\"     @(#)pkg_info.1
19.\"
20.Dd December 14, 2012
21.Dt PKG_INFO 1
22.Os
23.Sh NAME
24.Nm pkg_info
25.Nd a utility for displaying information on software packages
26.Sh SYNOPSIS
27.Nm
28.Op Fl BbcDdFfhIikLmNnpqRrSsVvX
29.Op Fl E Ar pkg-name
30.Op Fl e Ar pkg-name
31.Op Fl K Ar pkg_dbdir
32.Op Fl l Ar prefix
33.Ar pkg-name ...
34.Nm
35.Op Fl a | Fl u
36.Op flags
37.Nm
38.Op Fl Q Ar variable
39.Ar pkg-name ...
40.Sh DESCRIPTION
41The
42.Nm
43command is used to dump out information for packages, which may be either
44packed up in files or already installed on the system with the
45.Xr pkg_create 1
46command.
47.Pp
48The
49.Ar pkg-name
50may be the name of an installed package (with or without version), a
51pattern matching several installed packages (see the
52.Sx PACKAGE WILDCARDS
53section for a description of possible patterns),
54the pathname to a
55binary package, a filename belonging to an installed
56package (with
57.Fl F ) ,
58or a URL to an FTP-available package.
59.Pp
60The following command line options are available:
61.Bl -tag -width indent
62.It Fl a
63Show information for all currently installed packages.
64See also
65.Fl u .
66When neither
67.Fl a
68nor
69.Fl u
70is given, the former is assumed.
71.It Fl B
72Show some of the important definitions used when building
73the binary package (the
74.Dq Build information )
75for each package.
76Additionally, any installation information variables
77(lowercase) can be queried, too.
78In particular,
79.Ar automatic
80tells if a package was installed automatically
81as a dependency of another package.
82.It Fl b
83Show the
84.Nx
85RCS Id strings from the files used in the construction
86of the binary package (the
87.Dq Build version )
88for each package.
89These files are the package Makefile, any patch files, any checksum
90files, and the packing list file.
91.It Fl c
92Show the one-line comment field for each package.
93.It Fl D
94Show the install-message file (if any) for each package.
95.It Fl d
96Show the long-description field for each package.
97.It Fl E Ar pkg-name
98This option
99allows you to test for the existence of a given package.
100If a package identified by
101.Ar pkg-name
102is currently installed, return code is 0, otherwise 1.
103The name of the best matching package found installed is printed to
104stdout unless turned off using the
105.Fl q
106option.
107.Ar pkg-name
108can contain wildcards (see the
109.Sx PACKAGE WILDCARDS
110section below).
111.It Fl e Ar pkg-name
112This option
113allows you to test for the existence of a given package.
114If a package identified by
115.Ar pkg-name
116is currently installed, return code is 0, otherwise 1.
117The names of any package(s) found installed are printed to
118stdout unless turned off using the
119.Fl q
120option.
121.Ar pkg-name
122can contain wildcards (see the
123.Sx PACKAGE WILDCARDS
124section below).
125.It Fl F
126Interpret any
127.Ar pkg-name
128given as filename, and query information on the package that
129file belongs to.
130This can be used to query information on a per-file basis.
131See the
132.Sx TECHNICAL DETAILS
133section below for more information.
134.It Fl f
135Show the packing list instructions for each package.
136.It Fl h
137Print usage message and exit.
138.It Fl I
139Show the index entry for each package.
140This option is assumed when no arguments or relevant flags are specified.
141.It Fl i
142Show the install script (if any) for each package.
143.It Fl K Ar pkg_dbdir
144Override the value of the
145.Dv PKG_DBDIR
146configuration option with the value
147.Ar pkg_dbdir .
148.It Fl k
149Show the de-install script (if any) for each package.
150.It Fl L
151Show the files within each package.
152This is different from just viewing the packing list, since full pathnames
153for everything are generated.
154Files that were created dynamically during installation of the package
155are not listed.
156.It Fl l Ar prefix
157Prefix each information category header (see
158.Fl q )
159shown with
160.Ar prefix .
161This is primarily of use to front-end programs that want to request a
162lot of different information fields at once for a package, but don't
163necessary want the output intermingled in such a way that they can't
164organize it.
165This lets you add a special token to the start of each field.
166.It Fl m
167Show the mtree file (if any) for each package.
168.It Fl N
169Show which packages each package was built with (exact dependencies), if any.
170.It Fl n
171Show which packages each package needs (depends upon), if any.
172.It Fl p
173Show the installation prefix for each package.
174.It Fl Q Ar variable
175Show the definition of
176.Ar variable
177from the build information for each package.
178An empty string is returned if no such variable definition is found for
179the package(s).
180.It Fl q
181Be
182.Dq quiet
183in emitting report headers and such, just dump the
184raw info (basically, assume a non-human reading).
185.It Fl R
186For each package, show the packages that require it.
187.It Fl r
188For each package, show the packages that require it.
189Continue recursively to show all dependents.
190.It Fl S
191Show the size of this package and all the packages it requires,
192in bytes.
193.It Fl s
194Show the size of this package in bytes.
195The size is calculated by adding up the size of each file of the package.
196.It Fl u
197Show information for all user-installed packages:
198automatically installed packages (as dependencies
199of other packages) are not displayed.
200See also
201.Fl a .
202.It Fl V
203Print version number and exit.
204.It Fl v
205Turn on verbose output.
206.It Fl X
207Print summary information for each package.
208The summary format is
209described in
210.Xr pkg_summary 5 .
211Its primary use is to contain all information about the contents of a
212(remote) binary package repository needed by package managing software.
213.El
214.Sh TECHNICAL DETAILS
215Package info is either extracted from package files named on the
216command line, or from already installed package information
217in
218.Pa \*[Lt]PKG_DBDIR\*[Gt]/\*[Lt]pkg-name\*[Gt] .
219.Pp
220When the
221.Fl F
222option is used,
223a filename can be given instead of a package name to query
224information on the (installed) package that file belongs to.
225The filename is resolved to a package name using the package database.
226The filename must be absolute, as in the output of
227.Dl pkg_info -aF .
228For example,
229.Dl pkg_info -eF /path/to/file
230can be used to display the package the given file belongs to, and
231.Dl pkg_info -LF /path/to/file
232can be used to display all files belonging to the package the given
233file belongs to.
234.Sh PACKAGE WILDCARDS
235In the places where a package name/version is expected, e.g., for the
236.Fl e
237option, several forms can be used.
238Either use a package name with or without version, or specify a
239package wildcard that gets matched against all installed packages.
240.Pp
241Package wildcards use
242.Xr fnmatch 3 .
243In addition,
244.Xr csh 1
245style {,} alternates have been implemented.
246Package version numbers can also be matched in a relational manner
247using the
248.Dq \*[Ge] ,
249.Dq \*[Le] ,
250.Dq \*[Gt] ,
251and
252.Dq \*[Lt]
253operators.
254For example,
255.Dl pkg_info -e 'name\*[Ge]1.3'
256will match versions 1.3 and later of the
257.Dq name
258package.
259(Make sure to use shell quoting.)
260Additionally, ranges can be defined, by giving both a lower bound
261.Po with
262.Dq \*[Gt]
263or
264.Dq \*[Ge]
265.Pc
266as well as an upper bound
267.Po with
268.Dq \*[Lt]
269or
270. Dq \*[Le]
271.Pc .
272The lower bound has to come first.
273For example,
274.Dl pkg_info -e 'name\*[Ge]1.3\*[Lt]2.0'
275will match versions 1.3 (inclusive) to 2.0 (exclusive) of package
276.Dq name .
277.Pp
278The collating sequence of the various package version numbers is
279unusual, but strives to be consistent.
280The magic string
281.Dq alpha
282equates to
283.Dq alpha version ,
284and sorts before a beta version.
285The magic string
286.Dq beta
287equates to
288.Dq beta version ,
289and sorts before a release candidate.
290The magic string
291.Dq rc
292equates to
293.Dq release candidate ,
294and sorts before a release.
295The magic string
296.Dq pre ,
297short for
298.Dq pre-release ,
299is a synonym for
300.Dq rc .
301For example,
302.Dq name-1.3alpha2
303will sort before
304.Dq name-1.3beta1 ,
305and they both sort before
306.Dq name-1.3rc1 .
307Similarly,
308.Dq name-1.3rc3
309will sort before
310.Dq name-1.3 ,
311and after
312.Dq name-1.2.9 .
313The magic string
314.Dq pl
315equates to
316.Dq patch level ,
317and has the same value as a dot
318.Pq Sq \&.
319in the dewey-decimal ordering schemes,
320as does the underscore
321.Pq Sq _ .
322Additionally, alphabetic characters sort in the same place as
323their numeric counterparts, so that
324.Dq name-1.2e
325has the same sorting value as
326.Dq name-1.2.5 .
327.Sh ENVIRONMENT
328See
329.Xr pkg_install.conf 5
330for options, that can also be specified using the environment.
331.Sh SEE ALSO
332.Xr pkg_add 1 ,
333.Xr pkg_admin 1 ,
334.Xr pkg_create 1 ,
335.Xr pkg_delete 1 ,
336.Xr pkg_install.conf 5
337.Xr pkgsrc 7
338.Sh AUTHORS
339.Bl -tag -width indent -compact
340.It "Jordan Hubbard"
341most of the work
342.It "John Kohl"
343refined it for
344.Nx
345.It "Hubert Feyrer"
346.Nx
347wildcard dependency processing, pkgdb, depends displaying,
348pkg size display, and more.
349.El
350