eix

From Gentoo Wiki
Jump to: navigation, search

Resources

eix is a set of utilities for searching and diffing the local Portage tree and overlays using a binary cache.

It is made to be more efficient and flexible than the emerge --search command. eix comes with colorized output which helps users easily find the needed package information.

Installation

Install app-portage/eix:

root #emerge --ask app-portage/eix

Managing the cache

Updating the cache manually

After the installation has finished, it is important to update the cache to index all packages on the system. Running following command will update the local eix cache:

root #eix-update

Updating the cache with each sync

After each update of the portage tree the cache needs to be updated. Additionally, one may want to see a diff of the changes since the last sync:

root #cp -a /var/cache/eix/portage.eix /var/cache/eix/previous.eix
root #eix-update
root #eix-diff

The following 2 methods are used to automatically update the cache with each sync.

Note
Method 1 is preferred, as it is able to work in combination with all possible emaint sync commands (see Portage plug-in sync system specification).

Method 1: Using portages postsync hook

After each sync all executable scripts in the directory /etc/portage/postsync.d/ are called:

FILE /etc/portage/postsync.d/eix
#!/bin/sh
if [[ -e /var/cache/eix/portage.eix ]]; then 
    cp -a /var/cache/eix/portage.eix /var/cache/eix/previous.eix; 
fi
eix-update
if [[ -e /var/cache/eix/previous.eix ]]; then 
    eix-diff; 
fi

If overlays are used, eix-update can become quite slow, as many of them do not provide pregenerated caches. To speed up the process of eix-update, one can hook portage to regenerate the cache for each repository after each sync. An example for this is given in the file /etc/portage/repo.postsync.d/example. We can copy this example to /etc/portage/repo.postsync.d/egencache and make it executable.

FILE /etc/portage/repo.postsync.d/egencache
#!/bin/sh
 
# The repository name.
repository_name=${1}
# The URI to which the repository was synced.
sync_uri=${2}
# The path to the repository.
repository_path=${3}
 
# Portage assumes that a hook succeeded if it exits with 0 code. If no
# explicit exit is done, the exit code is the exit code of last spawned
# command. Since our script is a bit more complex, we want to control
# the exit code explicitly.
ret=0
 
if [ -n "${repository_name}" ]; then
        # Repository name was provided, so we're in a post-repository hook.
        echo "* In post-repository hook for ${repository_name}"
        echo "** synced from remote repository ${sync_uri}"
        echo "** synced into ${repository_path}"
 
        # Gentoo comes with pregenerated cache but the other repositories
        # usually don't. Generate them to improve performance.
        if [ "${repository_name}" != "gentoo" ]; then
                if ! egencache --update --repo="${repository_name}" --jobs=8
                then
                        echo "!!! egencache failed!"
                        ret=1
                fi
        fi
fi
 
 
# Return explicit status.
exit "${ret}"

Method 2: Using eix-sync

Alternatively, one can use eix-sync tool from eix itself:

root #eix-sync

The above command is a shorthand way to running these commands sequentially:

root #emerge --sync
root #cp -a /var/cache/eix/portage.eix /var/cache/eix/previous.eix
root #eix-update
root #eix-diff

If overlays are used, it is recommended to configure eix to synchronize them too:

FILE /etc/eix-sync.conf
*

To speed up eix-update in case of large overlays have a look at this page.

Adding remote overlays to the cache

To search all available overlays (and not only the checked out overlays), add them to the cache with the command:

root #eix-remote update
Note
It is also possible to add this to the hook /etc/portage/postsync.d/eix to automatically run the remote update with each update.

Using tmpfs cache

This breaks eix because /var/cache/eix is missing when /var/cache is mounted:

root #grep /var/cache /etc/fstab
none /var/cache tmpfs size=512m 0 0

The simple solution is to move the eix cache file away from the default location:

root #echo "EIX_CACHEFILE=%{EPREFIX}/var/cache/eix-portage.eix" >> /etc/eixrc/00-eixrc
root #eix --dump | grep EIX_CACHEFILE
EIX_CACHEFILE=%{EPREFIX}/var/cache/eix-portage.eix
# EIX_CACHEFILE=%{EPREFIX}/var/cache/eix/portage.eix

One side effect is needing to run eix-update after reboot which will take a few seconds.

Usage

Searching for packages

Simple search

To find package names containing kernel keyword:

user $eix kernel
* app-admin/eclean-kernel
     Available versions:  (~)0.3 {{python_targets_python2_6 python_targets_python2_7}}
     Homepage:            https://bitbucket.org/mgorny/eclean-kernel/
     Description:         Remove outdated built kernels

* app-doc/linux-kernel-in-a-nutshell
     Available versions:  1
     Homepage:            http://www.kroah.com/lkn/
     Description:         Linux Kernel in a Nutshell: A Desktop Quick Reference

* games-misc/fortune-mod-kernelcookies
     Available versions:  9 {{offensive}}
     Homepage:            http://www.schwarzvogel.de/software-misc.shtml
     Description:         A collection of funny lines from the Linux kernel

