Gentoo, list installed packages with USE flags

November 15, 2009
Gentoo

Saving of operating system state could be very important sometimes. If you ever faced with a problem that you needed to find out which updated component caused a strange behaviour of some program then you know what I mean. Over the last few years I've been using my own backup program that creates reserve copies from different data sources. It also stores the system state as a set of config files and reports. History of changes is tracked by a version control system so each change is described by a system administrator. My program is not ready for publication yet since it should be improved in order to be used by other people. But I will share some of its components periodically. Today I'll tell you about report that contains list of all packages installed on Gentoo GNU/Linux including their USE flags.

Many of Gentoo users probably know the command for listing all installed packages. It could be done with equery utility from gentoolkit package.

# equery list

...
[I--] [  ] x11-libs/Xaw3d-1.5-r1 (0)
[I--] [  ] x11-libs/cairo-1.8.8 (0)
[I--] [  ] x11-libs/gtk+-2.16.6 (2)
[I--] [  ] x11-libs/libICE-1.0.5 (0)
[I--] [  ] x11-libs/libSM-1.1.1 (0)
[I--] [  ] x11-libs/libX11-1.2.2 (0)
[I--] [  ] x11-libs/libXScrnSaver-1.1.3 (0)
...

Its output is pretty useful but isn't often sufficient for our needs since a package state depends on USE flags. To list them all for each package you can use my script.

# list-gentoo-packages.sh

...
x11-libs/Xaw3d-1.5-r1
x11-libs/cairo-1.8.8 +X +opengl +svg -cleartype -debug -directfb -doc -glitz -xcb
x11-libs/gtk+-2.16.6 +cups +jpeg +tiff -debug -doc -jpeg2k -test -vim-syntax -xinerama
x11-libs/libICE-1.0.5 +ipv6 -debug
x11-libs/libSM-1.1.1 +ipv6 +uuid -debug -elibc_FreeBSD
x11-libs/libX11-1.2.2 +ipv6 +xcb -debug
x11-libs/libXScrnSaver-1.1.3 -debug
...

This is done by direct analysis of Portage database, that is located at /var/db/pkg/, and IUSE files for each package. It could be useful to compare reports generated before and after system update. This helps to reveal trivial mistakes. I hope it will be helpful for you.

Download list-gentoo-packages.sh, version 0.2.

Nikita Melnichenko.

Comments

Piotr
10.02.2010, 15:55

Thanks, I looked for something like that.

20.06.2010, 22:47

Thanks, that will really help!

20.06.2010, 22:53

Thanks, great job!

Add comment

Text will be published as is. No HTML allowed. key