* Add support for PORTAGE_USERNAME and PORTAGE_GRPNAME
authorZac Medico <zmedico@gentoo.org>
Wed, 14 Jul 2010 08:10:02 +0000 (01:10 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 14 Jul 2010 08:10:02 +0000 (01:10 -0700)
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.

bin/isolated-functions.sh
pym/portage/data.py
pym/portage/package/ebuild/config.py

index 6bead30b2d31c380f9fc566526db1e907c64d822..fb6ad64ff5075ded8f2490647bd7106e5be93ac6 100644 (file)
@@ -557,11 +557,11 @@ save_ebuild_env() {
                        PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE PORTAGE_BUILDDIR \
                        PORTAGE_COLORMAP PORTAGE_CONFIGROOT PORTAGE_DEBUG \
                        PORTAGE_DEPCACHEDIR PORTAGE_GID \
-                       PORTAGE_INST_GID \
+                       PORTAGE_GRPNAME PORTAGE_INST_GID \
                        PORTAGE_INST_UID PORTAGE_LOG_FILE PORTAGE_MASTER_PID \
                        PORTAGE_NONFATAL PORTAGE_QUIET \
                        PORTAGE_REPO_NAME PORTAGE_RESTRICT PORTAGE_UPDATE_ENV \
-                       PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR \
+                       PORTAGE_USERNAME PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR \
                        PORTDIR_OVERLAY ${!PORTAGE_SANDBOX_*} PREROOTPATH \
                        PROFILE_PATHS PWORKDIR QA_INTERCEPTORS \
                        RC_DEFAULT_INDENT RC_DOT_PATTERN RC_ENDCOL \
index debf419dd74a40eb85aa7557d230ca3143b55f56..a9ac62ddc233cd3c8cfb9e96282ebf0ba967c837 100644 (file)
@@ -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:
index b0fecae8f169c834a2a5ca24d4b38e8388a56a4a..4e735e35d7cdb9081a095c0b5a7f140f83df5f62 100644 (file)
@@ -179,13 +179,13 @@ class config(object):
                "PORTAGE_BIN_PATH",
                "PORTAGE_BUILDDIR", "PORTAGE_COLORMAP",
                "PORTAGE_CONFIGROOT", "PORTAGE_DEBUG", "PORTAGE_DEPCACHEDIR",
-               "PORTAGE_GID",
+               "PORTAGE_GID", "PORTAGE_GRPNAME",
                "PORTAGE_INST_GID", "PORTAGE_INST_UID",
                "PORTAGE_IUSE",
                "PORTAGE_LOG_FILE", "PORTAGE_MASTER_PID",
                "PORTAGE_PYM_PATH", "PORTAGE_QUIET",
                "PORTAGE_REPO_NAME", "PORTAGE_RESTRICT",
-               "PORTAGE_TMPDIR", "PORTAGE_UPDATE_ENV",
+               "PORTAGE_TMPDIR", "PORTAGE_UPDATE_ENV", "PORTAGE_USERNAME",
                "PORTAGE_VERBOSE", "PORTAGE_WORKDIR_MODE",
                "PORTDIR", "PORTDIR_OVERLAY", "PREROOTPATH", "PROFILE_PATHS",
                "REPLACING_VERSIONS", "REPLACED_BY_VERSION",