diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-07 12:25:24 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-07 12:25:24 +0000 |
commit | 7aacc310b58f4347e3763ff04efdbc77f76c7d85 (patch) | |
tree | 4f1476b321653e6d1fbcab03ce2f4332c412e7ee /bitbake/lib | |
parent | c354955d26d34316b3dbf0e2175526838401f3b6 (diff) | |
download | openembedded-core-7aacc310b58f4347e3763ff04efdbc77f76c7d85.tar.gz openembedded-core-7aacc310b58f4347e3763ff04efdbc77f76c7d85.tar.bz2 openembedded-core-7aacc310b58f4347e3763ff04efdbc77f76c7d85.zip |
bitbake/data_smart: Refactor _append/_prepend code to remove duplication
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 9594feebf3..c8cd8f8739 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -154,42 +154,29 @@ class DataSmart: bb.msg.note(1, bb.msg.domain.Data, "Untracked delVar") # now on to the appends and prepends - if "_append" in self._special_values: - appends = self._special_values["_append"] or [] - for append in appends: - keep = [] - for (a, o) in self.getVarFlag(append, "_append") or []: - if o and not o in overrides: - keep.append((a ,o)) - continue - - sval = self.getVar(append, False) or "" - sval += a - self.setVar(append, sval) - # We save overrides that may be applied at some later stage - if keep: - self.setVarFlag(append, "_append", keep) - else: - self.delVarFlag(append, "_append") - - if "_prepend" in self._special_values: - prepends = self._special_values["_prepend"] or [] - for prepend in prepends: - keep = [] - for (a, o) in self.getVarFlag(prepend, "_prepend") or []: - if o and not o in overrides: - keep.append((a ,o)) - continue - - sval = a + (self.getVar(prepend, False) or "") - self.setVar(prepend, sval) - - # We save overrides that may be applied at some later stage - if keep: - self.setVarFlag(prepend, "_prepend", keep) - else: - self.delVarFlag(prepend, "_prepend") - + for op in __setvar_keyword__: + if op in self._special_values: + appends = self._special_values[op] or [] + for append in appends: + keep = [] + for (a, o) in self.getVarFlag(append, op) or []: + if o and not o in overrides: + keep.append((a ,o)) + continue + + if op is "_append": + sval = self.getVar(append, False) or "" + sval += a + self.setVar(append, sval) + elif op is "_prepend": + sval = a + (self.getVar(append, False) or "") + self.setVar(append, sval) + + # We save overrides that may be applied at some later stage + if keep: + self.setVarFlag(append, op, keep) + else: + self.delVarFlag(append, op) def initVar(self, var): self.expand_cache = {} |