Thursday, December 2, 2010

How to use USE in Gentoo and dependencies

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

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 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

random 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/no-multilib
[10] selinux/2007.0/amd64
[11] selinux/2007.0/amd64/hardened
[12] selinux/v2refpolicy/amd64
[13] selinux/v2refpolicy/amd64/desktop
[14] selinux/v2refpolicy/amd64/developer
[15] selinux/v2refpolicy/amd64/hardened
[16] 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 directory /etc/portage/profile if it is not there already and add your Use flags to package.use Here is mine so far from the tuxmobl host I am currently building.

Last login: Thu Dec 2 00:18:11 EST 2010 on tty1
tuxmobl ~ # cat /etc/portage/profile/package.use
## This is the place to install package specific USE flags which avoids
## setting flags globally Set global flags in /etc/make.conf
## Global flags are set by the profile too
# 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
#This one will go away soon but as long as it shows a dep use helpful support
sys-apps/hal laptop
sys-power/pm-utils ntp

At present I can ssh in from the random host so progress ;-) and the pcmcia card is working (I also noticed the Intel driver loading as e100 Hmmm I may have to try that port and see if it works in linux.)

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