q applets

From Gentoo Wiki
(Redirected from Portage-utils)
Jump to: navigation, search
This page contains changes which are not marked for translation.

Other languages:
English • ‎português do Brasil • ‎русский • ‎日本語 • ‎한국어


The q applets are a collection of small, fast Portage query utilities written in C. These are meant to offer a faster but more limited alternative to their app-portage/gentoolkit counterparts.

Readers should note that q applets were not created to replace gentoolkit; they simply may be more efficient than the equivalent utilities from gentoolkit and might be better suited to be used in scripts that need to call Portage repeatedly. They do not offer the same functionality. q applets do not consider eclasses and do not provide tools like revdep-rebuild or glsa-check.


USE flags

USE flags for app-portage/portage-utils Small and fast Portage helper tools written in C

libressl Use dev-libs/libressl instead of dev-libs/openssl when applicable (see also the ssl useflag)
nls Add Native Language Support (using gettext - GNU locale utilities)
openmp Build support for the OpenMP (support parallel computing), requires >=sys-devel/gcc-4.2 built with USE="openmp"
qmanifest Build qmanifest applet, this adds additional dependencies for GPG, OpenSSL and BLAKE2B hashing
qtegrity Build qtegrity applet, this adds additional dependencies for OpenSSL
static !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically


Install the q applets:

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


Build the cache

Before using the applets first initialize the cache:

root #q -r



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:

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
    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 (qfile)

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 (qcheck)

To check the MD5 checksums 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

All the files which were changed after installation will be reported here. Configuration files which have been manually edited after installation are reported too. Most packages do not require root permissions. However, if a package has files that are only accessible to root qcheck should be run as root.

To check the integrity of all packages installed, enter:

root #qcheck

Listing package dependencies (qdepends)

qdepends can list the dependencies of a package in either direction. Use the -a option to list all the DEPEND, RDEPEND, and PDEPEND installed dependencies needed by a package.

user $qdepends -a xorg-server
x11-base/xorg-server-1.20.4: >=app-eselect/eselect-opengl-1.3.0 dev-libs/openssl:0/0= >=x11-apps/iceauth-1.0.2 >=x11-apps/rgb-1.0.3 >=x11-apps/xauth-1.0.3 x11-apps/xkbcomp >=x11-libs/libdrm-2.4.89 >=x11-libs/libpciaccess-0.12.901 >=x11-libs/libXau-1.0.4 >=x11-libs/libXdmcp-1.0.2 >=x11-libs/libXfont2-2.0.1 >=x11-libs/libxkbfile-1.0.4 >=x11-libs/libxshmfence-1.1 >=x11-libs/pixman-0.27.2 >=x11-libs/xtrans-1.3.5 >=x11-misc/xbitmaps-1.0.1 >=x11-misc/xkeyboard-config-2.4.1-r3 media-libs/libepoxy[X] >=media-libs/mesa-18[egl,gbm] !x11-libs/glamor >=x11-libs/libX11-1.1.5 >=x11-libs/libXext-1.0.5 >=media-libs/mesa-18 virtual/libudev:0/1= >=x11-apps/xinit-1.3.3-r1 sys-devel/flex >=x11-base/xorg-proto-2018.3
x11-base/xorg-server-1.20.4: >=app-eselect/eselect-opengl-1.3.0 dev-libs/openssl:0/0= >=x11-apps/iceauth-1.0.2 >=x11-apps/rgb-1.0.3 >=x11-apps/xauth-1.0.3 x11-apps/xkbcomp >=x11-libs/libdrm-2.4.89 >=x11-libs/libpciaccess-0.12.901 >=x11-libs/libXau-1.0.4 >=x11-libs/libXdmcp-1.0.2 >=x11-libs/libXfont2-2.0.1 >=x11-libs/libxkbfile-1.0.4 >=x11-libs/libxshmfence-1.1 >=x11-libs/pixman-0.27.2 >=x11-libs/xtrans-1.3.5 >=x11-misc/xbitmaps-1.0.1 >=x11-misc/xkeyboard-config-2.4.1-r3 media-libs/libepoxy[X] >=media-libs/mesa-18[egl,gbm] !x11-libs/glamor >=x11-libs/libX11-1.1.5 >=x11-libs/libXext-1.0.5 >=media-libs/mesa-18 virtual/libudev:0/1= >=x11-apps/xinit-1.3.3-r1 !x11-drivers/xf86-video-modesetting
x11-base/xorg-server-1.20.4: >=x11-base/xorg-drivers-1.20

To list all of the installed packages that depend on a package use the -Q option.

user $qdepends -aQ xorg-server

Search ebuilds or eclasses for a pattern (qgrep)

qgrep can be used to find ebuilds that mention an ebuild's name ("libechonest" is used in the example below) which will list all packages (installed or not) which depend on some package:

user $qgrep -H libechonest | cut -f1 -d":" | uniq

The -J option will limit the search to installed packages.

user $qgrep -NJ net-print/cups
app-office/libreoffice- cups? ( net-print/cups )
dev-qt/qtprintsupport-5.11.3:   cups? ( >=net-print/cups-1.4 )
net-print/hplip-3.18.6: net-print/cups
net-print/hplip-3.18.6: hpijs? ( net-print/cups-filters[foomatic] )
net-print/cups-filters-1.21.6:  >=net-print/cups-1.7.3
net-print/cups-filters-1.21.6:  !<=net-print/cups-1.5.9999
dev-java/icedtea-bin-3.10.0-r1: cups? ( >=net-print/cups-2.0% )
net-wireless/bluez-5.50-r2:     cups? ( net-print/cups:= )
app-text/ghostscript-gpl-9.26:  cups? ( >=net-print/cups-1.3.8 )
x11-libs/gtk+-2.24.32-r1:       cups? ( >=net-print/cups-1.7.1-r2:=[${MULTILIB_USEDEP}] )
x11-libs/gtk+-3.24.4-r1:        cups? ( >=net-print/cups-1.2[${MULTILIB_USEDEP}] )

Listing files that belong to an ebuild (qlist)

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

user $qlist vim

Looking for packages that use some USE flag (quse)

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.

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 (qsize)

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 (qsearch)

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 (qlop)

qlop allows to extract useful information from the emerge.log file. 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 is 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.

Estimate how long a dev-lang/perl build takes:

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

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 page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Łukasz Damentko, , and Marcelo Góes
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.