This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

q applets

From Gentoo Wiki (test)
Jump to:navigation Jump to:search
This page contains changes which are not marked for translation.

Resources

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 q applets are not meant to replace gentoolkit. The utilities may be 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. q applets do not consider eclasses and do not provide tools like revdep-rebuild or glsa-check.

Installation

USE flags

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

+qmanifest Build qmanifest applet, this adds additional dependencies for GPG, OpenSSL and BLAKE2B hashing
+qtegrity Build qtegrity applet, this adds additional dependencies for OpenSSL
openmp Build support for the OpenMP (support parallel computing), requires >=sys-devel/gcc-4.2 built with USE="openmp"
static  !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically

Emerge

Install the q applets:

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

Configuration

Before using the applets first initialize the cache:

root #q -r

Usage

Invocation

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 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

All the files which were changed after installation will be reported here. Configuration files which have been manually edited after installation are reported too.

Listing packages which depend on some package (qdepends)

qdepends allows to list all the packages which depend on some package. Use the -a option 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 all packages (installed or not) which depend on some package (qgrep)

The q applets can be used to find ebuilds that mention an ebuild's name ("libechonest" is used in the example below) with great speed:

user $qgrep -H libechonest | cut -f1 -d":" | uniq
media-libs/libechonest/libechonest-2.0.2.ebuild
media-libs/libechonest/libechonest-2.2.0-r1.ebuild
media-libs/libechonest/libechonest-2.3.0.ebuild
media-libs/libechonest/libechonest-2.3.1.ebuild
media-libs/libechonest/libechonest-2.3.1-r1.ebuild
media-libs/libechonest/libechonest-9999.ebuild
media-sound/clementine/clementine-1.2.3.ebuild
media-sound/clementine/clementine-1.2.3-r1.ebuild
media-sound/clementine/clementine-1.3.1-r1.ebuild
media-sound/tomahawk/tomahawk-0.8.4-r3.ebuild
media-sound/tomahawk/tomahawk-9999.ebuild

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
/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 (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, Joshua Saddler (nightmorph), 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.