Add support for PORTAGE_USERNAME and PORTAGE_GROUPNAME environment
authorZac Medico <zmedico@gmail.com>
Wed, 24 Mar 2010 03:03:51 +0000 (20:03 -0700)
committerZac Medico <zmedico@gmail.com>
Wed, 24 Mar 2010 03:03:51 +0000 (20:03 -0700)
variables. Thanks to Alec Warner <antarus@g.o> for submitting the
initial PORTAGE_USERNAME patch from chromiumos-overlay.

pym/portage/const.py
pym/portage/data.py

index 95ea76cb90a1910232097e3cf333b7caf76a486b..b017bcf753f57bc35234616de5f3a39de573b4f5 100644 (file)
@@ -66,6 +66,9 @@ BASH_BINARY              = "/bin/bash"
 MOVE_BINARY              = "/bin/mv"
 PRELINK_BINARY           = "/usr/sbin/prelink"
 
+PORTAGE_GROUPNAME        = os.environ.get("PORTAGE_GROUPNAME", 'portage')
+PORTAGE_USERNAME         = os.environ.get("PORTAGE_USERNAME", 'portage')
+
 INVALID_ENV_FILE         = "/etc/spork/is/not/valid/profile.env"
 REPO_NAME_FILE           = "repo_name"
 REPO_NAME_LOC            = "profiles" + "/" + REPO_NAME_FILE
index c82a8b625387eeff11ab0b213476eb318a948833..6322a6ab90f80f89bef1ce9e48408f20ca0ed7ab 100644 (file)
@@ -4,6 +4,7 @@
 # $Id$
 
 import os, sys, pwd, grp, platform
+from portage.const import PORTAGE_GROUPNAME, PORTAGE_USERNAME
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
@@ -77,8 +78,8 @@ except KeyError:
 
 #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_USERNAME)[2]
+       portage_gid = grp.getgrnam(PORTAGE_GROUPNAME)[2]
        if secpass < 1 and portage_gid in os.getgroups():
                secpass=1
 except KeyError: