1.\"	$OpenBSD: pkg_info.1,v 1.65 2022/05/29 12:46:28 schwarze Exp $
2.\"
3.\" Documentation and design originally from FreeBSD. All the code has
4.\" been rewritten since. We keep the documentation's notice:
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.Dd $Mdocdate: May 29 2022 $
19.Dt PKG_INFO 1
20.Os
21.Sh NAME
22.Nm pkg_info
23.Nd display information on software packages
24.Sh SYNOPSIS
25.Nm pkg_info
26.Bk -words
27.Op Fl AaCcdfIKLMmPqRSstUvz
28.Op Fl D Ar name Ns Op = Ns Ar value
29.Op Fl E Ar filename
30.Op Fl e Ar pkg-name
31.Op Fl l Ar str
32.Op Fl Q Ar substring
33.Op Fl r Ar pkgspec
34.Op Ar pkg-name ...
35.Ek
36.Sh DESCRIPTION
37The
38.Nm
39command is used to dump out information for packages, as created by
40.Xr pkg_create 1 ,
41which may be still
42packed up or already installed on the system with the
43.Xr pkg_add 1
44command.
45.Pp
46The
47.Ar pkg-name
48may be the name of an installed package, the pathname to a package
49distribution file, or a URL to a package available through FTP, HTTP, HTTPS,
50or SCP.
51.Nm
52will try to complete
53.Ar pkg-name
54with a version number while looking through installed packages.
55If no
56.Ar pkg-name
57is specified,
58.Nm
59shows the names and one-line comments for all installed packages
60except internal packages.
61.Pp
62When browsing through uninstalled packages, running
63.Ic pkg_info -I *.tgz
64will report a summary line for each package, so that it is possible to
65run
66.Ic pkg_info pkgname.tgz
67to obtain a longer package description, and
68.Ic pkg_add -n pkgname.tgz
69to check that the installation would proceed cleanly, including dependencies.
70.Pp
71The following command-line options are supported:
72.Bl -tag -width indent
73.It Fl A
74Show the names and one-line comments for all installed packages,
75including internal packages.
76This option cannot be combined with
77.Ar pkg-name
78arguments.
79.It Fl a
80Show the names and one-line comments for all installed packages
81except internal packages.
82This option cannot be combined with
83.Ar pkg-name
84arguments.
85It is the default when neither options nor arguments are given.
86.It Fl C
87Show certificate information for signed packages.
88.It Fl c
89Show the one-line comment field for each package.
90.It Fl D Ar name Ns Op = Ns Ar value
91Enforce extra options as given by
92.Ar name ,
93similarly to
94.Xr pkg_add 1 .
95.Pp
96.Bl -tag -width "updatedependsXX" -compact
97.It Cm SIGNER
98List of trusted signers, separated by commas.
99Corresponds to list of public keys under
100.Pa /etc/signify
101we want to trust.
102Defaults to any key matching
103.Sq *pkg
104for packages, and any key matching
105.Sq *fw
106for firmware.
107.It Cm snap
108Force
109.Sq %c
110and
111.Sq %m
112to expand to
113.Sq snapshots ,
114even on a release kernel.
115.It Cm unsigned
116Allow opening unsigned packages without warnings/errors
117(necessary for
118.Xr ports 7 ,
119automatically set by the build infrastructure).
120.El
121.It Fl d
122Show the long-description field for each package.
123.It Fl E Ar filename
124Look for the package(s) that contains the given
125.Ar filename .
126As a faster alternative, note that there is a package, pkglocatedb, that
127contains a
128.Xr locate 1
129database of every file in every package.
130.It Fl e Ar pkg-name
131This option
132allows you to test for the presence of another (perhaps
133prerequisite) package from a script.
134If the package identified by
135.Ar pkg-name
136is currently installed, return 0, otherwise return 1.
137In addition, the names of any package(s) found installed are printed to
138stdout unless turned off using the
139.Fl q
140option.
141.Pp
142The given
143.Ar pkg-name
144is actually a package specification, as described in
145.Xr packages-specs 7 .
146For example,
147.Ic pkg_info -e 'name->=1.3'
148will match versions 1.3 and later of the
149.Pa name
150package.
151.It Fl e Ar pkgpath
152Another variant of this option that uses a pkgpath instead.
153A pkgpath is a location within the ports tree, as described
154in
155.Xr pkgpath 7 .
156For example,
157.Ic pkg_info -e x11/kde/base3
158will match any package that was compiled according to
159.Pa ${PORTSDIR}/x11/kde/base3 .
160.It Fl f
161Show the packing-list instructions for each package.
162See
163.Xr pkg_create 1
164and
165.Xr package 5
166for the various annotations.
167.It Fl I
168Show the name and one-line comment
169.Pq Dq index entry
170for each package.
171This is done by default if neither options nor arguments are given.
172.It Fl K
173Prefix file names with category keyword (e.g., @file, @lib).
174Always used together with
175.Fl L .
176.It Fl L
177Show the files within each package.
178This is different from just
179viewing the packing-list, since full pathnames for everything
180are generated.
181.It Fl l Ar str
182Prefix each information category header (see
183.Fl q )
184shown with
185.Ar str .
186This is primarily of use to front-end programs that want to request a
187lot of different information fields at once for a package, but don't
188necessarily want the output intermingled in such a way that they can't
189organize it.
190This lets you add a special token to the start of each field.
191.It Fl M
192Show the install-message file (if any) for each package.
193.It Fl m
194Show the names and one-line comments for all packages tagged as manually
195installed, omitting those automatically installed as dependencies.
196This option cannot be combined with
197.Ar pkg-name
198arguments.
199.It Fl P
200Show the
201.Xr pkgpath 7
202for each package.
203You can easily build a subdirlist with this.
204.It Fl Q Ar substring
205Show the names of all packages in the first repository
206of the package search path containing the
207.Ar substring
208in the stems of their package names.
209A stem is a package name with all version and flavor suffixes removed; see
210.Xr pkg_add 1
211for more details on stems.
212If
213.Fl a
214is also specified, show the names of all matching packages
215in all repositories instead.
216.It Fl q
217Be
218.Dq quiet
219in emitting report headers and such, just dump the
220raw info (basically, assume a non-human reading).
221.It Fl R
222Show which packages require a given package.
223.It Fl r Ar pkgspec
224Check a list for a given
225.Ar pkgspec .
226The following arguments are names of packages to verify.
227Exit status will be augmented by 2 if none of the packages do match.
228.It Fl S
229Show the update signature for each package.
230The
231.Sq update signature
232is a unique tag showing the package name, a global version number,
233and the version number
234of every run time dependency and shared library used to build this package.
235.It Fl s
236Show an estimate of the total size of each package.
237.It Fl t
238Show the names and one-line comments for packages
239which are not required by any other packages.
240This option cannot be combined with
241.Ar pkg-name
242arguments.
243.It Fl U
244Show the deinstall-message file (if any) for each package.
245.It Fl v
246Turn on verbose output.
247.It Fl z
248Fuzzy listing option, often used together with
249.Fl m .
250Only shows stems, flavors and branches information.
251To be reused with
252.Xr pkg_add 1
253.Fl l
254to recreate a package installation with different versions and no ambiguity.
255Note that this intentionally does not include firmware, as they are not
256handled by
257.Xr pkg_add 1 .
258.El
259.Sh ENVIRONMENT
260.Bl -tag -width PKG_TMPDIR
261.It Ev PKG_DBDIR
262The standard package database directory,
263.Pa /var/db/pkg ,
264can be overridden by specifying an alternative directory in the
265.Ev PKG_DBDIR
266environment variable.
267.It Ev PKG_PATH
268This can be used to specify a colon-separated list of paths to search for
269package files.
270The current directory is always searched first, even if
271.Ev PKG_PATH
272is set.
273If
274.Ev PKG_PATH
275is used, the suffix
276.Dq .tgz
277is automatically appended to the
278.Ar pkg-name ,
279whereas searching in the current directory uses
280.Ar pkg-name
281literally.
282Each entry consists of a directory name.
283URL schemes such as FTP, HTTP, HTTPS, or SCP are also appropriate.
284The current directory may be indicated
285implicitly by an empty directory name, or explicitly by a single
286period
287.Pq Ql \&./ .
288Special sequences
289.Sq %a ,
290.Sq %c ,
291.Sq %m ,
292.Sq %v
293will be expanded.
294.It Ev PKG_TMPDIR
295Temporary area where package information files will be extracted, instead of
296.Pa /tmp .
297.It Ev TRUSTED_PKG_PATH
298Same semantics as
299.Ev PKG_PATH ,
300but it is searched before
301.Ev PKG_PATH
302and waives any kind of signature checking.
303.El
304.Sh FILES
305.Bl -tag -width /var/db/pkg/
306.It Pa /usr/local/share/doc/pkg-readmes/
307.Ox Ns -specific
308information about individual packages
309.It Pa /var/db/pkg/
310database of installed
311.Xr packages 7
312.El
313.Sh TECHNICAL DETAILS
314Package info is either extracted from package files named on the
315command line, or from already installed package information
316in
317.Pa /var/db/pkg/<pkg-name> .
318.Sh SEE ALSO
319.Xr pkg_add 1 ,
320.Xr pkg_create 1 ,
321.Xr pkg_delete 1 ,
322.Xr bsd.port.mk 5 ,
323.Xr package 5 ,
324.Xr packages-specs 7 ,
325.Xr pkgpath 7
326.Sh AUTHORS
327.Bl -tag -width indent -compact
328.It An Jordan Hubbard
329initial design
330.It An Marc Espie
331complete rewrite
332.El
333