diff options
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 16270461a4..ca72449b75 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -361,6 +361,27 @@ class DataSmart(MutableMapping): | |||
361 | 361 | ||
362 | return data | 362 | return data |
363 | 363 | ||
364 | def expandVarref(self, variable, parents=False): | ||
365 | """Find all references to variable in the data and expand it | ||
366 | in place, optionally descending to parent datastores.""" | ||
367 | |||
368 | if parents: | ||
369 | keys = iter(self) | ||
370 | else: | ||
371 | keys = self.localkeys() | ||
372 | |||
373 | ref = '${%s}' % variable | ||
374 | value = self.getVar(variable, False) | ||
375 | for key in keys: | ||
376 | referrervalue = self.getVar(key, False) | ||
377 | if ref in referrervalue: | ||
378 | self.setVar(key, referrervalue.replace(ref, value)) | ||
379 | |||
380 | def localkeys(self): | ||
381 | for key in self.dict: | ||
382 | if key != '_data': | ||
383 | yield key | ||
384 | |||
364 | def __iter__(self): | 385 | def __iter__(self): |
365 | seen = set() | 386 | seen = set() |
366 | def _keys(d): | 387 | def _keys(d): |