From da4c443ac5ae7024d053f7e224c576f750a90085 Mon Sep 17 00:00:00 2001 From: Marta Rybczynska Date: Mon, 21 Feb 2022 18:44:59 +0100 Subject: bitbake: lib/bb: fix exit when found renamed variables Until now, if a renamed variable was found, bitbake exited immediately if it was in a class, but continued after an error message if the variable was in a recipe. This was caused by cookerdata.py CookerDataBuilder::parseBaseConfiguration checking a different DataSmart instance than the variable was set in. To solve the issue, add a special variable and set it when we find a renamed variable. Check for it in ast.py and bail out if needed. (Bitbake rev: d12400600e30549c88dc9e7883dc3d63b1dc1117) Signed-off-by: Marta Rybczynska Signed-off-by: Richard Purdie --- bitbake/lib/bb/data_smart.py | 4 ++++ bitbake/lib/bb/parse/ast.py | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'bitbake') diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 7b06d3a107..e7047d79ca 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -546,6 +546,8 @@ class DataSmart(MutableMapping): shortvar = var.split(":", 1)[0] if shortvar in self._var_renames: _print_rename_error(shortvar, loginfo, self._var_renames, fullvar=var) + # Mark that we have seen a renamed variable + self.setVar("_FAILPARSINGERRORHANDLED", True) self.expand_cache = {} parsing=False @@ -737,6 +739,8 @@ class DataSmart(MutableMapping): if var in self._var_renames: _print_rename_error(var, loginfo, self._var_renames) + # Mark that we have seen a renamed variable + self.setVar("_FAILPARSINGERRORHANDLED", True) if 'op' not in loginfo: loginfo['op'] = "set" diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 31bcc8e7ac..4b1b44ce19 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py @@ -333,6 +333,10 @@ def runAnonFuncs(d): def finalize(fn, d, variant = None): saved_handlers = bb.event.get_handlers().copy() try: + # Found renamed variables. Exit immediately + if d.getVar("_FAILPARSINGERRORHANDLED", False) == True: + raise bb.BBHandledException() + for var in d.getVar('__BBHANDLERS', False) or []: # try to add the handler handlerfn = d.getVarFlag(var, "filename", False) -- cgit v1.2.3-54-g00ecf