* net-fs/openafs-kernel
     Available versions:  1.4.14 (~)1.4.14.1 (~)1.6.0 (~)1.6.1_pre1 (~)1.6.1 {{kernel_linux}}
     Homepage:            http://www.openafs.org/
     Description:         The OpenAFS distributed file system kernel module

* sec-policy/selinux-kerneloops
     Available versions:  [M]2.20120215 [M](~)2.20120215-r1
     Homepage:            http://www.gentoo.org/proj/en/hardened/selinux/
     Description:         SELinux policy for kerneloops

* sys-cluster/drbd-kernel
     Available versions:  8.0.16 (~)8.3.6 (~)8.3.8.1 {{kernel_linux}}
     Homepage:            http://www.drbd.org
     Description:         mirror/replicate block-devices across a network-connection

* sys-cluster/gfs-kernel
     Available versions:  2.03.09 {{kernel_linux}}
     Homepage:            http://sources.redhat.com/cluster/wiki/
     Description:         GFS kernel module

[I] sys-kernel/genkernel
     Available versions:  3.4.16 (~)3.4.16.1 3.4.20 (~)3.4.21.2 (~)3.4.22.1 (~)3.4.23.1 (~)3.4.24 3.4.24_p1 (~)3.4.25.1 (~)3.4.26 (~)3.4.27 (~)3.4.28 (~)3.4.29 (~)3.4.32 (~)3.4.33.1 (~)3.4.34 (~)3.4.35 (~)3.4.36 **9999 {{crypt cryptsetup ibm selinux}}
     Installed versions:  3.4.36(01:30:10 AM 07/01/2012)(crypt -cryptsetup -ibm -selinux)
     Homepage:            http://www.gentoo.org
     Description:         Gentoo automatic kernel building scripts

Found 8 matches.

Searching for installed packages

Search for installed packages using the -I option:

user $eix -I kernel
[I] sys-kernel/genkernel
     Available versions:  3.4.16 (~)3.4.16.1 3.4.20 (~)3.4.21.2 (~)3.4.22.1 (~)3.4.23.1 (~)3.4.24 3.4.24_p1 (~)3.4.25.1 (~)3.4.26 (~)3.4.27 (~)3.4.28 (~)3.4.29 (~)3.4.32 (~)3.4.33.1 (~)3.4.34 (~)3.4.35 (~)3.4.36 **9999 {{crypt cryptsetup ibm selinux}}
     Installed versions:  3.4.36(01:30:10 AM 07/01/2012)(crypt -cryptsetup -ibm -selinux)
     Homepage:            http://www.gentoo.org
     Description:         Gentoo automatic kernel building scripts

Searching in package descriptions

To search in package descriptions use the -S option. It is possible to print out results in a compact list using -c:

user $eix -S -c corba
[N] dev-ada/polyorb (~2.1.0): A CORBA implementation for Ada
[I] dev-libs/libIDL (0.8.14{tbz2}@07/10/11): CORBA tree builder
[N] gnome-base/libbonobo (2.24.3): GNOME CORBA framework
[I] gnome-base/orbit (2.14.19-r1(2){tbz2}@07/10/11): ORBit2 is a high-performance CORBA ORB
[N] net-misc/mico (~2.3.13-r5): A freely available and fully compliant implementation of the CORBA standard
[N] net-misc/omniORB (4.1.4-r1): A robust, high-performance CORBA 2 ORB

Searching in package categories

Search for certain category using the -C option and print out the results in a compact list (-c):

user $eix -C -c app-officeext
[N] app-officeext/barcode (1.3.5.0): Extension for reading barcodes
[N] app-officeext/ct2n (1.4.0): Extension for converting text to numbers
[N] app-officeext/dmaths (3.4.2.2): Mathematics Formula Editor Extension
[N] app-officeext/languagetool (1.7): Style and Grammar Checker for libreoffice
[N] app-officeext/ooo2gd (3.0.0): Extension for export to Google docs, zoho and WebDAV
[N] app-officeext/sun-templates (~1.0.0): Collection of sun templates for various countries.
[N] app-officeext/texmaths (0.35): LaTeX Equation Editor for LibreOffice

Searching for installed obsolete packages

Search for obsolete packages on the system using the eix-test-obsolete command:

user $eix-test-obsolete
No non-matching entries in /etc/portage/package.keywords.
Non-matching entries in /etc/portage/package.accept_keywords:

net-wireless/iwl5000-code ~amd64
app-text/xpdf ~amd64
--

No non-matching entries in /etc/portage/package.mask.
No non-matching entries in /etc/portage/package.unmask.
No non-matching or empty entries in /etc/portage/package.use.
No non-matching or empty entries in /etc/portage/package.env.
No non-matching or empty entries in /etc/portage/package.license.
No non-matching or empty entries in /etc/portage/package.cflags.
The names of all installed packages are in the database.


Redundant in /etc/portage/package.{,accept_}keywords:

