summaryrefslogtreecommitdiffstats
path: root/lib/bb/data_smart.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-04-08 15:43:47 -0700
committerChris Larson <chris_larson@mentor.com>2010-04-09 12:49:06 -0700
commitff801397785567cb84b3615de86bff764d65decf (patch)
tree42d4e197a7a628048ea0d331894538cb2396f730 /lib/bb/data_smart.py
parent69a3e4895b88110fd3a25167aa16cf7c00463175 (diff)
downloadbitbake-contrib-ff801397785567cb84b3615de86bff764d65decf.tar.gz
Move update_data into the DataSmart class as a finalize() method
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/data_smart.py')
-rw-r--r--lib/bb/data_smart.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 77f186138..6ea018285 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -95,6 +95,71 @@ class DataSmart:
return s
+ def finalize(self):
+ """Performs final steps upon the datastore, including application of overrides"""
+ overrides = (self.getVar("OVERRIDES", True) or "").split(":")
+
+ #
+ # Well let us see what breaks here. We used to iterate
+ # over each variable and apply the override and then
+ # do the line expanding.
+ # If we have bad luck - which we will have - the keys
+ # where in some order that is so important for this
+ # method which we don't have anymore.
+ # Anyway we will fix that and write test cases this
+ # time.
+
+ #
+ # First we apply all overrides
+ # Then we will handle _append and _prepend
+ #
+
+ for o in overrides:
+ # calculate '_'+override
+ l = len(o)+1
+
+ # see if one should even try
+ if not self._seen_overrides.has_key(o):
+ continue
+
+ vars = self._seen_overrides[o]
+ for var in vars:
+ name = var[:-l]
+ try:
+ self.renameVar(var, name)
+ except:
+ bb.msg.note(1, bb.msg.domain.Data, "Untracked delVar")
+
+ # now on to the appends and prepends
+ if self._special_values.has_key("_append"):
+ appends = self._special_values['_append'] or []
+ for append in appends:
+ for (a, o) in self.getVarFlag(append, '_append') or []:
+ # maybe the OVERRIDE was not yet added so keep the append
+ if (o and o in overrides) or not o:
+ self.delVarFlag(append, '_append')
+ if o and not o in overrides:
+ continue
+
+ sval = self.getVar(append, False) or ""
+ sval += a
+ self.setVar(append, sval)
+
+
+ if self._special_values.has_key("_prepend"):
+ prepends = self._special_values['_prepend'] or []
+
+ for prepend in prepends:
+ for (a, o) in self.getVarFlag(prepend, '_prepend') or []:
+ # maybe the OVERRIDE was not yet added so keep the prepend
+ if (o and o in overrides) or not o:
+ self.delVarFlag(prepend, '_prepend')
+ if o and not o in overrides:
+ continue
+
+ sval = a + (self.getVar(prepend, False) or "")
+ self.setVar(prepend, sval)
+
def initVar(self, var):
self.expand_cache = {}
if not var in self.dict: