bitbake: data_smart: Add support to BB_RENAMED_VARIABLES for custom strings

Add support for custom strings in BB_RENAMED_VARIABLES and use this to show
that BB_STAMP_WHITELIST and BB_STAMP_POLICY are no longer supported.

(Bitbake rev: 0914011f7647571ab125bbddcd7d68e3da47226a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2022-02-17 11:59:02 +00:00
parent 638869230f
commit f2fc11cad7
2 changed files with 25 additions and 16 deletions

View File

@ -319,12 +319,14 @@ class CookerDataBuilder(object):
for v in renamedvars:
if d.getVar(v) != None or d.hasOverrides(v):
issues = True
loginfo = {}
history = d.varhistory.get_variable_refs(v)
for h in history:
for line in history[h]:
bb.erroronce('Variable %s has been renamed to %s (file: %s line: %s)' % (v, renamedvars[v], h, line))
loginfo = {'file' : h, 'line' : line}
bb.data.data_smart._print_rename_error(v, loginfo, renamedvars)
if not history:
bb.erroronce('Variable %s has been renamed to %s' % (v, renamedvars[v]))
bb.data.data_smart._print_rename_error(v, loginfo, renamedvars)
if issues:
raise bb.BBHandledException()

View File

@ -41,6 +41,8 @@ bitbake_renamed_vars = {
"BB_HASHTASK_WHITELIST": "BB_TASKHASH_IGNORE_TASKS",
"BB_SETSCENE_ENFORCE_WHITELIST": "BB_SETSCENE_ENFORCE_IGNORE_TASKS",
"MULTI_PROVIDER_WHITELIST": "BB_MULTI_PROVIDER_ALLOWED",
"BB_STAMP_WHITELIST": "is a deprecated variable and support has been removed",
"BB_STAMP_POLICY": "is a deprecated variable and support has been removed",
}
def infer_caller_details(loginfo, parent = False, varval = True):
@ -390,6 +392,23 @@ class VariableHistory(object):
else:
self.variables[var] = []
def _print_rename_error(var, loginfo, renamedvars, fullvar=None):
info = ""
if "file" in loginfo:
info = " file: %s" % loginfo["file"]
if "line" in loginfo:
info += " line: %s" % loginfo["line"]
if fullvar and fullvar != var:
info += " referenced as: %s" % fullvar
if info:
info = " (%s)" % info.strip()
renameinfo = renamedvars[var]
if " " in renameinfo:
# A space signals a string to display instead of a rename
bb.erroronce('Variable %s %s%s' % (var, renameinfo, info))
else:
bb.erroronce('Variable %s has been renamed to %s%s' % (var, renameinfo, info))
class DataSmart(MutableMapping):
def __init__(self):
self.dict = {}
@ -513,18 +532,6 @@ class DataSmart(MutableMapping):
def hasOverrides(self, var):
return var in self.overridedata
def _print_rename_error(self, var, loginfo, fullvar=None):
info = ""
if "file" in loginfo:
info = " file: %s" % loginfo["file"]
if "line" in loginfo:
info += " line: %s" % loginfo["line"]
if fullvar and fullvar != var:
info += " referenced as: %s" % fullvar
if info:
info = " (%s)" % info.strip()
bb.erroronce('Variable %s has been renamed to %s%s' % (var, self._var_renames[var], info))
def setVar(self, var, value, **loginfo):
#print("var=" + str(var) + " val=" + str(value))
@ -538,7 +545,7 @@ class DataSmart(MutableMapping):
shortvar = var.split(":", 1)[0]
if shortvar in self._var_renames:
self._print_rename_error(shortvar, loginfo, fullvar=var)
_print_rename_error(shortvar, loginfo, self._var_renames, fullvar=var)
self.expand_cache = {}
parsing=False
@ -729,7 +736,7 @@ class DataSmart(MutableMapping):
self._var_renames[flag] = value
if var in self._var_renames:
self._print_rename_error(var, loginfo)
_print_rename_error(var, loginfo, self._var_renames)
if 'op' not in loginfo:
loginfo['op'] = "set"