q applets

From Gentoo Wiki
(Redirected from Portage-utils)
Jump to: navigation, search

Other languages:
English • ‎日本語 • ‎한국어 • ‎русский

The q applets are a collection of small and fast portage helper tools written in C. This guide covers some common uses of these helper tools, which are provided through the app-portage/portage-utils package.

Quick Reference

Install the q applets:

root #emerge --ask app-portage/portage-utils

To see the available applets with a short description of their function, use q --help:

user $q --help
Usage: q <applet> <args>  : invoke a portage utility applet
  
Currently defined applets:
        q <applet> <args> : virtual applet
    qatom <pkg>           : split atom strings
   qcache <action> <args> : search the metadata cache
   qcheck <pkgname>       : verify integrity of installed packages
 qdepends <pkgname>       : show dependency info
    qfile <filename>      : list all pkgs owning files
    qglsa <action> <list> : check GLSAs against system
    qgrep <misc args>     : grep in ebuilds
    qlist <pkgname>       : list files owned by pkgname
     qlop <pkgname>       : emerge log analyzer
   qmerge <pkgnames>      : fetch and merge binary package
     qpkg <misc args>     : manipulate Gentoo binpkgs
  qsearch <regex>         : search pkgname/desc
    qsize <pkgname>       : calculate size usage
    qtbz2 <misc args>     : manipulate tbz2 packages
     quse <useflag>       : find pkgs using useflags
    qxpak <misc args>     : manipulate xpak archives
  
Options: -[irmM:vqChV]
  -i, --install        * Install symlinks for applets
  -r, --reinitialize   * Reinitialize ebuild cache
  -m, --metacache      * Reinitialize metadata cache
  -M, --modpath  <arg> * Module path
  -v, --verbose        * Make a lot of noise
  -q, --quiet          * Tighter output; suppress warnings
  -C, --nocolor        * Don't output color
  -h, --help           * Print this help and exit
  -V, --version        * Print version and exit

Before using the applets, initialize the cache first:

root #q -r

Small portage utilities

The app-portage/portage-utils package is a collection of very fast utilities written in C, which are meant to offer a faster but more limited alternative to their app-portage/gentoolkit counterparts. Please note that portage-utils is not meant to replace gentoolkit. Its utilities are much more efficient than the equivalent ones from gentoolkit and might be better suited to be used in scripts that need to call Portage repeatedly, but they do not offer the same functionality. It does not consider eclasses and does not provide tools like revdep-rebuild or glsa-check.

The complete list of applications that are provided by app-portage/portage-utils can be listed by typing man q or q --help. Please read the man page for each utility described, as this guide is only meant to be a short reference for the most useful functions and does not include all the information about each application.

Usage

How to find a package to which a file belongs

The qfile command finds the package to which a file belongs:

user $qfile /etc/fonts/fonts.conf
media-libs/fontconfig (/etc/fonts/fonts.conf)
user $qfile /usr/share/keymaps/atari/atari-uk-falcon.map.gz
sys-apps/kbd (/usr/share/keymaps/atari/atari-uk-falcon.map.gz)

Verifying package integrity

To check the MD5 sums or modification times of the files installed by some package, use the qcheck application:

user $qcheck portage-utils
Checking app-portage/portage-utils-0.1.13 ...
  * 36 out of 36 files are good

Of course, all the files which were changed after installation will be reported here. If the application reports configuration files which have been manually edited after installation, then there's nothing to worry about.

Listing packages which depend on some package

Of course there's also an application which allows to list all the packages which depend on some package. This is done using qdepends. Use the -a flag to show all the DEPEND, RDEPEND, and PDEPEND information for a package.

user $qdepends -a pygtk
 * DEPEND
dev-python/pygtk-2.8.2: >=dev-lang/python-2.3 >=x11-libs/gtk+-2.8.0
>=dev-libs/glib-2.8.0 >=x11-libs/pango-1.10.0 >=dev-libs/atk-1.8.0
>=gnome-base/libglade-2.5.0 >=dev-python/pycairo-0.9.0 dev-python/numeric
virtual/opengl dev-python/pyopengl >=x11-libs/gtkglarea-1.99
>=dev-util/pkgconfig-0.9 sys-devel/patch
 * RDEPEND
dev-python/pygtk-2.8.2: >=dev-lang/python-2.3 >=x11-libs/gtk+-2.8.0
>=dev-libs/glib-2.8.0 >=x11-libs/pango-1.10.0 >=dev-libs/atk-1.8.0
>=gnome-base/libglade-2.5.0 >=dev-python/pycairo-0.9.0 dev-python/numeric
virtual/opengl dev-python/pyopengl >=x11-libs/gtkglarea-1.99
 * PDEPEND

Listing files that belong to an ebuild

The qlist command gives a list of all files that belong to an ebuild.

user $qlist vim
/usr/bin/gvim
/usr/bin/gvimdiff
/usr/bin/evim
/usr/bin/eview
/usr/bin/gview
/usr/bin/rgvim
[...]

Looking for packages that use some USE flag

Listing used USE flags is done with quse, which must be run as root. It may take some time to first create/update the ebuild cache.

user $quse firefox
app-misc/tracker/tracker-0.12.10-r1.ebuild applet doc eds elibc_glibc exif firefox-bookmarks flac flickr gif
[...]

Finding package sizes

To show the size of a package, use the qsize application:

user $qsize vim
app-editors/gvim-6.4: 10 files, 7 non-files, 2327.516 KB
app-editors/vim-6.4: 6 files, 2 non-files, 2058.14 KB
app-editors/vim-core-6.4: 1024 files, 68 non-files, 10950.984 KB
[...]

Searching the Portage tree

One of the most powerful tools of app-portage/portage-utils is qsearch. This tool allows to search the Portage tree much faster than using the emerge -s command.

Here are some examples of its usage:

user $qsearch terminus
media-fonts/terminus-font A clean fixed font for the console and X11

The homepage of packages can be queried using the -H option:

user $qsearch -H terminus
media-fonts/terminus-font http://www.is-vn.bg/hamster/jimmy-en.html

In another example, let's look for a jabber client:

user $qsearch -S "jabber client"
app-emacs/emacs-jabber A Jabber client for Emacs.
net-im/gajim Jabber client written in PyGTK
net-im/gnome-jabber Gnome Jabber Client
net-im/gossip Lightweight Jabber client for GNOME
net-im/imcom Python commandline Jabber Client
net-im/psi QT 3.x Jabber Client, with Licq-like interface
net-im/tkabber Featureful Jabber client for tcl/tk.
x11-themes/psi-themes Iconsets for Psi, a QT 3.x Jabber Client

Extracting information from emerge logs

There is also a tool that allows to extract useful information from the emerge.log file. It's called qlop and it can be useful when package compilation times need to be estimated or to compare build times with other systems. It also allows to check what's compiling at the moment and how long it will probably take - which is handy when working in the console and don't have any other means to check it.

To see how long a dev-lang/perl build usually takes:

user $qlop -tH perl
perl: 7 minutes, 52 seconds for 4 merges

To see what is emerging at the moment and how long the process has been running already:

user $qlop -c
* perl-5.8.8-r23
    started: Mon May 21 12:41:11 2007
    elapsed: 19 seconds

See also



This article is based on a document formerly found on our main website gentoo.org.
The following people have contributed to the original document: Łukasz Damentko, Joshua Saddler and Marcelo Góes
They are listed here as the Wiki history does not provide for any attribution. If you edit the Wiki article, please do not add yourself here, your contributions are recorded on the history page.