Skip to contentSkip to conversation

insane.bbclass: Move test for invalid PACKAGECONFIGs to do_recipe_qa

PATCH New Peter Kjellerstedt 1 participant 2 messages Apr 5, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 insane.bbclass: Move test for invalid PACKAGECONFIGs to do_recipe_qa

This makes sure invalid PACKAGECONFIGs are reported also for recipes that have no do_configure task, e.g., packagegroups.

---
 meta/classes-global/insane.bbclass | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
meta/classes-global/insane.bbclass +10 -10
index fc4ca84b35..748de050e0 100644
@@ -1418,16 +1418,6 @@ Rerun configure task after fixing this."""
         except subprocess.CalledProcessError:
             pass
 
-    # Check invalid PACKAGECONFIG
-    pkgconfig = (d.getVar("PACKAGECONFIG") or "").split()
-    if pkgconfig:
-        pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
-        for pconfig in pkgconfig:
-            if pconfig not in pkgconfigflags:
-                pn = d.getVar('PN')
-                error_msg = "%s: invalid PACKAGECONFIG: %s" % (pn, pconfig)
-                oe.qa.handle_error("invalid-packageconfig", error_msg, d)
-
     oe.qa.exit_if_errors(d)
 }
 
@@ -1475,10 +1465,20 @@ python do_recipe_qa() {
             if re.search(r"git(hu|la)b\.com/.+/.+/archive/.+", url) or "//codeload.github.com/" in url:
                 oe.qa.handle_error("src-uri-bad", "%s: SRC_URI uses unstable GitHub/GitLab archives, convert recipe to use git protocol" % pn, d)
 
+    def test_packageconfig(pn, d):
+        pkgconfigs = (d.getVar("PACKAGECONFIG") or "").split()
+        if pkgconfigs:
+            pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
+            for pkgconfig in pkgconfigs:
+                if pkgconfig not in pkgconfigflags:
+                    error_msg = "%s: invalid PACKAGECONFIG: %s" % (pn, pkgconfig)
+                    oe.qa.handle_error("invalid-packageconfig", error_msg, d)
+
     pn = d.getVar('PN')
     test_missing_metadata(pn, d)
     test_missing_maintainer(pn, d)
     test_srcuri(pn, d)
+    test_packageconfig(pn, d)
     oe.qa.exit_if_errors(d)
 }
 
#1 lore raw

PATCH 2/2 insane.bbclass: Report all invalid PACKAGECONFIGs for a recipe at once

Rather than reporting each invalid PACKAGECONFIG with a separate error message, report them all with one error message.

---
 meta/classes-global/insane.bbclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
meta/classes-global/insane.bbclass +4 -4
index 748de050e0..cd26bf5eb9 100644
@@ -1469,10 +1469,10 @@ python do_recipe_qa() {
         pkgconfigs = (d.getVar("PACKAGECONFIG") or "").split()
         if pkgconfigs:
             pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
-            for pkgconfig in pkgconfigs:
-                if pkgconfig not in pkgconfigflags:
-                    error_msg = "%s: invalid PACKAGECONFIG: %s" % (pn, pkgconfig)
-                    oe.qa.handle_error("invalid-packageconfig", error_msg, d)
+            invalid_pkgconfigs = set(pkgconfigs) - set(pkgconfigflags)
+            if invalid_pkgconfigs:
+                error_msg = "%s: invalid PACKAGECONFIG(s): %s" % (pn, " ".join(sorted(invalid_pkgconfigs)))
+                oe.qa.handle_error("invalid-packageconfig", error_msg, d)
 
     pn = d.getVar('PN')
     test_missing_metadata(pn, d)