Fix the variable subsitution code from bug #221755 so that variable
authorZac Medico <zmedico@gentoo.org>
Sun, 11 May 2008 23:45:52 +0000 (23:45 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 11 May 2008 23:45:52 +0000 (23:45 -0000)
assignments from earlier files don't leak into variable assignments
from later files (except through substitution).

svn path=/main/trunk/; revision=10295

pym/portage/__init__.py
pym/portage/util.py

index 080093320e2a649b6e507bfee119954ab9f0d281..13462b97b30625f593461a7d21d829e8b221fba7 100644 (file)
@@ -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:
index c358341a2bb6f81818fb08822217aa91699d4e3c..17c066bc831864a1f05c7d5fba1793c1fd662abf 100644 (file)
@@ -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: