diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-12-17 12:15:48 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:52 +0000 |
commit | d951aa40a04caec7303c37641e4ea1f9c47e8893 (patch) | |
tree | fa1aba21b3d3a1f80992aaabc4c3905d3b9e0179 /bitbake/lib/bb/data_smart.py | |
parent | 717f13d63cb904ce48533d3f1b2b00d278741f6f (diff) | |
download | openembedded-core-d951aa40a04caec7303c37641e4ea1f9c47e8893.tar.gz openembedded-core-d951aa40a04caec7303c37641e4ea1f9c47e8893.tar.bz2 openembedded-core-d951aa40a04caec7303c37641e4ea1f9c47e8893.tar.xz openembedded-core-d951aa40a04caec7303c37641e4ea1f9c47e8893.zip |
Move LAYERDIR expansion hack into DataSmart
(Bitbake rev: 40778a6e9e82c7ea4673a74fc19574430fa63e8d)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/data_smart.py')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 16270461a..ca72449b7 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -361,6 +361,27 @@ class DataSmart(MutableMapping): return data + def expandVarref(self, variable, parents=False): + """Find all references to variable in the data and expand it + in place, optionally descending to parent datastores.""" + + if parents: + keys = iter(self) + else: + keys = self.localkeys() + + ref = '${%s}' % variable + value = self.getVar(variable, False) + for key in keys: + referrervalue = self.getVar(key, False) + if ref in referrervalue: + self.setVar(key, referrervalue.replace(ref, value)) + + def localkeys(self): + for key in self.dict: + if key != '_data': + yield key + def __iter__(self): seen = set() def _keys(d): |