Gentoo — A FHS following FHS violator

Long time no blog, so I thought Id complain about something that Ive had issues with for some time. Gentoo really tries to be FHS compliant. It is fairly successful with that for the most part. One part of the spec that Gentoo, unfortunately, breaks is the location of the portage tree. To my (VERY limited) knowledge, the reason for continuing the broken tradition is exactly that — tradition. The location has become more or less ingrained into the minds of the users and the developers.

Change is something that we need to deal with. I understand that changes like this are difficult, especially for those of us who have been using the system for a long time.

Fortunately, for those of us who are brave enough, relocating portage to a more compliant (or sane as your prefer) location is not so complicated.

A quick perusal of /etc/make.conf.example should point out a certain variable of interest: PORTDIR. Simply setting this variable in /etc/make.conf allows us to relocate the portage tree to a location of our choice. I personally, prefer /var/portage. Though this directory is not specified by FHS, it is more compliant, as it has variable data that has system-wide implications. In order to be nice to the servers, you should move the portage directory to its new home.

Next you need to update the location of your profile.  This is simple as well. It is just replacing the symlink with the updated path (hint: you can view the old path of the profile via ls -l /etc/make.profile).

Moving on, we need to address the distfiles location.  This directory holds the distfiles for the packages that you install.  We need to  relocate this, otherwise, portage will just recreate this location.  Again, a quick perusal over /etc/make.conf.example should show you an interesting variable: DISTDIR.  Setting it to the value from the example is sufficient (${PORTDIR}/distfiles).

Another such directory that we need to worry about is the packages directory.  This defaults to /usr/portage/packages.  As in the previous cases, adding a simple variable to /etc/make.conf makes portage and FHS all happy.  In this case, the variable is PKGDIR, and just like distdir, the value from the example file is sufficient, (${PORTDIR}/packages).

If you try to actually use emerge now, you will notice that it is quite a bit slower. This is due to the fact that the metadata is location specific. The metadata is stored in /var/cache/edb/dep/. We can safely remove the existing metadata to reclaim the space. After this, you should run emerge –metadata. This should restore the metadata information for the repository, resulting in portage’s speed being restored.

For the interested, the relevant parts of the FHS Specs (v2.3) are Chapter 4, Section 1 and Chapter 5, Section 1.

~ by compnerd on March 3, 2007.

Leave a Reply

You must be logged in to post a comment.