diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-05-11 23:24:08 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-05-11 23:24:08 +0000 |
commit | 9513888e4dfdcb5cb2892f8490ec93f6e2518b65 (patch) | |
tree | 8b23dfd447078acb9f9cee55242de0c9a69e6b33 | |
parent | f104c9f8ac201ce5276b6193a702a26e00437698 (diff) | |
download | portage-9513888e4dfdcb5cb2892f8490ec93f6e2518b65.tar.gz portage-9513888e4dfdcb5cb2892f8490ec93f6e2518b65.tar.bz2 portage-9513888e4dfdcb5cb2892f8490ec93f6e2518b65.zip |
Bug #221755 - Enable variable substitution in make.defaults to work accross
multiple files instead of being confined to a single file. This allows
profiles to create incremental-like behavior with non-incremental variables
when desired. (trunk r10293)
svn path=/main/branches/2.1.2/; revision=10294
-rw-r--r-- | pym/portage.py | 9 | ||||
-rw-r--r-- | pym/portage_util.py | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/pym/portage.py b/pym/portage.py index 2ee750e52..a48f23e3d 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1440,8 +1440,13 @@ class config: 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", "")) diff --git a/pym/portage_util.py b/pym/portage_util.py index eb54076d4..e75e0cb15 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -306,7 +306,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: |