diff options
author | Mike Frysinger <vapier@google.com> | 2015-10-02 16:32:23 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2015-10-02 16:36:28 -0400 |
commit | 9e03753dbe88db6b55a5a0ac634844e42b47dd3b (patch) | |
tree | 64d20c412dc4ca78c2346a73cd58e2e95fd8415d | |
parent | efc3ab08c431357db6c58249ce1a5b4ae190a512 (diff) | |
download | portage-9e03753dbe88db6b55a5a0ac634844e42b47dd3b.tar.gz |
wrapper: pass runtime settings down here
Previously we set these variables in the generated config, but that meant
things did not adapt on the fly to changing behavior. So if you tried to
move the code from one user to another, you'd have to regenerate things.
Instead, just detect it from the active env. This makes things a little
more robust as well.
BUG=24614250
TEST=building packages works w/out errors
Change-Id: I563fef50d9e15c19769b570e33e8688d425521ec
-rwxr-xr-x | wrapper.py | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -11,6 +11,9 @@ detect the right paths and then execute the portage programs. from __future__ import print_function +import getpass +import grp +import multiprocessing import os import sys @@ -20,4 +23,14 @@ portage_path = os.path.join(base_path, 'lib', 'portage') sys.path.insert(0, os.path.join(portage_path, 'pym')) os.environ['PYTHONPATH'] = ':'.join(sys.path) os.environ['EPREFIX'] = '/' + +os.environ.update({ + 'MAKEOPTS': '-j%i' % multiprocessing.cpu_count(), + 'PORTAGE_USER': getpass.getuser(), + 'PORTAGE_GROUP': grp.getgrgid(os.getgid()).gr_name, + 'PORTAGE_ROOT_USER': getpass.getuser(), + 'PORTAGE_INST_UID': str(os.getuid()), + 'PORTAGE_INST_GID': str(os.getgid()), +}) + os.execv(os.path.join(portage_path, 'bin', os.path.basename(__file__)), sys.argv) |