summaryrefslogtreecommitdiffstats
path: root/pym/portage
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-05-11 23:22:43 +0000
committerZac Medico <zmedico@gentoo.org>2008-05-11 23:22:43 +0000
commit14035bf2e4aee4047dcf3214ce947545f102f038 (patch)
tree1d97ce2e5bce63dcb854043ad2139f50284da74d /pym/portage
parentdf5745f410c6e8f21d40133724a6748ba76afab5 (diff)
downloadportage-14035bf2e4aee4047dcf3214ce947545f102f038.tar.gz
portage-14035bf2e4aee4047dcf3214ce947545f102f038.tar.bz2
portage-14035bf2e4aee4047dcf3214ce947545f102f038.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. svn path=/main/trunk/; revision=10293
Diffstat (limited to 'pym/portage')
-rw-r--r--pym/portage/__init__.py9
-rw-r--r--pym/portage/util.py8
2 files changed, 14 insertions, 3 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 139fa57e0..080093320 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -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", ""))
diff --git a/pym/portage/util.py b/pym/portage/util.py
index 87332f42e..c358341a2 100644
--- a/pym/portage/util.py
+++ b/pym/portage/util.py
@@ -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: