Gentoo Archives: gentoo-user

From: "Florian Gamböck" <ml@×××××.de>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Dynamically change PORTAGE_TMPDIR via bashrc?
Date: Sat, 26 Sep 2015 08:08:42
Message-Id: 20150926080824.GA4550@lira
1 (This is my third E-Mail and I hope this time it gets through. Sorry to the
2 sysadmins if I caused you trouble with my rejected mails, I'm still trying to
3 get used to Mutt.)
4
5 Greetings,
6
7 let me quickly explain my setup: I use BTRFS snapshots and chroot to create
8 binaries of upgradeable packages with emerge. When I have some spare time, I
9 just need to install these binaries on my "real" system. While compiling, I
10 set PORTAGE_TMPDIR to a tmpfs mounted directory. When installing on my real
11 system afterwards, I set PORTAGE_TMPDIR to a "normal" directory on my hard
12 drive, since I won't gain anything from extracting a package to RAM, just to
13 immediately copy the contents back to the hard drive.
14
15 Now here is the tricky part: Since I do the compiling on temporary snapshots,
16 I tend to kill emerge and delete the snapshot, when I'm in a hurry and have to
17 shutdown my workstation. (PKGDIR of course is bind mounted to outside the
18 snapshot, so I won't lose the already finished packages.) When I later
19 "resume" my upgrade, there are several binary packages and several others that
20 still need to be compiled. With PORTAGE_TMPDIR still set to tmpfs, my RAM gets
21 cluttered with already compiled files from the binaries that may as well stay
22 on the hard disk.
23
24 Now, instead of simply changing my workflow (like for example not deleting the
25 snapshot prematurely in the first place ...) I want to have some fun and
26 wondered if there might be a possibility to change PORTAGE_TMPDIR dynamically,
27 based on wether I want to install a tbz2 or compile sources.
28
29 So far I've tried in package.env: "*/* merge_type.${MERGE_TYPE}.conf". But
30 this just gives me errors like "merge_type..conf not found", so obviously I
31 can't use such variables here. I guess, those tricks can just be played in
32 /etc/portage/bashrc. But when I try to change PORTAGE_TMPDIR in bashrc
33 (EBUILD_PHASE doesn't matter, problem occurs regardless), I always get errors
34 like "PORTAGE_TMPDIR is a read-only variable".
35
36 Now, before I try some crazy stunts like bind-mounting $D and $ED on "preinst"
37 and cleaning up in "postinst", I wanted to know if some of you guys did
38 similar experiments and/or have some advice that you could share with me.
39
40 Regards,
41 --Flo

Replies

Subject Author
[gentoo-user] Re: Dynamically change PORTAGE_TMPDIR via bashrc? James <wireless@×××××××××××.com>