mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
bitbake/data_smart: Refactor _append/_prepend code to remove duplication
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
@@ -154,42 +154,29 @@ class DataSmart:
|
|||||||
bb.msg.note(1, bb.msg.domain.Data, "Untracked delVar")
|
bb.msg.note(1, bb.msg.domain.Data, "Untracked delVar")
|
||||||
|
|
||||||
# now on to the appends and prepends
|
# now on to the appends and prepends
|
||||||
if "_append" in self._special_values:
|
for op in __setvar_keyword__:
|
||||||
appends = self._special_values["_append"] or []
|
if op in self._special_values:
|
||||||
for append in appends:
|
appends = self._special_values[op] or []
|
||||||
keep = []
|
for append in appends:
|
||||||
for (a, o) in self.getVarFlag(append, "_append") or []:
|
keep = []
|
||||||
if o and not o in overrides:
|
for (a, o) in self.getVarFlag(append, op) or []:
|
||||||
keep.append((a ,o))
|
if o and not o in overrides:
|
||||||
continue
|
keep.append((a ,o))
|
||||||
|
continue
|
||||||
|
|
||||||
sval = self.getVar(append, False) or ""
|
if op is "_append":
|
||||||
sval += a
|
sval = self.getVar(append, False) or ""
|
||||||
self.setVar(append, sval)
|
sval += a
|
||||||
# We save overrides that may be applied at some later stage
|
self.setVar(append, sval)
|
||||||
if keep:
|
elif op is "_prepend":
|
||||||
self.setVarFlag(append, "_append", keep)
|
sval = a + (self.getVar(append, False) or "")
|
||||||
else:
|
self.setVar(append, sval)
|
||||||
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")
|
|
||||||
|
|
||||||
|
# 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):
|
def initVar(self, var):
|
||||||
self.expand_cache = {}
|
self.expand_cache = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user