... considered as REDUNDANT_IF_WEAKER
[I] www-client/firefox-bin (14.0.1{tbz2}@02/08/12): Firefox Web Browser
[I] www-client/opera-next (12.50.1546{tbz2}@17/08/12): A fast and secure web browser and Internet suite
[N] www-client/seamonkey-bin (2.11): Mozilla Application Suite - web browser, email, HTML editor, IRC
Found 3 matches.


... considered as REDUNDANT_IF_NO_CHANGE
[I] app-laptop/laptop-mode-tools (1.60-r1{tbz2}@18/01/12): Linux kernel laptop_mode user-space utilities
[I] media-sound/ncmpc (0.20{tbz2}@02/04/12): A ncurses client for the Music Player Daemon (MPD)
[I] media-sound/ncmpcpp (0.5.10{tbz2}@02/04/12): An ncurses mpd client, ncmpc clone with some new features, written in C++
[N] media-sound/pms ((~)0.42{tbz2}): Practical Music Search: an open source ncurses client for mpd, written in C++
[I] www-client/opera (12.01.1532{tbz2}@02/08/12): A fast and secure web browser and Internet suite
[N] www-client/seamonkey-bin (2.11): Mozilla Application Suite - web browser, email, HTML editor, IRC
[I] www-plugins/adobe-flash (11.2.202.238{tbz2}@18/08/12): Adobe Flash Player
[I] x11-misc/dclock (2.2.2_p4{tbz2}@02/04/12): Digital clock for the X window system.
[I] x11-misc/xosview (1.9.3{tbz2}@29/04/12): X11 operating system viewer
[I] x11-wm/fvwm (2.6.5{tbz2}[2]@12/05/12): An extremely powerful ICCCM-compliant multiple virtual desktop window manager
[1] "mpd" /var/lib/layman/mpd
[2] "testing" /usr/local/portage

Found 10 matches.


Not installed but in /etc/portage/package.{,accept_}keywords:
[N] media-sound/pms ((~)0.42{tbz2}): Practical Music Search: an open source ncurses client for mpd, written in C++
[N] www-client/seamonkey-bin (2.11): Mozilla Application Suite - web browser, email, HTML editor, IRC
[N] x11-libs/libaosd ((~)0.2.7{tbz2}): An advanced on screen display (OSD) library
[N] x11-plugins/wmtime ((~)1.0_beta2_p10): applet which displays the date and time in a dockable tile
Found 5 matches.

No  redundant  entries in /etc/portage/package.mask
No uninstalled entries in /etc/portage/package.mask
No  redundant  entries in /etc/portage/package.unmask
No uninstalled entries in /etc/portage/package.unmask
Skipping check:  redundant  entries in /etc/portage/package.use
Skipping check: uninstalled entries in /etc/portage/package.use
Skipping check:  redundant  entries in /etc/portage/package.env
Skipping check: uninstalled entries in /etc/portage/package.env
No  redundant  entries in /etc/portage/package.license
No uninstalled entries in /etc/portage/package.license
Skipping check:  redundant  entries in /etc/portage/package.cflags
Skipping check: uninstalled entries in /etc/portage/package.cflags

Installed packages with a version not in the database (or masked):
[D] sys-fs/udev (171-r6{tbz2}@26/05/12 -> ??): Linux dynamic and persistent device naming support (aka userspace devfs)
[D] x11-misc/xmobar (0.13{tbz2}@21/03/12 -> ~0.14): A Minimalistic Text Based Status Bar
Found 2 matches.

Format strings

This is probably the most powerful aspect of eix, but the documentation is hard to understand. eix has a mini-language for specifying more precise queries and output formats than are possible using only the basic options. The format string is specified as the option argument to the --format option. There are basically two major concepts: properties and variables.

  • Properties: Each package has a set of associated properties that can either be printed or used as part of a predicate in a conditional block.
  • Variables: A variable can be any environment variable set in the environment of eix, or any of the variables printed from the output of eix --dump.

Conditional blocks

Conditional blocks take can 3 forms, each with an optional RHS, each of which can be optionally negated:

CODE If-then string comparison
{[!]PROPERTY=RHS}TCODE{}
CODE If-then predicate
{[!]PROPERTY}TCODE{}
CODE If-then-else string comparison
{[!]PROPERTY=RHS}TCODE{else}FCODE{}
CODE If-then-else predicate
{[!]PROPERTY}TCODE{else}FCODE{}
CODE Assignment
{[!]*VARIABLE=RHS}
CODE Assign 1 or empty string
{[!]*VARIABLE}

Tips

Tmux users should disable status line updates

When using tmux with automatic window renaming enabled (that is set -g automatic-rename on has been ran in the tmux configuration file), status line updates should be disabled. Otherwise, every time eix-update is ran the title of the window will be renamed to something like "eix-update: Finished*".

To disable status line updates, run the following command:

root #echo "NOSTATUSLINE=true" >> /etc/eixrc/00-eixrc

See also