summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-10-23 18:50:09 +0000
committerMarius Mauch <genone@gentoo.org>2007-10-23 18:50:09 +0000
commite46af4a33b6c40b63cd98d6d23d2e7c09f369a65 (patch)
tree943004e211ed66979e28a381dc39e40524fb18c1 /pym
parentc1dadc51bafbef49f4c3189fe6afb83d42fd5f95 (diff)
downloadportage-e46af4a33b6c40b63cd98d6d23d2e7c09f369a65.tar.gz
portage-e46af4a33b6c40b63cd98d6d23d2e7c09f369a65.tar.bz2
portage-e46af4a33b6c40b63cd98d6d23d2e7c09f369a65.zip
protect variables specified in PROFILE_ONLY_VARIABLES from being set by the user
svn path=/main/trunk/; revision=8252
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 4bf3ce85a..ac391e645 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1193,6 +1193,12 @@ class config(object):
"this. Do not use them.\n", noiselevel=-1)
sys.exit(1)
+
+ # Don't allow the user to override certain variables in make.conf
+ for key in self.mygcfg.keys():
+ if key in self.configdict["defaults"].get("PROFILE_ONLY_VARIABLES", "").split():
+ del self.mygcfg[key]
+
# 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 == "/"
@@ -1216,7 +1222,13 @@ class config(object):
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 key in myenv.keys():
+ if key in self.configdict["defaults"].get("PROFILE_ONLY_VARIABLES", "").split():
+ del myenv[key]
+
+ self.configlist.append(myenv)
self.configdict["env"]=self.configlist[-1]
# make lookuplist for loading package.*