diff mbox series

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

Message ID GV1PR07MB91209FE660BF5A5CCB712373A8682@GV1PR07MB9120.eurprd07.prod.outlook.com
State New
Headers show
Series None | expand

Commit Message

Konrad Weihmann Sept. 24, 2024, 6:43 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(-)
diff mbox series

Patch

diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 4e15a43c2..8344981fc 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 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 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: