Gentoo Portage secrets
March 7, 2007
Gentoo Linux is perhaps the most-used source-based Linux distribution. One secret to its success is the powerful and handy Portage package management system. While Gentoo comes with extensive documentation covering most aspects of using Portage, the techniques described in Gentoo’s handbook and other documentation are not always the most effective ones. Here are some insider tips that can greatly increase your productivity.
Before you install a package, you usually look for it via Portage’s search capabilities. Portage’s emerge utility has –search and –searchdesc options, but using them is not enjoyable, because they take a long time to run. That’s why we’ve seen the emergence of third-party search front ends for Portage, such as esearch and eix. Their common idea is to use their own search indexes to speed up searches. When using either utility, you have to rebuild the index after updating the Portage tree, and after installing and uninstalling software. Of the two, eix works faster and has more capabilities.
Optimizing traffic usage
Updating your software can take a lot of network bandwidth. There are tools that help you decrease Portage’s appetite. The most effective and well-known such tool is Deltup, which allows you to download deltas, or the differences between new and old versions of package source. That approach can save you up to 90% of the download size. The procedure for installing deltup is described in the Gentoo wiki.The Gentoo wiki provides more tips for users with poor Internet connections.
Faster package compilation
Every time you install or update some software under Gentoo, you need to wait until its source is compiled. Portage supports a set of tools that try to decrease the compiling time of your packages.One of the ways to speed up compilation on a slow machine is to distribute the compiling task to another host. This is what Distcc aims to do. You can even use Windows boxes to assist in the task.
Managing logs and configuration files
Another new feature in Portage 2.1 is the new logging framework. Many packages show notices while you emerge them, but you may not see them if you do not watch the emerge process. Now you just need to turn on elog, by adding these lines to /etc/make.conf:
# This sets what to log
PORTAGE_ELOG_CLASSES=”warn error log”
# And this is how to do it
and creating the /var/log/portage/elog directory. Now, each package’s emerge log will be saved in a separate file in the specified directory. You can find more info on configuring elog by inspecting the /etc/make.conf.example file. There are already GTK and QT graphical front ends for viewing these logs.