summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/data_smart.py55
1 files changed, 41 insertions, 14 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index d414bf4614..4ccbedbfab 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -310,6 +310,8 @@ class DataSmart(MutableMapping):
310 self.expand_cache = {} 310 self.expand_cache = {}
311 311
312 # cookie monster tribute 312 # cookie monster tribute
313 self.overridedata = {}
314
313 self.overrides = [] 315 self.overrides = []
314 self.overridevars = set(["OVERRIDES", "FILE"]) 316 self.overridevars = set(["OVERRIDES", "FILE"])
315 317
@@ -434,8 +436,18 @@ class DataSmart(MutableMapping):
434 del self.dict[var]["_append"] 436 del self.dict[var]["_append"]
435 if "_prepend" in self.dict[var]: 437 if "_prepend" in self.dict[var]:
436 del self.dict[var]["_prepend"] 438 del self.dict[var]["_prepend"]
437 if "_overrides" in self.dict[var]: 439 if var in self.overridedata:
438 del self.dict[var]["_overrides"] 440 active = []
441 self.need_overrides()
442 for (r, o) in self.overridedata[var]:
443 if o in self.overrides:
444 active.append(r)
445 elif "_" in o:
446 if set(o.split("_")).issubset(set(self.overrides)):
447 active.append(r)
448 for a in active:
449 self.delVar(a)
450 del self.overridedata[var]
439 451
440 # more cookies for the cookie monster 452 # more cookies for the cookie monster
441 if '_' in var: 453 if '_' in var:
@@ -454,10 +466,10 @@ class DataSmart(MutableMapping):
454 override = var[var.rfind('_')+1:] 466 override = var[var.rfind('_')+1:]
455 shortvar = var[:var.rfind('_')] 467 shortvar = var[:var.rfind('_')]
456 while override: 468 while override:
457 l = self.getVarFlag(shortvar, "_overrides") or [] 469 if shortvar not in self.overridedata:
458 if [var, override] not in l: 470 self.overridedata[shortvar] = []
459 l.append([var, override]) 471 if [var, override] not in self.overridedata[shortvar]:
460 self.setVarFlag(shortvar, "_overrides", l, ignore=True) 472 self.overridedata[shortvar].append([var, override])
461 for event in self.varhistory.variable(var): 473 for event in self.varhistory.variable(var):
462 if 'flag' in loginfo and not loginfo['flag'].startswith("_"): 474 if 'flag' in loginfo and not loginfo['flag'].startswith("_"):
463 continue 475 continue
@@ -498,6 +510,12 @@ class DataSmart(MutableMapping):
498 dest.extend(src) 510 dest.extend(src)
499 self.setVarFlag(newkey, i, dest, ignore=True) 511 self.setVarFlag(newkey, i, dest, ignore=True)
500 512
513 if key in self.overridedata:
514 self.overridedata[newkey] = []
515 for (v, o) in self.overridedata[key]:
516 self.overridedata[newkey].append([v.replace(key, newkey), o])
517 self.renameVar(v, v.replace(key, newkey))
518
501 if '_' in newkey and val is None: 519 if '_' in newkey and val is None:
502 self._setvar_update_overrides(newkey, **loginfo) 520 self._setvar_update_overrides(newkey, **loginfo)
503 521
@@ -525,15 +543,23 @@ class DataSmart(MutableMapping):
525 self.varhistory.record(**loginfo) 543 self.varhistory.record(**loginfo)
526 self.expand_cache = {} 544 self.expand_cache = {}
527 self.dict[var] = {} 545 self.dict[var] = {}
546 if var in self.overridedata:
547 del self.overridedata[var]
528 if '_' in var: 548 if '_' in var:
529 override = var[var.rfind('_')+1:] 549 override = var[var.rfind('_')+1:]
530 shortvar = var[:var.rfind('_')] 550 shortvar = var[:var.rfind('_')]
531 l = self.getVarFlag(shortvar, "_overrides") or [] 551 while override:
532 try: 552 try:
533 l.remove([var, override]) 553 if shortvar in self.overridedata:
534 except ValueError as e: 554 self.overridedata[shortvar].remove([var, override])
535 pass 555 except ValueError as e:
536 self.setVarFlag(shortvar, "_overrides", l, ignore=True) 556 pass
557 override = None
558 if "_" in shortvar:
559 override = var[shortvar.rfind('_')+1:]
560 shortvar = var[:shortvar.rfind('_')]
561 if len(shortvar) == 0:
562 override = None
537 563
538 def setVarFlag(self, var, flag, value, **loginfo): 564 def setVarFlag(self, var, flag, value, **loginfo):
539 self.expand_cache = {} 565 self.expand_cache = {}
@@ -558,10 +584,10 @@ class DataSmart(MutableMapping):
558 def getVarFlag(self, var, flag, expand=False, noweakdefault=False, parsing=False): 584 def getVarFlag(self, var, flag, expand=False, noweakdefault=False, parsing=False):
559 local_var = self._findVar(var) 585 local_var = self._findVar(var)
560 value = None 586 value = None
561 if flag == "_content" and local_var is not None and "_overrides" in local_var and not parsing: 587 if flag == "_content" and var in self.overridedata and not parsing:
562 match = False 588 match = False
563 active = {} 589 active = {}
564 for (r, o) in local_var["_overrides"]: 590 for (r, o) in self.overridedata[var]:
565 # What about double overrides both with "_" in the name? 591 # What about double overrides both with "_" in the name?
566 if o in self.overrides: 592 if o in self.overrides:
567 active[o] = r 593 active[o] = r
@@ -738,6 +764,7 @@ class DataSmart(MutableMapping):
738 764
739 data.overrides = copy.copy(self.overrides) 765 data.overrides = copy.copy(self.overrides)
740 data.overridevars = copy.copy(self.overridevars) 766 data.overridevars = copy.copy(self.overridevars)
767 data.overridedata = copy.copy(self.overridedata)
741 768
742 return data 769 return data
743 770