From e46af4a33b6c40b63cd98d6d23d2e7c09f369a65 Mon Sep 17 00:00:00 2001 From: Marius Mauch Date: Tue, 23 Oct 2007 18:50:09 +0000 Subject: [PATCH] protect variables specified in PROFILE_ONLY_VARIABLES from being set by the user svn path=/main/trunk/; revision=8252 --- pym/portage/__init__.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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.* -- 2.26.2