diff mbox series

[v3,2/3] bb/data_smart: fix override syntax warning

Message ID GV1PR07MB91208FE4BD9DE31DFD4A7318A8742@GV1PR07MB9120.eurprd07.prod.outlook.com
State New
Headers show
Series bb/data_smart: better old override syntax check | expand

Commit Message

Konrad Weihmann Sept. 28, 2024, 7 a.m. UTC
when defining a function do_removesomething,
the parser warned about

Variable do_removesomething contains an operation using the
old override syntax. Please convert this layer/metadata before
attempting to use with a newer bitbake

correct it would be to search for a override operator at the end
of the string or for the next operator.

To avoid running the expensive regex search on every setVar call
the current "cheap" check would be have to be triggered,
before the more precise check is run.

Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
---
  lib/bb/data_smart.py | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)

old override syntax. Please convert this layer/metadata before 
attempting to use with a newer bitbake." % info)
           shortvar = var.split(":", 1)[0]
          if shortvar in self._var_renames:
diff mbox series

Patch

diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 4e15a43c2..0523744de 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -539,14 +539,14 @@  class DataSmart(MutableMapping):
          return var in self.overridedata
       def setVar(self, var, value, **loginfo):
-
          if not var.startswith("__anon_") and ("_append" in var or 
"_prepend" in var or "_remove" in var):
-            info = "%s" % var
-            if "file" in loginfo:
-                info += " file: %s" % loginfo["file"]
-            if "line" in loginfo:
-                info += " line: %s" % loginfo["line"]
-            bb.fatal("Variable %s contains an operation using the old 
override syntax. Please convert this layer/metadata before attempting to 
use with a newer bitbake." % info)
+            if re.search(r"(_append|_prepend|_remove)(_|$)", var) is 
not None:
+                info = "%s" % var
+                if "file" in loginfo:
+                    info += " file: %s" % loginfo["file"]
+                if "line" in loginfo:
+                    info += " line: %s" % loginfo["line"]
+                bb.fatal("Variable %s contains an operation using the