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
is a tool that displays useful information about the packages on your system. is based on a system of modules. Every module has a shorthand name. For example,  is the same as. explains global options and lists all available modules and their shorthand names. will display the help screen for a specific module. Lastly,  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  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 you view ChangeLog entries for a package version or range of versions. Imagine after an, 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. 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 Package X with depends (d)
Ever wonder why a certain package has been installed on your system? 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 the   USE flag is set.

Listing Files Installed by a Package with files (f)
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   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  might not give you the correct figure. Not to worry, here comes  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)
'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 '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  have answered your question, try using   to manually search an ebuild with programs like ,   or  :

Introduction
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  for complete help and all options.

Viewing, Setting and Unsetting USE Flags
The  command reads the current active USE flags and displays them.

Similarly you can use the  command to only view active global USE flags. The  command does the same for active local USE flags. and  are suboptions to   and need an option before them (like  ) to function correctly.

We can also use  to set or unset use flags. The commands used for this are  (enable a flag) and   (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  without the   flag and the listed packages will be emerged again.

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

eread
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, just run  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. The PAGER environmental variable can be set using  (module  ).

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

eclean
is a tool to remove old source files and old binary packages from your system.

When you build and install packages, the source files are downloaded and preserved in DISTDIR, usually. This can accumulate several gigabytes of material over time if you don't clean it periodically. You can run  to clean only source files from DISTDIR.

You can create archives of installed packages by using  or FEATURES="buildpkg". These archived packages are kept in PKGDIR, usually. When you no longer need to keep them around, or if they're too old, you can run  to remove them from PKGDIR. It's a good way to ensure that any binary packages you have are only the latest versions.

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

Acknowledgements
We would like to thank the following authors and editors for their contributions to this guide:


 * Matt Butcher
 * John P. Davis
 * Erwin
 * Shyam Mani
 * Xavier Neys
 * Karl Trygve
 * José Luis Rivero
 * Joshua Saddler
 * Douglas Anderson