Gentoolkit

Gentoolkit is a suite of tools to ease the administration of a Gentoo system. This document covers the basics of some of the tools present in Gentoolkit.

What is gentoolkit?
Gentoo is a unique distribution and presents some complexities that simply don't exist for other distributions. As Gentoo developers and contributors discovered some of these complexities, they also wrote tools to help users and administrators work around them. Many of these tools have been contributed to the Gentoo project and are included in the package.

Gentoolkit contains a whole bunch of useful tools to help manage your packages and keep track of what is going on in your system. Most users -- particularly those who update systems often -- will benefit from having gentoolkit installed.

Installation
Just as with any Gentoo package, installation is just a simple emerge.

Finding documentation
Any documentation that a program might have (other than man pages) is stored in.

Introduction
equery is a tool that displays useful information about the packages on your system. equery is based on a system of modules. Every module has a shorthand name. For example, equery l gcc is the same as equery list gcc. equery --help explains global options and lists all available modules and their shorthand names. equery --help module will display the help screen for a specific module. Lastly, man equery provides a detailed explanation of all available modules and options, and provides useful examples.

Below is a list of features that work over the majority of modules.

Like emerge, equery doesn't understand partial package names:

Unlike emerge, equery can accept shell-like globbing in the category and/or package name:

Most equery modules take multiple input:

A few modules also allow full regular expressions:

The next few sections in this document give a quick introduction to the different equery modules.

Finding the package that a file came from with belongs (b)
can search for files matching a regular expression with the  option. The  option stops searching after it finds a match. Since no file on your system should be owned by two packages, this is a safe optimization.

Viewing ChangeLog entries with changes (c)
lets the user view ChangeLog entries for a package version or range of versions. Imagine after running emerge --sync, you notice Portage is going to be upgraded and want to check what has changed:

Verifying package integrity with check (k)
Sometimes it is useful to check a package's integrity. equery can verify MD5 sums as well as timestamps to indicate when a package might have been corrupted, replaced, or removed.

Listing all packages depending on a package with depends (d)
Ever wonder why a certain package has been installed on your system? equery</tt> can tell which packages list it as a dependency with. Include indirect dependencies with the  option.

Getting dependency graphs with depgraph (g)
is the opposite of. You pass it a package, and it will find the packages it depends on (not that depend on it). When it finds a dependency, it will recursively search for all of that package's dependencies. Control how deep the tree gets with the  option.

Notice how  is a direct dependency and   is an indirect dependency if   USE is set.

Listing files installed by a package with files (f)
equery</tt> can list all the files installed by an ebuild with the  module. Try  to get an easy to read directory layout. Use  to only find a certain type of file. For example, to find where executables were installed, use, and to quickly find the configuration file location, try.

Looking for packages that have a specific USE flag with hasuse (h)
You can use  to find out which packages have a given USE flag. won't tell you if the flag is enabled, only if the ebuild lists it as an option. See the EXAMPLES section of  in the equery</tt> man page for more tip on getting that information.

Listing packages with list (l)
is a simple, yet powerful module to list packages that are installed, in the Portage tree or in an overlay.

The standard query will search installed packages for the given package name. Passing in '*' displays all packages in the set. In the leftmost field, we see that all the above packages are (nstalled) and from the  (ortage) tree. They're not masked (the second field is blank), and they're all installed in the default slot (0).

This time we are going to use local options to look for packages in the Portage tree and overlays.

In this example you can see version 7.2.182 is installed and there are no versions available from an overlay. You can see which versions are keyword masked by the  in the second field.

Viewing package metadata with meta (m)
Each package in the Portage tree provides at least some metadata about its maintainer, herd, etc. Read about Gentoo Metadata. The amount of useful information depends on how much package maintainers decide to provide. With no options,  returns some basic useful information.

When the maintainer provides extra information, it can be very useful:

Finding package sizes with size (s)
Have you ever been curious to find out how much space a specific package is occupying? Since a package could have its files over a number of directories, the usual du -hc command might not give you the correct figure. Not to worry, here comes equery</tt> to the rescue!

As you can see,  prints the total space used in human-readable units and lists the total number of files the package has. To get the total size in bytes, use.

Listing per-package USE flags with uses (u)
equery</tt>'s  module can provide information about what USE flags are available for a specific package, and which of those flags is currently enabled.

Here, a number of USE flags are enabled in gstreamer's plugin meta-package, but you can see that there are other USE flags available. For more information on USE flags, please refer to the USE Flags chapter of the Gentoo Handbook.

Finding the ebuild path with which (w)
is a simple script to help you quickly find the file path to an ebuild. If you pass an unversioned package name,  will return the path to the newest installable ebuild version, in other words, the ebuild Portage would use if you typed. Pass in a versioned package to get the path to that ebuild.

Lastly, if none of the above features of equery</tt> have answered your question, try using  to manually search an ebuild with programs like cat</tt>, less</tt> or grep</tt>:

Introduction
euse</tt> is a tool to see, set and unset USE flags at various places. For more information on USE flags, please refer to the USE Flags. Please see euse -h for complete help and all options.

Viewing, setting, and unsetting USE flags
The euse -a</tt> command reads the current active USE flags and displays them.

Similarly you can use the euse -a -g</tt> command to only view active global USE flags. The euse -a -l</tt> command does the same for active local USE flags. and  are suboptions to euse</tt> and need an option before them (like  ) to function correctly.

We can also use euse</tt> to set or unset use flags. The commands used for this are euse -E flagname</tt> (enable a flag) and <tt>euse -D flagname</tt> (disable a flag).

Enabling a USE Flag:

The file looks like so after the command was ran:

Disabling the USE flag:

Again, the file after the command:

revdep-rebuild
This tool is Gentoo's Reverse Dependency rebuilder. It will scan your installed ebuilds to find packages that have become broken as a result of an upgrade of a package they depend on. It can emerge those packages for you but it can also happen that a given package does not work any more with the currently installed dependencies, in which case you should upgrade the broken package to a more recent version. revdep-rebuild will pass flags to emerge which lets you use the  flag to see what is going to be emerged again before you go any further.

If you need to rebuild some packages, you may run <tt>revdep-rebuild</tt> without the  flag and the listed packages will be emerged again.

glsa-check
<tt>glsa-check</tt> is mainly a test tool that keeps track of the various GLSA's (Gentoo Linux Security Advisory) and will eventually be integrated into <tt>emerge</tt> and <tt>equery</tt>.

eread
<tt>eread</tt> is a simple utility to display elog files produced by >=. You can set the saving of elog files by setting a couple of variables in :

Once you've set up elog to your satisfaction, run <tt>eread</tt> to view your log files.

Select a number and the file will be displayed using the paging program specified in the PAGER environment variable. If PAGER is not set, it will use <tt>less</tt>. The PAGER environmental variable can be set using <tt>eselect</tt> (module ).

After displaying the elog item, you will be prompted if you want to delete the file.

eclean
<tt>eclean</tt> is a tool to remove old source files and old binary packages from the system.

Building and installing packages, the source files are downloaded and preserved in, usually. This can accumulate several gigabytes of material over time if it is not cleaned periodically. Users should run <tt>eclean-dist</tt> to clean source files from.

It is possible to create archives of installed packages by using <tt>quickpg</tt> or FEATURES="buildpkg". These archived packages are kept in PKGDIR, usually. When they are no longer needed, or if they are too old, <tt>eclean-pkg</tt> can be ran to remove them from. It is a good way to ensure that any binary packages on the system are only the latest versions.

For more information on <tt>eclean</tt> and tips on maintaining a cruft-free system, please read man eclean or check the eclean article.