Skip to contentSkip to conversation

data_smart: remove old override syntax check

RFC PATCH Konrad Weihmann 2 participants 2 messages Sep 24, 2024 – Sep 25, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

after the override syntax change is now out in the field for a longer time, the expensive check for the old syntax can be removed.

This will save time while parsing, and should be side effect free, as variables in the old syntax are simply rendered into unapplicable variables.

A more complete check (e.g. RDEPENDS_${PN} checks) could be implemented elsewhere. as part of a sanity check

---
 lib/bb/data_smart.py  |  9 ---------
 lib/bb/tests/parse.py | 35 -----------------------------------
 2 files changed, 44 deletions(-)
lib/bb/data_smart.py +0 -9
index 0523744de..fe4c50740 100644
@@ -539,15 +539,6 @@ 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):
-            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 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:
             _print_rename_error(shortvar, loginfo, self._var_renames, fullvar=var)
lib/bb/tests/parse.py +0 -35
index 2da3a2a22..6832952f8 100644
@@ -132,41 +132,6 @@ DESCRIPTION:${PN}-dev = "${DESCRIPTION} B"
 PN = "bc"
 """
 
-    override_old_append = """
-EXTRA_OECONF_append = " c"
-"""
-
-    def test_parse_old_override_syntax_append(self):
-        f = self.parsehelper(self.override_old_append)
-        try:
-            bb.parse.handle(f.name, self.d)['']
-            self.fail('Pattern should have raised bb.BBHandledException')
-        except bb.BBHandledException:
-            pass
-
-    override_old_prepend = """
-EXTRA_OECONF_prepend = " c"
-"""
-
-    def test_parse_old_override_syntax_prepend(self):
-        f = self.parsehelper(self.override_old_prepend)
-        try:
-            bb.parse.handle(f.name, self.d)['']
-            self.fail('Pattern should have raised bb.BBHandledException')
-        except bb.BBHandledException:
-            pass
-
-    override_old_remove = """
-EXTRA_OECONF_remove = " c"
-"""
-
-    def test_parse_old_override_syntax_remove(self):
-        f = self.parsehelper(self.override_old_remove)
-        try:
-            bb.parse.handle(f.name, self.d)['']
-            self.fail('Pattern should have raised bb.BBHandledException')
-        except bb.BBHandledException:
-            pass
 
     override_old_valid_append = """
 do_appendsomething () {
Signature · 1 line
2.34.1
#2 lore raw

Please send properly versioned and complete series, don't expect maintainers to do your work and collected patches send a random times with random versions.

Quoted 95 lines · Konrad Weihmann

after the override syntax change is now out in the field for a longer time, the expensive check for the old syntax can be removed.

This will save time while parsing, and should be side effect free, as variables in the old syntax are simply rendered into unapplicable variables.

A more complete check (e.g. RDEPENDS_${PN} checks) could be implemented elsewhere. as part of a sanity check

---
 lib/bb/data_smart.py  |  9 ---------
 lib/bb/tests/parse.py | 35 -----------------------------------
 2 files changed, 44 deletions(-)
lib/bb/data_smart.py +0 -9
index 0523744de..fe4c50740 100644
@@ -539,15 +539,6 @@ 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):
-            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 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:
             _print_rename_error(shortvar, loginfo, self._var_renames, fullvar=var)
lib/bb/tests/parse.py +0 -35
index 2da3a2a22..6832952f8 100644
@@ -132,41 +132,6 @@ DESCRIPTION:${PN}-dev = "${DESCRIPTION} B"
 PN = "bc"
 """
 
-    override_old_append = """
-EXTRA_OECONF_append = " c"
-"""
-
-    def test_parse_old_override_syntax_append(self):
-        f = self.parsehelper(self.override_old_append)
-        try:
-            bb.parse.handle(f.name, self.d)['']
-            self.fail('Pattern should have raised bb.BBHandledException')
-        except bb.BBHandledException:
-            pass
-
-    override_old_prepend = """
-EXTRA_OECONF_prepend = " c"
-"""
-
-    def test_parse_old_override_syntax_prepend(self):
-        f = self.parsehelper(self.override_old_prepend)
-        try:
-            bb.parse.handle(f.name, self.d)['']
-            self.fail('Pattern should have raised bb.BBHandledException')
-        except bb.BBHandledException:
-            pass
-
-    override_old_remove = """
-EXTRA_OECONF_remove = " c"
-"""
-
-    def test_parse_old_override_syntax_remove(self):
-        f = self.parsehelper(self.override_old_remove)
-        try:
-            bb.parse.handle(f.name, self.d)['']
-            self.fail('Pattern should have raised bb.BBHandledException')
-        except bb.BBHandledException:
-            pass
 
     override_old_valid_append = """
 do_appendsomething () {
Signature · 11 lines
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16598): https://lists.openembedded.org/g/bitbake-devel/message/16598
Mute This Topic: https://lists.openembedded.org/mt/108625078/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com