summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/data_smart.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-22 10:30:57 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-12 22:50:45 +0100
commit933e19697b680637e5af8131cf5fc833943f68f7 (patch)
tree380e8c3b71b4fdfd233b947ba45317824ebde9d8 /bitbake/lib/bb/data_smart.py
parent95be16f428ae4cf4254da0b814a327459a983ef5 (diff)
downloadpoky-933e19697b680637e5af8131cf5fc833943f68f7.tar.gz
bitbake: parse/ast/data_smart: Add parsing flag to getVar/setVar
When parsing we find problems if we clear prepends/appends when setting variables during the initial parsing phases. Later, we actively want to do this (in what would be post finalisation previously). To handle this, pass a parsing flag to the operations to control the correct behaviour for the context. (Bitbake rev: ae87f5b8bf16191b3201cfb445062938eab992a0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/data_smart.py')
-rw-r--r--bitbake/lib/bb/data_smart.py36
1 files changed, 21 insertions, 15 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 28ea2aef63..68efc7bb1c 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -386,6 +386,10 @@ class DataSmart(MutableMapping):
386 386
387 def setVar(self, var, value, **loginfo): 387 def setVar(self, var, value, **loginfo):
388 #print("var=" + str(var) + " val=" + str(value)) 388 #print("var=" + str(var) + " val=" + str(value))
389 parsing=False
390 if 'parsing' in loginfo:
391 parsing=True
392
389 if 'op' not in loginfo: 393 if 'op' not in loginfo:
390 loginfo['op'] = "set" 394 loginfo['op'] = "set"
391 self.expand_cache = {} 395 self.expand_cache = {}
@@ -421,12 +425,13 @@ class DataSmart(MutableMapping):
421 if not var in self.dict: 425 if not var in self.dict:
422 self._makeShadowCopy(var) 426 self._makeShadowCopy(var)
423 427
424 if "_append" in self.dict[var]: 428 if not parsing:
425 del self.dict[var]["_append"] 429 if "_append" in self.dict[var]:
426 if "_prepend" in self.dict[var]: 430 del self.dict[var]["_append"]
427 del self.dict[var]["_prepend"] 431 if "_prepend" in self.dict[var]:
428 if "_overrides" in self.dict[var]: 432 del self.dict[var]["_prepend"]
429 del self.dict[var]["_overrides"] 433 if "_overrides" in self.dict[var]:
434 del self.dict[var]["_overrides"]
430 435
431 # more cookies for the cookie monster 436 # more cookies for the cookie monster
432 if '_' in var: 437 if '_' in var:
@@ -464,20 +469,20 @@ class DataSmart(MutableMapping):
464 if len(shortvar) == 0: 469 if len(shortvar) == 0:
465 override = None 470 override = None
466 471
467 def getVar(self, var, expand=False, noweakdefault=False): 472 def getVar(self, var, expand=False, noweakdefault=False, parsing=False):
468 return self.getVarFlag(var, "_content", expand, noweakdefault) 473 return self.getVarFlag(var, "_content", expand, noweakdefault, parsing)
469 474
470 def renameVar(self, key, newkey, **loginfo): 475 def renameVar(self, key, newkey, **loginfo):
471 """ 476 """
472 Rename the variable key to newkey 477 Rename the variable key to newkey
473 """ 478 """
474 val = self.getVar(key, 0) 479 val = self.getVar(key, 0, parsing=True)
475 if val is not None: 480 if val is not None:
476 loginfo['variable'] = newkey 481 loginfo['variable'] = newkey
477 loginfo['op'] = 'rename from %s' % key 482 loginfo['op'] = 'rename from %s' % key
478 loginfo['detail'] = val 483 loginfo['detail'] = val
479 self.varhistory.record(**loginfo) 484 self.varhistory.record(**loginfo)
480 self.setVar(newkey, val, ignore=True) 485 self.setVar(newkey, val, ignore=True, parsing=True)
481 486
482 for i in (__setvar_keyword__): 487 for i in (__setvar_keyword__):
483 src = self.getVarFlag(key, i) 488 src = self.getVarFlag(key, i)
@@ -545,11 +550,10 @@ class DataSmart(MutableMapping):
545 self.dict["__exportlist"]["_content"] = set() 550 self.dict["__exportlist"]["_content"] = set()
546 self.dict["__exportlist"]["_content"].add(var) 551 self.dict["__exportlist"]["_content"].add(var)
547 552
548 def getVarFlag(self, var, flag, expand=False, noweakdefault=False): 553 def getVarFlag(self, var, flag, expand=False, noweakdefault=False, parsing=False):
549 local_var = self._findVar(var) 554 local_var = self._findVar(var)
550 value = None 555 value = None
551 556 if flag == "_content" and local_var is not None and "_overrides" in local_var and not parsing:
552 if flag == "_content" and local_var is not None and "_overrides" in local_var:
553 match = False 557 match = False
554 active = {} 558 active = {}
555 for (r, o) in local_var["_overrides"]: 559 for (r, o) in local_var["_overrides"]:
@@ -580,7 +584,8 @@ class DataSmart(MutableMapping):
580 elif flag == "_content" and "_defaultval" in local_var and not noweakdefault: 584 elif flag == "_content" and "_defaultval" in local_var and not noweakdefault:
581 value = copy.copy(local_var["_defaultval"]) 585 value = copy.copy(local_var["_defaultval"])
582 586
583 if flag == "_content" and local_var is not None and "_append" in local_var: 587
588 if flag == "_content" and local_var is not None and "_append" in local_var and not parsing:
584 if not value: 589 if not value:
585 value = "" 590 value = ""
586 for (r, o) in local_var["_append"]: 591 for (r, o) in local_var["_append"]:
@@ -592,10 +597,11 @@ class DataSmart(MutableMapping):
592 if match: 597 if match:
593 value = value + r 598 value = value + r
594 599
595 if flag == "_content" and local_var is not None and "_prepend" in local_var: 600 if flag == "_content" and local_var is not None and "_prepend" in local_var and not parsing:
596 if not value: 601 if not value:
597 value = "" 602 value = ""
598 for (r, o) in local_var["_prepend"]: 603 for (r, o) in local_var["_prepend"]:
604
599 match = True 605 match = True
600 if o: 606 if o:
601 for o2 in o.split("_"): 607 for o2 in o.split("_"):