You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

395 lines
9.1 KiB

  1. .\"
  2. .\" FreeBSD pkg - a next generation package for the installation and maintenance
  3. .\" of non-core utilities.
  4. .\"
  5. .\" Redistribution and use in source and binary forms, with or without
  6. .\" modification, are permitted provided that the following conditions
  7. .\" are met:
  8. .\" 1. Redistributions of source code must retain the above copyright
  9. .\" notice, this list of conditions and the following disclaimer.
  10. .\" 2. Redistributions in binary form must reproduce the above copyright
  11. .\" notice, this list of conditions and the following disclaimer in the
  12. .\" documentation and/or other materials provided with the distribution.
  13. .\"
  14. .\"
  15. .\" @(#)pkg.8
  16. .\" $FreeBSD$
  17. .\"
  18. .Dd November 18, 2014
  19. .Dt PKG-QUERY 8
  20. .Os
  21. .Sh NAME
  22. .Nm "pkg query"
  23. .Nd query information for installed packages
  24. .Sh SYNOPSIS
  25. .Nm
  26. .Ao query-format Ac Ao pkg-name Ac
  27. .Pp
  28. .Nm
  29. .Op Fl a
  30. .Ao query-format Ac
  31. .Nm
  32. .Fl F Ao pkg-file Ac Ao query-format Ac
  33. .Nm
  34. .Fl e Ao evaluation-condition Ac Ao query-format Ac
  35. .Nm
  36. .Op Fl Cgix
  37. .Ao query-format Ac Ao pattern Ac Ao ... Ac
  38. .Pp
  39. .Nm
  40. .Op Cm --all
  41. .Ao query-format Ac
  42. .Nm
  43. .Cm --file Ao pkg-file Ac Ao query-format Ac
  44. .Nm
  45. .Cm --evaluate Ao evaluation-condition Ac Ao query-format Ac
  46. .Nm
  47. .Op Cm --{case-sensitive,glob,case-insensitive,regex}
  48. .Ao query-format Ac Ao pattern Ac Ao ... Ac
  49. .Sh DESCRIPTION
  50. .Nm
  51. is used for displaying information about packages.
  52. .Sh OPTIONS
  53. The following options are supported by
  54. .Nm :
  55. .Bl -tag -width evaluate
  56. .It Fl a , Cm --all
  57. Match all packages from the database
  58. .It Fl C , Cm --case-sensitive
  59. Make the standard or the regular expression
  60. .Fl ( x )
  61. matching against
  62. .Ar pkg-name
  63. case sensitive.
  64. .It Fl e , Cm --evaluate
  65. Match packages using the given
  66. .Ar evaluation-condition.
  67. See EVALUATION FORMAT for details.
  68. .It Fl F Ar pkg-file , Cm --file Ar pkg-file
  69. Display information only for the package file
  70. .Ar pkg-name
  71. .It Fl i , Cm --case-insensitive
  72. Make the standard or regular expression
  73. .Fl ( x )
  74. matching against
  75. .Ar pkg-name
  76. case insensitive.
  77. This is the default, unless modified by setting
  78. .Ev CASE_SENSITIVE_MATCH
  79. to true in
  80. .Pa pkg.conf .
  81. .It Fl g , Cm --glob
  82. Treat
  83. .Ao pattern Ac
  84. as a glob pattern.
  85. .It Fl x , Cm --regex
  86. Treat
  87. .Ao pattern Ac
  88. as a regular expression according to the "modern" or "extended" syntax
  89. of
  90. .Xr re_format 7 .
  91. .El
  92. .Sh QUERY FORMAT
  93. There are two types of keywords for the query format: the multiline and the normal
  94. one. Only one type of multiline pattern is accepted for a given query.
  95. .Ss Normal patterns:
  96. .Bl -tag -width F1
  97. .It Cm \&%n
  98. Name of the matched package
  99. .It Cm \&%v
  100. Version of the matched package
  101. .It Cm \&%o
  102. Origin of the matched package
  103. .It Cm \&%p
  104. Prefix of the matched package
  105. .It Cm \&%m
  106. Maintainer of the matched package
  107. .It Cm \&%c
  108. Comment of the matched package
  109. .It Cm \&%e
  110. Description of the matched package
  111. .It Cm \&%w
  112. Home page of the matched package
  113. .It Cm \&%l
  114. License logic of the matched package - nothing for single, & for AND, and | for OR
  115. .It Cm \&%s Ns Op bh
  116. The flat size of the matched package, where
  117. .Cm b
  118. is in bytes, and
  119. .Cm h
  120. is in human readable format.
  121. .It Cm \&%a
  122. Returns 1 if the matched package is an orphan package and can be pkg-autoremove(1)'d, 0 otherwise
  123. .It Cm \&%q
  124. Architecture of the matched package
  125. .It Cm \&%k
  126. Returns 1 if the matched package is locked against modification or deletion, 0 otherwise
  127. .It Cm \&%M
  128. message contained in the matched package
  129. .It Cm \&%t
  130. Timestamp that the package was installed
  131. .It Cm \&%R
  132. The name of the repository from which the package was installed if
  133. available, or
  134. .Dq unknown-repository
  135. otherwise.
  136. .It Cm \&%? Ns Op drCFODLUGBbA
  137. Returns 0 if the list is empty and 1 if the list has information to display
  138. .Bl -tag -width indent
  139. .It Cm d
  140. for dependencies
  141. .It Cm r
  142. for reverse dependencies
  143. .It Cm C
  144. for categories
  145. .It Cm F
  146. for files
  147. .It Cm O
  148. for options
  149. .It Cm D
  150. for directories
  151. .It Cm L
  152. for licenses
  153. .It Cm U
  154. for users
  155. .It Cm G
  156. for groups
  157. .It Cm B
  158. for required shared libraries
  159. .It Cm b
  160. for provided shared libraries
  161. .It Cm A
  162. for annotations
  163. .El
  164. .It Cm \&%# Ns Op drCFODLUGBbA
  165. Returns the number of elements in the list
  166. .Bl -tag -width indent
  167. .It Cm d
  168. for dependencies
  169. .It Cm r
  170. for reverse dependencies
  171. .It Cm C
  172. for categories
  173. .It Cm F
  174. for files
  175. .It Cm O
  176. for options
  177. .It Cm D
  178. for directories
  179. .It Cm L
  180. for licenses
  181. .It Cm U
  182. for users
  183. .It Cm G
  184. for groups
  185. .It Cm b
  186. for shared
  187. .It Cm B
  188. for required shared libraries
  189. .It Cm b
  190. for provided shared libraries
  191. .It Cm A
  192. for annotations
  193. .El
  194. .El
  195. .Ss Multiline patterns:
  196. .Bl -tag -width F1
  197. .It Cm \&%d Ns Op nov
  198. Expands to the list of dependencies for the matched package, where
  199. .Cm n
  200. stands for the package name,
  201. .Cm o
  202. for the package origin, and
  203. .Cm v
  204. for the package version.
  205. .It Cm \&%r Ns Op nov
  206. Expands to the list of reverse dependencies for the matched package, where
  207. .Cm n
  208. stands for the package name,
  209. .Cm o
  210. for the package origin, and
  211. .Cm v
  212. for the package version.
  213. .It Cm \&%C
  214. Expands to the list of categories the matched package belongs to.
  215. .It Cm \&%F Ns Op ps
  216. Expands to the list of files of the matched package, where
  217. .Cm p
  218. stands for path, and
  219. .Cm s
  220. for sum.
  221. .It Cm \&%D
  222. Expands to the list of directories of the matched package.
  223. .It Cm \&%O Ns Op kvdD
  224. Expands to the list of options of the matched package, where
  225. .Cm k
  226. stands for option key,
  227. .Cm v
  228. for option value,
  229. .Cm d
  230. for option default value and
  231. .Cm D
  232. for option description.
  233. Option default values and descriptions are optional metadata and may
  234. be blank for certain packages.
  235. .It Cm \&%L
  236. Expands to the list of license(s) for the matched package.
  237. .It Cm \&%U
  238. Expands to the list of users needed by the matched package.
  239. .It Cm \&%G
  240. Expands to the list of groups needed by the matched package.
  241. .It Cm \&%B
  242. Expands to the list of shared libraries used by programs from the matched package.
  243. .It Cm \&%b
  244. Expands to the list of shared libraries provided by the matched package.
  245. .It Cm \&%A Ns Op tv
  246. Expands to the list of annotations for the matched package,
  247. where
  248. .Cm t
  249. stands for the annotation tag, and
  250. .Cm v
  251. stands for the annotation value.
  252. .El
  253. .Sh EVALUATION FORMAT
  254. Packages can be selected by using expressions comparing
  255. .Ar Variables
  256. (see below) to string or integer values. The mode of comparison is specified
  257. by the
  258. .Ar Operator
  259. (also listed below).
  260. Expressions can be combined using && (for and) and || (for or).
  261. Parentheses can be used for grouping in the usual manner.
  262. .Pp
  263. String values are either any text not containing whitespace (possibly
  264. followed by but not including whitespace) or any text enclosed in single or
  265. double quotes.
  266. .Ss Variables
  267. .Bl -tag -width F1
  268. .It Cm \&%n
  269. Name of the package (type string)
  270. .It Cm \&%o
  271. Origin of the package (type string)
  272. .It Cm \&%p
  273. Prefix of the package (type string)
  274. .It Cm \&%m
  275. Maintainer of the package (type string)
  276. .It Cm \&%c
  277. Comment of the package (type string)
  278. .It Cm \&%e
  279. Description of the package (type string)
  280. .It Cm \&%w
  281. WWW address of the package (type string)
  282. .It Cm \&%s
  283. Flatsize of the package (type integer)
  284. .It Cm \&%a
  285. Automatic status of the package (type integer)
  286. .It Cm \&%q
  287. Architecture of the package (type string)
  288. .It Cm \&%k
  289. Locking status of the package (type integer)
  290. .It Cm \&%M
  291. Message of the package (type string)
  292. .It Cm \&%t
  293. Timestamp that the package was installed (type integer)
  294. .It Cm \&%i
  295. Additional information about the package (type string)
  296. .It Cm \&%# Ns Op drCFODLUGBbA
  297. Number of elements in the list of information (type integer).
  298. See
  299. .Cm %?
  300. above for what information is used.
  301. .El
  302. .Ss Operators
  303. .Bl -tag -width F1
  304. .It Cm ~
  305. String glob pattern matching
  306. .It Cm > Ns Op =
  307. Integer comparison
  308. .It Cm < Ns Op =
  309. Integer comparison
  310. .It Cm = Ns Op =
  311. Integer or string equality comparison
  312. .It Cm !=
  313. Integer or string inequality comparison
  314. .El
  315. .Sh ENVIRONMENT
  316. The following environment variables affect the execution of
  317. .Nm .
  318. See
  319. .Xr pkg.conf 5
  320. for further description.
  321. .Bl -tag -width ".Ev NO_DESCRIPTIONS"
  322. .It Ev PKG_DBDIR
  323. .It Ev CASE_SENSITIVE_MATCH
  324. .El
  325. .Sh FILES
  326. See
  327. .Xr pkg.conf 5 .
  328. .Sh EXIT STATUS
  329. .Ex -std
  330. .Sh EXAMPLES
  331. List all installed packages by name-version:
  332. .Dl $ pkg query %n-%v
  333. .Pp
  334. List all dependencies for a package by origin:
  335. .Dl $ pkg query %do subversion
  336. .Pp
  337. List all dependencies by package name-version:
  338. .Dl $ pkg query %dn-%dv subversion
  339. .Pp
  340. List all reverse dependencies for a package:
  341. .Dl $ pkg query %ro perl
  342. .Pp
  343. List all files and their known checksums for a package:
  344. .Dl $ pkg query '%Fp %Fs' perl
  345. .Pp
  346. List all files for all packages:
  347. .Dl $ pkg query '%o: %Fp'
  348. .Pp
  349. List all packages with no reverse dependencies:
  350. .Dl $ pkg query -e '%#r = 0' %o
  351. .Pp
  352. List non-automatic packages:
  353. .Dl $ pkg query -e '%a = 0' %o
  354. .Pp
  355. List automatic packages:
  356. .Dl $ pkg query -e '%a = 1' %o
  357. .Pp
  358. List unmaintained packages:
  359. .Dl $ pkg query -e '%m = ports@FreeBSD.org' %o
  360. .Sh SEE ALSO
  361. .Xr pkg_printf 3 ,
  362. .Xr pkg_repos 3 ,
  363. .Xr pkg-repository 5 ,
  364. .Xr pkg.conf 5 ,
  365. .Xr pkg 8 ,
  366. .Xr pkg-add 8 ,
  367. .Xr pkg-annotate 8 ,
  368. .Xr pkg-audit 8 ,
  369. .Xr pkg-autoremove 8 ,
  370. .Xr pkg-backup 8 ,
  371. .Xr pkg-check 8 ,
  372. .Xr pkg-clean 8 ,
  373. .Xr pkg-config 8 ,
  374. .Xr pkg-convert 8 ,
  375. .Xr pkg-create 8 ,
  376. .Xr pkg-delete 8 ,
  377. .Xr pkg-fetch 8 ,
  378. .Xr pkg-info 8 ,
  379. .Xr pkg-install 8 ,
  380. .Xr pkg-lock 8 ,
  381. .Xr pkg-register 8 ,
  382. .Xr pkg-repo 8 ,
  383. .Xr pkg-rquery 8 ,
  384. .Xr pkg-search 8 ,
  385. .Xr pkg-set 8 ,
  386. .Xr pkg-shell 8 ,
  387. .Xr pkg-shlib 8 ,
  388. .Xr pkg-ssh 8 ,
  389. .Xr pkg-stats 8 ,
  390. .Xr pkg-update 8 ,
  391. .Xr pkg-updating 8 ,
  392. .Xr pkg-upgrade 8 ,
  393. .Xr pkg-version 8 ,
  394. .Xr pkg-which 8