root/releases/pkgcore/0.2.1/doc/pquery-usage.rst @ masterdriverz%2540gentoo.org-20070120231515-zerpiu35tk07h13e

Revision masterdriverz%2540gentoo.org-20070120231515-zerpiu35tk07h13e, 5.4 KB (checked in by Charlie Shepherd <masterdriverz@…>, 2 years ago)

Add usage docs

Line 
1pquery usage
2++++++++++++
3
4Basics
5======
6
7pquery is used to extract various kinds of information about either installed or
8uninstalled packages. As you probably guessed from the name it is similar to
9equery, but it can do things equery cannot do and is a bit more flexible.
10
11What pquery does is select packages from one or more "repositories" that match
12a boolean combination of restrictions, then print selected information about
13those packages. It is important to understand that the information printing and
14repository selection options are almost completely separate from the
15restriction options. The only exception to that is that restrictions on
16contents automatically select the vdb (installed packages) repository, since
17running them on the portdir repository makes no sense.
18
19Another switch that could do with some extra explanation is --raw. Specifying
20--raw makes your configuration not affect the results. Example: ::
21
22 $ pquery --attr alldepends -m dbus --max -v
23 * sys-apps/dbus-0.62-r1
24     description: A message bus system, a simple way for applications to talk
25                  to each other
26     homepage: http://dbus.freedesktop.org/
27     depends: >=dev-libs/glib-2.6 || ( ( x11-libs/libXt x11-libs/libX11 )
28                  virtual/x11 ) >=x11-libs/gtk+-2.6 >=dev-lang/python-2.4
29                  >=dev-python/pyrex-0.9.3-r2 >=dev-libs/expat-1.95.8
30                  dev-util/pkgconfig sys-devel/automake
31                  >=sys-devel/autoconf-2.59 sys-devel/libtool
32     rdepends: >=dev-libs/glib-2.6 || ( ( x11-libs/libXt x11-libs/libX11 )
33                  virtual/x11 ) >=x11-libs/gtk+-2.6 >=dev-lang/python-2.4
34                  >=dev-python/pyrex-0.9.3-r2 >=dev-libs/expat-1.95.8
35     post_rdepends:
36 $
37
38This is the highest unmasked package on my system. Also notice there are no
39references to USE flags or qt in the dependencies. That is because I do not
40have qt in USE in my configuration, so those dependencies do not apply.::
41
42 $ pquery --attr alldepends -m dbus --max -v --raw
43 * sys-apps/dbus-0.91
44     description: Meta package for D-Bus
45     homepage: http://dbus.freedesktop.org/
46     depends:
47     rdepends: >=sys-apps/dbus-core-0.91 python? (
48                  >=dev-python/dbus-python-0.71 ) qt3? (
49                  >=dev-libs/dbus-qt3-old-0.70 ) gtk? (
50                  >=dev-libs/dbus-glib-0.71 ) !<sys-apps/dbus-0.91
51     post_rdepends:
52 $
53
54This version is in package.mask, and we can see the use-conditional flags now.
55
56The --verbose or -v flag tries to print human-readable output (although some
57things like the formatting of depend strings need some improvement). Without -v
58the output is usually a single line per package in a hopefully
59machine-parseable format (usable in pipelines). There are some extras like
60--atom meant for shell pipeline use. If you have some useful shell pipeline in
61mind that pquery's output could be better formatted for please file a ticket.
62
63Adding short options is planned but there are some features to add first (want
64most of the features in place to avoid name clashes).
65
66How Do I?
67=========
68
69============================ ========================================= ========================================================================
70other tool                   pquery                                    comments
71============================ ========================================= ========================================================================
72``equery belongs /bin/ls``   ``pquery --owns /bin/ls``
73``equery check``             not implemented (yet?)
74``equery depends python``    ``pquery --vdb --revdep dev-lang/python`` omitting the ``--vdb`` makes it equivalent to ``equery depends -a``
75``equery depgraph``          not implemented (yet?)
76``equery files python``      ``pquery --contents -m python``           ``--contents`` is an output option, can be combined with any restriction
77``equery hasuse python``     ``pquery --vdb --has-use python``
78``equery list python``       ``pquery --vdb -m '*python*'``            this is in ExtendedAtomSyntax
79``equery size``              ``not implemented (yet?)``
80``equery uses python``       ``pquery --attr use -m python``           less information, but is an output option so mixes with any restriction
81``emerge -s python``         ``pquery -vnm '*python*'``
82``emerge -S python``         ``pquery -vnS python``                    searches through longdescription (from metadata.xml) too
83No equivalent                ``pquery --license GPL-2 --vdb``          list all installed GPL-2 packages
84No equivalent                ``pquery --maintainer seemant``           list all packages that are maintained by seemant
85============================ ========================================= ========================================================================
86
87It can also do some things equery/emerge do not let you do, like restricting
88based on maintainer or herd and printing various other package attributes. See
89--help for those. If you miss a query file a ticket.
90
91Freeform Restrictions
92=====================
93
94One possibly interesting feature is:
95
96``pquery --expr "and(or(herd(python), maintainer(me)), match('dev-*/*'))"``
97
98which matches packages in a category starting with dev that are either
99maintained by "me" or in the python herd. This code is not heavily tested and
100the "not" boolean is currently broken. Should be fixed for the next release
101though.
Note: See TracBrowser for help on using the browser.