summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-02 04:56:09 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-02 04:56:09 +0000
commit5705a837e16ba8ada13ed0260ebc8c5ab6717418 (patch)
tree67260552cff98db4bb1eb7a08a2e1a90602832ac /pym
parent94f7f9c4cbfd241235f88b64c9a92aa790592d8a (diff)
downloadportage-5705a837e16ba8ada13ed0260ebc8c5ab6717418.tar.gz
portage-5705a837e16ba8ada13ed0260ebc8c5ab6717418.tar.bz2
portage-5705a837e16ba8ada13ed0260ebc8c5ab6717418.zip
protect variables specified in PROFILE_ONLY_VARIABLES from
being set by the user (trunk r8251:8253, r8255, and r8259) svn path=/main/branches/2.1.2/; revision=8361
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py14
-rw-r--r--pym/portage_const.py2
2 files changed, 14 insertions, 2 deletions
diff --git a/pym/portage.py b/pym/portage.py
index bddc3f257..5e3cb6bd6 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -1301,6 +1301,13 @@ class config:
"this. Do not use them.\n", noiselevel=-1)
sys.exit(1)
+
+ # Don't allow the user to override certain variables in make.conf
+ profile_only_variables = self.configdict["defaults"].get(
+ "PROFILE_ONLY_VARIABLES", "").split()
+ for k in profile_only_variables:
+ self.mygcfg.pop(k, None)
+
# Allow ROOT setting to come from make.conf if it's not overridden
# by the constructor argument (from the calling environment). As a
# special exception for a very common use case, config_root == "/"
@@ -1324,7 +1331,12 @@ class config:
self.configlist.append(self.backupenv) # XXX Why though?
self.configdict["backupenv"]=self.configlist[-1]
- self.configlist.append(os.environ.copy())
+ myenv = os.environ.copy()
+ # Don't allow the user to override certain variables in the env
+ for k in profile_only_variables:
+ myenv.pop(k, None)
+
+ self.configlist.append(myenv)
self.configdict["env"]=self.configlist[-1]
if not local_config:
# Clean up pollution from portage_data so that it doesn't
diff --git a/pym/portage_const.py b/pym/portage_const.py
index f29e7b6b7..c27764e46 100644
--- a/pym/portage_const.py
+++ b/pym/portage_const.py
@@ -51,7 +51,7 @@ REPO_NAME_LOC = "profiles" + "/" + REPO_NAME_FILE
INCREMENTALS = ["USE", "USE_EXPAND", "USE_EXPAND_HIDDEN", "FEATURES",
"ACCEPT_KEYWORDS", "ACCEPT_LICENSE",
"CONFIG_PROTECT_MASK", "CONFIG_PROTECT",
- "PRELINK_PATH", "PRELINK_PATH_MASK"]
+ "PRELINK_PATH", "PRELINK_PATH_MASK", "PROFILE_ONLY_VARIABLES"]
EBUILD_PHASES = ["setup", "unpack", "compile", "test", "install",
"preinst", "postinst", "prerm", "postrm", "other"]