Gentoo: per-package PORTAGE_TMPDIR settings

I don’t know how many people know about per-package environment variables in portage since 2.1.9 or so. (ref: bug 44796) It is a worthwhile enhancement to know about, regardless. Like most people, I have my PORTAGE_TMPDIR on tmpfs to speed up compilation times and reduce I/O usage. My 2G tmpfs mounted on /var/tmp/portage is large enough for almost all packages, even multiple jobs at once, however, not all. Solution:

% cat /etc/portage/package.env
app-office/libreoffice notmpfs.conf
% cat /etc/portage/env/notmpfs.conf
PORTAGE_TMPDIR=”/var/tmp/notmpfs”

(More info available in the portage man page)

Now, when I find my next package that needs notmpfs, it is as easy as: echo "cat-egory/pkg notmpfs.conf" >> /etc/portage/package.env which is much easier than bashrc hacks or something else insane that I have seen. Of course you can extend that to most make.conf settings, hope that helps someone.

Leave a comment ?

13 Comments.

  1. Thanks! It is just what I need.

  2. Thanks. I have exactly the same problem with libreoffice. Appreciate the tip – this is the first I’ve heard of per-package settings.

  3. Great! I always had to umount /var/tmp/portage to compile Libreoffice. =D

  4. Cool! Thanks for sharing … Portage really needs some wiki/docs site … Though Zac will always say that everything’s in the manpages for Portage.

  5. perhaps http://en.gentoo-wiki.com/wiki/Portage_TMPDIR_on_tmpfs should get an update for this much cleaner method.

    Maybe I’ll give it a shot later.

  6. Very interesting. In the past I had tried to set PORTAGE_TMPDIR in /etc/portage/env/cat-egory/package but emerge complained about PORTAGE_TMPDIR being read-only so I didn’t think it was possible. Thanks for the tip.

  7. www-client/chromium is another one

  8. So, to get this right, I *can* use everything here, which I normally set as defaults in make.conf? I.e. set C/LDFLAGS, USE, FEATURES, ACCEPT_KEYWORDS, LICENSE, etc?

  9. no more hand fapping distcc out of make.conf :D awesome!

  10. Good looking out! Save me on an old machine firefox compile… 4gigs to compile firefox! What happened to a lighter faster browser?!? Thank bro, I can see some mad uses for the per-package variable.

Leave a Reply