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.
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.
- 1 Installation
- 2 Configuration
- 3 Usage
- 3.1 Invocation
- 3.2 How to find a package to which a file belongs
- 3.3 Verifying package integrity
- 3.4 Listing packages which depend on some package
- 3.5 Listing files that belong to an ebuild
- 3.6 Looking for packages that use some USE flag
- 3.7 Finding package sizes
- 3.8 Searching the Portage tree
- 3.9 Extracting information from emerge logs
- 4 See also
Install the q applets:
emerge --ask app-portage/portage-utils
Before using the applets first initialize the cache:
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.
To see the available applets with a short description of their function, use 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 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
How to find a package to which a file belongs
The qfile command finds the package to which a file belongs:
Verifying package integrity
To check the MD5 sums or modification times of the files installed by some package, use the qcheck application:
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 option to show all the
PDEPEND information for a package.
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.
/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 with root permissions. It may take some time to first create/update the ebuild cache.
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:
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:
media-fonts/terminus-font A clean fixed font for the console and X11
The homepage of packages can be queried using the
qsearch -H terminus
In another example, let's look for a jabber client:
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 is 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:
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:
* perl-5.8.8-r23 started: Mon May 21 12:41:11 2007 elapsed: 19 seconds
- Gentoolkit - A suite of tools to ease the administration of a Gentoo system.
- Qcheck - A command-line tool used verify integrity of installed packages.
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.