diff options
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index dfa9afe461..3fb88a93df 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -38,8 +38,8 @@ from bb.COW import COWDictBase | |||
38 | 38 | ||
39 | logger = logging.getLogger("BitBake.Data") | 39 | logger = logging.getLogger("BitBake.Data") |
40 | 40 | ||
41 | __setvar_keyword__ = ["_append", "_prepend"] | 41 | __setvar_keyword__ = ["_append", "_prepend", "_remove"] |
42 | __setvar_regexp__ = re.compile('(?P<base>.*?)(?P<keyword>_append|_prepend)(_(?P<add>.*))?$') | 42 | __setvar_regexp__ = re.compile('(?P<base>.*?)(?P<keyword>_append|_prepend|_remove)(_(?P<add>.*))?$') |
43 | __expand_var_regexp__ = re.compile(r"\${[^{}]+}") | 43 | __expand_var_regexp__ = re.compile(r"\${[^{}]+}") |
44 | __expand_python_regexp__ = re.compile(r"\${@.+?}") | 44 | __expand_python_regexp__ = re.compile(r"\${@.+?}") |
45 | 45 | ||
@@ -357,7 +357,8 @@ class DataSmart(MutableMapping): | |||
357 | 357 | ||
358 | # | 358 | # |
359 | # First we apply all overrides | 359 | # First we apply all overrides |
360 | # Then we will handle _append and _prepend | 360 | # Then we will handle _append and _prepend and store the _remove |
361 | # information for later. | ||
361 | # | 362 | # |
362 | 363 | ||
363 | # We only want to report finalization once per variable overridden. | 364 | # We only want to report finalization once per variable overridden. |
@@ -392,7 +393,7 @@ class DataSmart(MutableMapping): | |||
392 | except Exception: | 393 | except Exception: |
393 | logger.info("Untracked delVar") | 394 | logger.info("Untracked delVar") |
394 | 395 | ||
395 | # now on to the appends and prepends | 396 | # now on to the appends and prepends, and stashing the removes |
396 | for op in __setvar_keyword__: | 397 | for op in __setvar_keyword__: |
397 | if op in self._special_values: | 398 | if op in self._special_values: |
398 | appends = self._special_values[op] or [] | 399 | appends = self._special_values[op] or [] |
@@ -415,6 +416,10 @@ class DataSmart(MutableMapping): | |||
415 | elif op == "_prepend": | 416 | elif op == "_prepend": |
416 | sval = a + (self.getVar(append, False) or "") | 417 | sval = a + (self.getVar(append, False) or "") |
417 | self.setVar(append, sval) | 418 | self.setVar(append, sval) |
419 | elif op == "_remove": | ||
420 | removes = self.getVarFlag(append, "_removeactive", False) or [] | ||
421 | removes.append(a) | ||
422 | self.setVarFlag(append, "_removeactive", removes, ignore=True) | ||
418 | 423 | ||
419 | # We save overrides that may be applied at some later stage | 424 | # We save overrides that may be applied at some later stage |
420 | if keep: | 425 | if keep: |
@@ -519,7 +524,7 @@ class DataSmart(MutableMapping): | |||
519 | self.varhistory.record(**loginfo) | 524 | self.varhistory.record(**loginfo) |
520 | self.setVar(newkey, val, ignore=True) | 525 | self.setVar(newkey, val, ignore=True) |
521 | 526 | ||
522 | for i in ('_append', '_prepend'): | 527 | for i in (__setvar_keyword__): |
523 | src = self.getVarFlag(key, i) | 528 | src = self.getVarFlag(key, i) |
524 | if src is None: | 529 | if src is None: |
525 | continue | 530 | continue |
@@ -583,6 +588,14 @@ class DataSmart(MutableMapping): | |||
583 | value = copy.copy(local_var["defaultval"]) | 588 | value = copy.copy(local_var["defaultval"]) |
584 | if expand and value: | 589 | if expand and value: |
585 | value = self.expand(value, None) | 590 | value = self.expand(value, None) |
591 | if value and flag == "_content" and local_var and "_removeactive" in local_var: | ||
592 | for i in local_var["_removeactive"]: | ||
593 | if " " + i + " " in value: | ||
594 | value = value.replace(" " + i + " ", " ") | ||
595 | if value.startswith(i + " "): | ||
596 | value = value[len(i + " "):] | ||
597 | if value.endswith(" " + i): | ||
598 | value = value[:-len(" " + i)] | ||
586 | return value | 599 | return value |
587 | 600 | ||
588 | def delVarFlag(self, var, flag, **loginfo): | 601 | def delVarFlag(self, var, flag, **loginfo): |