summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-23 18:01:00 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-12 22:50:44 +0100
commite7ccd9071233d66afb0bc72774b0032fb8229fe4 (patch)
tree15ed1c4f5833f1c2d1627110883ad99c5c4351f7 /bitbake
parent42a59961fa34b098e86c8a358375f2af43779833 (diff)
downloadpoky-e7ccd9071233d66afb0bc72774b0032fb8229fe4.tar.gz
bitbake: data_smart: Remove need for update_data calls
Move the update_data functionality into internal data store operations so the main finalize (update_data) call is a nop. To make this work we need to call the internal finalization function whenever OVERRIDES is changed to ensure values get updated correctly. This has performance issues but the subsequant patches look into this. (Bitbake rev: 546d9932d6c4413824319a9d780c0d77d2725f4a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/data_smart.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index b433489a84..77d0c61da0 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -298,6 +298,7 @@ class VariableHistory(object):
298class DataSmart(MutableMapping): 298class DataSmart(MutableMapping):
299 def __init__(self, special = None, seen = None ): 299 def __init__(self, special = None, seen = None ):
300 self.dict = {} 300 self.dict = {}
301 self.overrides = []
301 302
302 if special is None: 303 if special is None:
303 special = COWDictBase.copy() 304 special = COWDictBase.copy()
@@ -354,11 +355,13 @@ class DataSmart(MutableMapping):
354 def expand(self, s, varname = None): 355 def expand(self, s, varname = None):
355 return self.expandWithRefs(s, varname).value 356 return self.expandWithRefs(s, varname).value
356 357
357
358 def finalize(self, parent = False): 358 def finalize(self, parent = False):
359 return
360
361 def internal_finalize(self, parent = False):
359 """Performs final steps upon the datastore, including application of overrides""" 362 """Performs final steps upon the datastore, including application of overrides"""
360 363
361 overrides = (self.getVar("OVERRIDES", True) or "").split(":") or [] 364 self.overrides = (self.getVar("OVERRIDES", True) or "").split(":") or []
362 finalize_caller = { 365 finalize_caller = {
363 'op': 'finalize', 366 'op': 'finalize',
364 } 367 }
@@ -383,7 +386,7 @@ class DataSmart(MutableMapping):
383 # We only want to report finalization once per variable overridden. 386 # We only want to report finalization once per variable overridden.
384 finalizes_reported = {} 387 finalizes_reported = {}
385 388
386 for o in overrides: 389 for o in self.overrides:
387 # calculate '_'+override 390 # calculate '_'+override
388 l = len(o) + 1 391 l = len(o) + 1
389 392
@@ -417,12 +420,15 @@ class DataSmart(MutableMapping):
417 if op in self._special_values: 420 if op in self._special_values:
418 appends = self._special_values[op] or [] 421 appends = self._special_values[op] or []
419 for append in appends: 422 for append in appends:
423 self.handle_special_values(append, op)
424
425 def handle_special_values(self, append, op):
420 keep = [] 426 keep = []
421 for (a, o) in self.getVarFlag(append, op) or []: 427 for (a, o) in self.getVarFlag(append, op) or []:
422 match = True 428 match = True
423 if o: 429 if o:
424 for o2 in o.split("_"): 430 for o2 in o.split("_"):
425 if not o2 in overrides: 431 if not o2 in self.overrides:
426 match = False 432 match = False
427 if not match: 433 if not match:
428 keep.append((a ,o)) 434 keep.append((a ,o))
@@ -502,6 +508,7 @@ class DataSmart(MutableMapping):
502 except KeyError: 508 except KeyError:
503 self._special_values[keyword] = set() 509 self._special_values[keyword] = set()
504 self._special_values[keyword].add(base) 510 self._special_values[keyword].add(base)
511 self.handle_special_values(base, keyword)
505 512
506 return 513 return
507 514
@@ -521,6 +528,9 @@ class DataSmart(MutableMapping):
521 self.dict[var]["_content"] = value 528 self.dict[var]["_content"] = value
522 self.varhistory.record(**loginfo) 529 self.varhistory.record(**loginfo)
523 530
531 if var == "OVERRIDES":
532 self.internal_finalize(True)
533
524 def _setvar_update_overrides(self, var): 534 def _setvar_update_overrides(self, var):
525 # aka pay the cookie monster 535 # aka pay the cookie monster
526 override = var[var.rfind('_')+1:] 536 override = var[var.rfind('_')+1:]
@@ -733,6 +743,7 @@ class DataSmart(MutableMapping):
733 # we really want this to be a DataSmart... 743 # we really want this to be a DataSmart...
734 data = DataSmart(seen=self._seen_overrides.copy(), special=self._special_values.copy()) 744 data = DataSmart(seen=self._seen_overrides.copy(), special=self._special_values.copy())
735 data.dict["_data"] = self.dict 745 data.dict["_data"] = self.dict
746 data.overrides = copy.copy(self.overrides)
736 data.varhistory = self.varhistory.copy() 747 data.varhistory = self.varhistory.copy()
737 data.varhistory.datasmart = data 748 data.varhistory.datasmart = data
738 data.inchistory = self.inchistory.copy() 749 data.inchistory = self.inchistory.copy()