Sunday, August 28, 2011

Rewrite: How to use USE and Gentoo dependencies support

Good morning ladies and Gentoo-men. For today's mental exercise you are instructed to prove the Pythagorean Theorom

Editors Note: This is a rewrite to address some things in the previous version and make it more informative.

At one of the last LUG meetings I attended; a discussion with one user of Slackware turned up the topic of dependencies. In Slackware AFAIK since I have not used it in several years you get what Patrick Volkerding gives you.
I have not seen a way to do this with Debian or other distributions and it is one of the ways Gentoo is unique.

In Gentoo dependencies are pulled in by USE flags in several ways. In /etc/make.conf they are enabled on a global basis. This means when they are defined here every package on the box that can support that flag will be compiled with support in your application. Let's take some real world examples.

The pam USE flag adds support for pluggable authentication modules and I suspect that it is enabled on every Gentoo profile. ipv6 since it is all the rage and brings many new features to networking as well. However there have been some issues with ipv6 and my router (the communications point for the home network) does not support it. So making use of the global properties as in the following line removes support system wide without having to do it on a package by package basis which is currently done by hand. Instead just add this to /etc/make.conf


Initial system flags on Gentoo installations are determined by the system profile which is set through 'eselect' To view or set your profile is as easy as running the following command in your shell. Here I have selected the AMD64 Gnome desktop profile as is indicated with the *

localhost david # eselect profile list
Available profile symlink targets:
[1] default/linux/amd64/10.0
[2] default/linux/amd64/10.0/desktop
[3] default/linux/amd64/10.0/desktop/gnome *
[4] default/linux/amd64/10.0/desktop/kde
[5] default/linux/amd64/10.0/developer
[6] default/linux/amd64/10.0/no-multilib
[7] default/linux/amd64/10.0/server
[8] hardened/linux/amd64
[9] hardened/linux/amd64/selinux
[10] hardened/linux/amd64/no-multilib
[11] hardened/linux/amd64/no-multilib/selinux
[12] selinux/2007.0/amd64
[13] selinux/2007.0/amd64/hardened
[14] selinux/v2refpolicy/amd64
[15] selinux/v2refpolicy/amd64/desktop
[16] selinux/v2refpolicy/amd64/developer
[17] selinux/v2refpolicy/amd64/hardened
[18] selinux/v2refpolicy/amd64/server

Changing your profile greatly affects the packages installed on your system and should be done likely only once.

In order to tailor a system and only install the applications you want you can specify USE flags on a per package basis
Create the file /etc/portage/package.use if it is not there already and add your per-package Use flags there. Here is a short listing from mine on a new build adding gallium, llvm, gles support for mesa. As well as the ones I set for some mail programs, X etc.

##Global flags are set by the profile too
localhost david # cat /etc/portage/package.use
sys-devel/llvm llvm-gcc udis86
media-libs/mesa gles
sys-devel/gcc lto objc objc++ objc-gc
dev-cvs/git emacs cvs subversion gtk
dev-libs/udis86 pic
sys-libs/pam audit
app-portage/eix sqlite tools optimization
# For courier-imap support
net-mail/courier-imap -ipv6 gnutls
net-libs/courier-authlib vpopmail
# To satisfy lxde-meta
x11-libs/cairo X
x11-libs/pango X
sys-fs/udev extras
# add gnome-keyring support to gnome-base/gvfs
gnome-base/gvfs gnome-keyring
# X for freetype
media-libs/freetype X
#and I add what I want to satisfy dependencies
gnome-base/gconf policykit
sys-auth/consolekit policykit

At present I can ssh in from the random host so progress ;-) Installing via ethernet but plan to wireless the new build soon.

As to the topic by manipulating the file package.use and editing the USE line in /etc/make.conf you can tailor your Gentoo install. Running emerge -vp world or system will show you how dependencies are set on your system now and you can tailor your system and achieve a more stable host since by eliminating unneeded dependencies one can eliminate bugs that might be pulled in by them.

You may wish to run eselect profile set $ where $ is the value your system supports and see what emerge -vp world will show on different profiles but remember where you started so you can set it back if you don't wish to change anything. Proper building steps would include first choosing a profile then editing USE in /etc/make.conf and package.use to achieve fine grained control over dependencies on Gentoo linux.

No comments:

Post a Comment