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.

12 Comments

  1. Szymek says:

    Thanks! It is just what I need.

  2. nitro322 says:

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

  3. Bruno Yporti says:

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

  4. Pavel says:

    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. Cynyr says:

    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. Nan says:

    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. Jack says:

    www-client/chromium is another one

  8. avx says:

    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. Aleister says:

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

Leave a Reply