summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-05-11 23:45:52 +0000
committerZac Medico <zmedico@gentoo.org>2008-05-11 23:45:52 +0000
commitc3b4a63aa69d296cab47ca18e58331d3e7852fc1 (patch)
tree262bfa7db71de828516f589de20f8ea2cc004cd9
parent14035bf2e4aee4047dcf3214ce947545f102f038 (diff)
downloadportage-c3b4a63aa69d296cab47ca18e58331d3e7852fc1.tar.gz
portage-c3b4a63aa69d296cab47ca18e58331d3e7852fc1.tar.bz2
portage-c3b4a63aa69d296cab47ca18e58331d3e7852fc1.zip
Fix the variable subsitution code from bug #221755 so that variable
assignments from earlier files don't leak into variable assignments from later files (except through substitution). svn path=/main/trunk/; revision=10295
-rw-r--r--pym/portage/__init__.py4
-rw-r--r--pym/portage/util.py8
2 files changed, 8 insertions, 4 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 080093320..13462b97b 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1282,9 +1282,11 @@ class config(object):
if self.profiles:
mygcfg_dlists = []
var_map = {}
+ expand_map = {}
for x in self.profiles:
var_map = getconfig(os.path.join(x, "make.defaults"),
- expand=var_map)
+ expand=expand_map)
+ expand_map.update(var_map)
mygcfg_dlists.append(var_map)
for cfg in mygcfg_dlists:
diff --git a/pym/portage/util.py b/pym/portage/util.py
index c358341a2..17c066bc8 100644
--- a/pym/portage/util.py
+++ b/pym/portage/util.py
@@ -323,10 +323,11 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
if isinstance(expand, dict):
# Some existing variable definitions have been
# passed in, for use in substitutions.
- mykeys = expand.copy()
+ expand_map = expand.copy()
expand = True
else:
- mykeys = {}
+ expand_map = {}
+ mykeys = {}
try:
f=open(mycfg,'r')
except IOError, e:
@@ -385,7 +386,8 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
else:
return mykeys
if expand:
- mykeys[key] = varexpand(val, mykeys)
+ mykeys[key] = varexpand(val, expand_map)
+ expand_map[key] = mykeys[key]
else:
mykeys[key] = val
except SystemExit, e: