aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-07-14 01:10:02 -0700
committerZac Medico <zmedico@gentoo.org>2010-07-14 01:10:02 -0700
commita9360035610dc73c851e9c9b6dfa9b5d42059d8d (patch)
treea3c150ca009965f2b4f5525b8aca714e3c58c44f /pym/portage/data.py
parentUse epytext markup in rewrite_lafile() docstring, and add note about (diff)
downloadportage-a9360035610dc73c851e9c9b6dfa9b5d42059d8d.tar.gz
portage-a9360035610dc73c851e9c9b6dfa9b5d42059d8d.tar.bz2
portage-a9360035610dc73c851e9c9b6dfa9b5d42059d8d.zip
* Add support for PORTAGE_USERNAME and PORTAGE_GRPNAME
environment variables, for use within the chromium-os build environment. * Add PORTAGE_USERNAME and PORTAGE_GRPNAME to the environment whitelist and filter them from the saved environment. Note: In order to support PORTAGE_USERNAME and PORTAGE_GRPNAME settings in make.conf, the associated portage.data attributes may be relocated to the config class in the future.
Diffstat (limited to 'pym/portage/data.py')
-rw-r--r--pym/portage/data.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/pym/portage/data.py b/pym/portage/data.py
index debf419dd..a9ac62ddc 100644
--- a/pym/portage/data.py
+++ b/pym/portage/data.py
@@ -74,10 +74,14 @@ try:
except KeyError:
pass
+# Allow the overriding of the user used for 'userpriv' and 'userfetch'
+_portage_uname = os.environ.get('PORTAGE_USERNAME', 'portage')
+_portage_grpname = os.environ.get('PORTAGE_GRPNAME', 'portage')
+
#Discover the uid and gid of the portage user/group
try:
- portage_uid=pwd.getpwnam("portage")[2]
- portage_gid=grp.getgrnam("portage")[2]
+ portage_uid = pwd.getpwnam(_portage_uname)[2]
+ portage_gid = grp.getgrnam(_portage_grpname)[2]
if secpass < 1 and portage_gid in os.getgroups():
secpass=1
except KeyError:
@@ -108,7 +112,7 @@ else:
# grp.getgrall() since it is known to trigger spurious
# SIGPIPE problems with nss_ldap.
mystatus, myoutput = \
- portage.subprocess_getstatusoutput("id -G %s" % 'portage')
+ portage.subprocess_getstatusoutput("id -G %s" % _portage_uname)
if mystatus == os.EX_OK:
for x in myoutput.split():
try: