Bug #221755 - Enable variable substitution in make.defaults to work accross
authorZac Medico <zmedico@gentoo.org>
Sun, 11 May 2008 23:22:43 +0000 (23:22 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 11 May 2008 23:22:43 +0000 (23:22 -0000)
multiple files instead of being confined to a single file. This allows
profiles to create incremental-like behavior with non-incremental variables
when desired.

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

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

index 139fa57e08b6800d359b0d19e49351ed2a048202..080093320e2a649b6e507bfee119954ab9f0d281 100644 (file)
@@ -1280,8 +1280,13 @@ class config(object):
                        self.make_defaults_use = []
                        self.mygcfg = {}
                        if self.profiles:
-                               mygcfg_dlists = [getconfig(os.path.join(x, "make.defaults")) \
-                                       for x in self.profiles]
+                               mygcfg_dlists = []
+                               var_map = {}
+                               for x in self.profiles:
+                                       var_map = getconfig(os.path.join(x, "make.defaults"),
+                                               expand=var_map)
+                                       mygcfg_dlists.append(var_map)
+
                                for cfg in mygcfg_dlists:
                                        if cfg:
                                                self.make_defaults_use.append(cfg.get("USE", ""))
index 87332f42e821acd22c6ba9f2b339b60a05140d63..c358341a2bb6f81818fb08822217aa91699d4e3c 100644 (file)
@@ -320,7 +320,13 @@ class _tolerant_shlex(shlex.shlex):
                        return (newfile, StringIO.StringIO())
 
 def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
-       mykeys={}
+       if isinstance(expand, dict):
+               # Some existing variable definitions have been
+               # passed in, for use in substitutions.
+               mykeys = expand.copy()
+               expand = True
+       else:
+               mykeys = {}
        try:
                f=open(mycfg,'r')
        except IOError, e: