summaryrefslogtreecommitdiffstats
path: root/lib/bb/data_smart.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-23 17:33:51 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-12 22:50:27 +0100
commitb1ce9975ef96f2506042832f4518cde73f6be917 (patch)
tree704f92885e7e20a08d7b99190c5d8ec233f42d0e /lib/bb/data_smart.py
parente177170200ece76b36e3f7d5597651fdef67736f (diff)
downloadopenembedded-core-contrib-b1ce9975ef96f2506042832f4518cde73f6be917.tar.gz
data_smart: Defer append/prepend handling
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/data_smart.py')
-rw-r--r--lib/bb/data_smart.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 7bb7b4aae3..b433489a84 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -429,12 +429,13 @@ class DataSmart(MutableMapping):
continue
if op == "_append":
- sval = self.getVar(append, False) or ""
- sval += a
- self.setVar(append, sval)
+ apps = self.getVarFlag(append, "_appendactive", False) or []
+ apps.extend([a])
+ self.setVarFlag(append, "_appendactive", apps, ignore=True)
elif op == "_prepend":
- sval = a + (self.getVar(append, False) or "")
- self.setVar(append, sval)
+ prepends = self.getVarFlag(append, "_prependactive", False) or []
+ prepends.extend([a])
+ self.setVarFlag(append, "_prependactive", prepends, ignore=True)
elif op == "_remove":
removes = self.getVarFlag(append, "_removeactive", False) or []
removes.extend(a.split())
@@ -507,6 +508,11 @@ class DataSmart(MutableMapping):
if not var in self.dict:
self._makeShadowCopy(var)
+ if "_appendactive" in self.dict[var]:
+ del self.dict[var]["_appendactive"]
+ if "_prependactive" in self.dict[var]:
+ del self.dict[var]["_prependactive"]
+
# more cookies for the cookie monster
if '_' in var:
self._setvar_update_overrides(var)
@@ -612,6 +618,17 @@ class DataSmart(MutableMapping):
value = copy.copy(local_var[flag])
elif flag == "_content" and "_defaultval" in local_var and not noweakdefault:
value = copy.copy(local_var["_defaultval"])
+
+ if flag == "_content" and local_var is not None and "_appendactive" in local_var:
+ if not value:
+ value = ""
+ for r in local_var["_appendactive"]:
+ value = value + r
+ if flag == "_content" and local_var is not None and "_prependactive" in local_var:
+ if not value:
+ value = ""
+ for r in local_var["_prependactive"]:
+ value = r + value
if expand and value:
# Only getvar (flag == _content) hits the expand cache
cachename = None