/
pkg-query.8
297 lines (297 loc) · 7 KB
/
pkg-query.8
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
.\"
.\" FreeBSD pkg - a next generation package for the installation and maintenance
.\" of non-core utilities.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\"
.\" @(#)pkg.8
.\" $FreeBSD$
.\"
.Dd May 18, 2013
.Dt PKG-QUERY 8
.Os
.Sh NAME
.Nm "pkg query"
.Nd query information for installed packages
.Sh SYNOPSIS
.Nm
.Ao query-format Ac Ao pkg-name Ac
.Nm
.Op Fl a
.Ao query-format Ac
.Nm
.Fl F Ao pkg-name Ac Ao query-format Ac
.Nm
.Fl e Ao evaluation-condition Ac Ao query-format Ac
.Nm
.Op Fl gxX
.Ao query-format Ac Ao pattern Ac Ao ... Ac
.Sh DESCRIPTION
.Nm
is used for displaying information about packages.
.Sh OPTIONS
The following options are supported by
.Nm :
.Bl -tag -width F1
.It Fl a
Match all packages from the database
.It Fl e
Match packages using the given
.Ar evaluation-condition.
See EVALUATION FORMAT for details.
.It Fl F Ar pkg-name
Display information only for the package file
.Ar pkg-name
.It Fl g
Treat
.Ao pattern Ac
as a glob pattern.
.It Fl x
Treat
.Ao pattern Ac
as a regular expression.
.It Fl X
Treat
.Ao pattern Ac
as an extended regular expression.
.El
.Sh QUERY FORMAT
There are two type of keyword for the query format: the multiline and the normal
one. Only one type of multiline pattern is accepted for a given query.
.Ss Normal patterns:
.Bl -tag -width F1
.It Cm \&%n
Name of the matched package
.It Cm \&%v
Version of the matched package
.It Cm \&%o
Origin of the matched package
.It Cm \&%p
Prefix of the matched package
.It Cm \&%m
Maintainer of the matched package
.It Cm \&%c
Comment of the matched package
.It Cm \&%e
Description of the matched package
.It Cm \&%i
Additional information about the package
.It Cm \&%w
Home page of the matched package
.It Cm \&%l
license logic of the matched package - nothing for single, & for AND, and | for OR
.It Cm \&%s Ns Op bh
The flat size of the matched package, where
.Cm b
is in bytes, and
.Cm h
is in human readable format.
.It Cm \&%a
Returns 1 if the matched package is an orphan package and can be pkg-autoremove(1)'d, 0 otherwise
.It Cm \&%M
message contain in the matched package
.It Cm \&%t
Timestamp that the package was installed
.It Cm \&%? Ns Op drCFODLUGB
Returns 0 if the list is empty and 1 if the list has information to display
.Bl -tag -width indent
.It Cm d
for dependencies
.It Cm r
for reverse dependencies
.It Cm C
for categories
.It Cm F
for files
.It Cm O
for options
.It Cm D
for directories
.It Cm L
for licenses
.It Cm U
for users
.It Cm G
for groups
.It Cm B
for shared libraries
.El
.El
.Ss Multiline patterns:
.Bl -tag -width F1
.It Cm \&%d Ns Op nov
Expands to the list of dependencies for the matched package, where
.Cm n
stands for the package name,
.Cm o
for the package origin, and
.Cm v
for the package version.
.It Cm \&%r Ns Op nov
Expands to the list of reverse dependencies for the matched package, where
.Cm n
stands for the package name,
.Cm o
for the package origin, and
.Cm v
for the package version.
.It Cm \&%C
Expands to the list of categories the matched package belongs to.
.It Cm \&%F Ns Op ps
Expands to the list of files of the matched package, where
.Cm p
stands for path, and
.Cm s
for sum.
.It Cm \&%D
Expands to the list of directories of the matched package.
.It Cm \&%O Ns Op kv
Expands to the list of options of the matched package, where
.Cm k
stands for option key, and
.Cm v
for option value.
.It Cm \&%L
Expands to the list of license(s) for the matched package.
.It Cm \&%U
Expands to the list of users needed by the matched package.
.It Cm \&%G
Expands to the list of groups needed by the matched package.
.It Cm \&%B
Expands to the list of shared libraries used by programs from the matched package.
.El
.Sh EVALUATION FORMAT
Packages can be selected by using expressions comparing
.Ar Variables
(see below) to string or integer values. The mode of comparison is specified
by the
.Ar Operator
(also listed below).
Expressions can be combined using && (for and) and || (for or).
Parentheses can be used for grouping in the usual manner.
.Pp
String values are either any text not containing whitespace (possibly
followed by but not including whitespace) or any text enclosed in single or
double quotes.
.Ss Variables
.Bl -tag -width F1
.It Cm \&%n
Name of the package (type string)
.It Cm \&%o
Origin of the package (type string)
.It Cm \&%p
Prefix of the package (type string)
.It Cm \&%m
Maintainer of the package (type string)
.It Cm \&%c
Comment of the package (type string)
.It Cm \&%e
Description of the package (type string)
.It Cm \&%w
WWW address of the package (type string)
.It Cm \&%s
Flatsize of the package (type integer)
.It Cm \&%a
Automatic status of the package (type integer)
.It Cm \&%M
Message of the package (type string)
.It Cm \&%t
Timestamp that the package was installed (type integer)
.It Cm \&%i
Additionnal information about the package (type string)
.It Cm \&%# Ns Op drCFODLUGB
Number of elements in the list of information (type integer).
See
.Cm %?
above for what information is used.
.El
.Ss Operators
.Bl -tag -width F1
.It Cm ~
String glob pattern matching
.It Cm > Ns Op =
Integer comparison
.It Cm < Ns Op =
Integer comparison
.It Cm = Ns Op =
Integer or string equality comparison
.It Cm !=
Integer or string inequality comparison
.El
.Sh ENVIRONMENT
The following environment variables affect the execution of
.Nm .
See
.Xr pkg.conf 5
for further description.
.Bl -tag -width ".Ev NO_DESCRIPTIONS"
.It Ev PKG_DBDIR
.El
.Sh EXIT STATUS
.Nm
exits 0 on success, and >0 if an error occurs.
.Sh FILES
See
.Xr pkg.conf 5 .
.Sh EXAMPLES
List all installed packages by name-version:
.Dl $ pkg query %n-%v
.Pp
List all dependencies for a package by origin:
.Dl $ pkg query %do subversion
.Pp
List all dependencies by package name-version:
.Dl $ pkg query %dn-%dv subversion
.Pp
List all reverse dependencies for a package:
.Dl $ pkg query %ro perl
.Pp
List all files and their known checksums for a package:
.Dl $ pkg query '%Fp %Fs' perl
.Pp
List all files for all packages:
.Dl $ pkg query '%o: %F'
.Pp
List all packages with no reverse dependencies:
.Dl $ pkg query -e '%#r = 0' %o
.Pp
List non-automatic packages:
.Dl $ pkg query -e '%a = 0' %o
.Pp
List automatic packages:
.Dl $ pkg query -e '%a = 1' %o
.Sh SEE ALSO
.Xr pkg.conf 5 ,
.Xr pkg 8 ,
.Xr pkg-add 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-create 8 ,
.Xr pkg-delete 8 ,
.Xr pkg-fetch 8 ,
.Xr pkg-info 8 ,
.Xr pkg-install 8 ,
.Xr pkg-register 8 ,
.Xr pkg-repo 8 ,
.Xr pkg-rquery 8 ,
.Xr pkg-search 8 ,
.Xr pkg-set 8 ,
.Xr pkg-shell 8 ,
.Xr pkg-shlib 8 ,
.Xr pkg-stats 8 ,
.Xr pkg-update 8 ,
.Xr pkg-updating 8 ,
.Xr pkg-upgrade 8 ,
.Xr pkg-version 8 ,
.Xr pkg-which 8