summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/cookerdata.py6
-rw-r--r--bitbake/lib/bb/data_smart.py35
2 files changed, 25 insertions, 16 deletions
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
index 8426ed786f..ddf05b92ab 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -319,12 +319,14 @@ class CookerDataBuilder(object):
319 for v in renamedvars: 319 for v in renamedvars:
320 if d.getVar(v) != None or d.hasOverrides(v): 320 if d.getVar(v) != None or d.hasOverrides(v):
321 issues = True 321 issues = True
322 loginfo = {}
322 history = d.varhistory.get_variable_refs(v) 323 history = d.varhistory.get_variable_refs(v)
323 for h in history: 324 for h in history:
324 for line in history[h]: 325 for line in history[h]:
325 bb.erroronce('Variable %s has been renamed to %s (file: %s line: %s)' % (v, renamedvars[v], h, line)) 326 loginfo = {'file' : h, 'line' : line}
327 bb.data.data_smart._print_rename_error(v, loginfo, renamedvars)
326 if not history: 328 if not history:
327 bb.erroronce('Variable %s has been renamed to %s' % (v, renamedvars[v])) 329 bb.data.data_smart._print_rename_error(v, loginfo, renamedvars)
328 if issues: 330 if issues:
329 raise bb.BBHandledException() 331 raise bb.BBHandledException()
330 332
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 68bdc3430f..7b06d3a107 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -41,6 +41,8 @@ bitbake_renamed_vars = {
41 "BB_HASHTASK_WHITELIST": "BB_TASKHASH_IGNORE_TASKS", 41 "BB_HASHTASK_WHITELIST": "BB_TASKHASH_IGNORE_TASKS",
42 "BB_SETSCENE_ENFORCE_WHITELIST": "BB_SETSCENE_ENFORCE_IGNORE_TASKS", 42 "BB_SETSCENE_ENFORCE_WHITELIST": "BB_SETSCENE_ENFORCE_IGNORE_TASKS",
43 "MULTI_PROVIDER_WHITELIST": "BB_MULTI_PROVIDER_ALLOWED", 43 "MULTI_PROVIDER_WHITELIST": "BB_MULTI_PROVIDER_ALLOWED",
44 "BB_STAMP_WHITELIST": "is a deprecated variable and support has been removed",
45 "BB_STAMP_POLICY": "is a deprecated variable and support has been removed",
44} 46}
45 47
46def infer_caller_details(loginfo, parent = False, varval = True): 48def infer_caller_details(loginfo, parent = False, varval = True):
@@ -390,6 +392,23 @@ class VariableHistory(object):
390 else: 392 else:
391 self.variables[var] = [] 393 self.variables[var] = []
392 394
395def _print_rename_error(var, loginfo, renamedvars, fullvar=None):
396 info = ""
397 if "file" in loginfo:
398 info = " file: %s" % loginfo["file"]
399 if "line" in loginfo:
400 info += " line: %s" % loginfo["line"]
401 if fullvar and fullvar != var:
402 info += " referenced as: %s" % fullvar
403 if info:
404 info = " (%s)" % info.strip()
405 renameinfo = renamedvars[var]
406 if " " in renameinfo:
407 # A space signals a string to display instead of a rename
408 bb.erroronce('Variable %s %s%s' % (var, renameinfo, info))
409 else:
410 bb.erroronce('Variable %s has been renamed to %s%s' % (var, renameinfo, info))
411
393class DataSmart(MutableMapping): 412class DataSmart(MutableMapping):
394 def __init__(self): 413 def __init__(self):
395 self.dict = {} 414 self.dict = {}
@@ -513,18 +532,6 @@ class DataSmart(MutableMapping):
513 def hasOverrides(self, var): 532 def hasOverrides(self, var):
514 return var in self.overridedata 533 return var in self.overridedata
515 534
516 def _print_rename_error(self, var, loginfo, fullvar=None):
517 info = ""
518 if "file" in loginfo:
519 info = " file: %s" % loginfo["file"]
520 if "line" in loginfo:
521 info += " line: %s" % loginfo["line"]
522 if fullvar and fullvar != var:
523 info += " referenced as: %s" % fullvar
524 if info:
525 info = " (%s)" % info.strip()
526 bb.erroronce('Variable %s has been renamed to %s%s' % (var, self._var_renames[var], info))
527
528 def setVar(self, var, value, **loginfo): 535 def setVar(self, var, value, **loginfo):
529 #print("var=" + str(var) + " val=" + str(value)) 536 #print("var=" + str(var) + " val=" + str(value))
530 537
@@ -538,7 +545,7 @@ class DataSmart(MutableMapping):
538 545
539 shortvar = var.split(":", 1)[0] 546 shortvar = var.split(":", 1)[0]
540 if shortvar in self._var_renames: 547 if shortvar in self._var_renames:
541 self._print_rename_error(shortvar, loginfo, fullvar=var) 548 _print_rename_error(shortvar, loginfo, self._var_renames, fullvar=var)
542 549
543 self.expand_cache = {} 550 self.expand_cache = {}
544 parsing=False 551 parsing=False
@@ -729,7 +736,7 @@ class DataSmart(MutableMapping):
729 self._var_renames[flag] = value 736 self._var_renames[flag] = value
730 737
731 if var in self._var_renames: 738 if var in self._var_renames:
732 self._print_rename_error(var, loginfo) 739 _print_rename_error(var, loginfo, self._var_renames)
733 740
734 if 'op' not in loginfo: 741 if 'op' not in loginfo:
735 loginfo['op'] = "set" 742 loginfo['op'] = "set"