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.




About
13 Comments
Thanks! It is just what I need.
Thanks. I have exactly the same problem with libreoffice. Appreciate the tip – this is the first I’ve heard of per-package settings.
Great! I always had to umount /var/tmp/portage to compile Libreoffice. =D
Cool! Thanks for sharing … Portage really needs some wiki/docs site … Though Zac will always say that everything’s in the manpages for Portage.
Yea, the man page for this one was hard to figure out. Well, not hard but I had to read package.env and env/ sections multiple times to see what it was really meaning.
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.
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.
www-client/chromium is another one
Well, yes. I never intended to have an exhaustive list.
Depends on your tmpfs size, etc, anyway.
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?
Just about everything, the only thing that I know that doesn’t work is FEATURES=buildpkg. If you run across anything, please open a bug report.
no more hand fapping distcc out of make.conf
awesome!
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.