Skip to contentSkip to conversation

Revert "insane.bbclass: Move test for invalid PACKAGECONFIGs to do_recipe_qa"

PATCH New Peter Kjellerstedt 1 participant 2 messages Mar 20

lore
Share & tools
lore
#0 lore raw

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

This reverts commit d3325c384a7df54c564cae093659cf7b692629f2.

Moving the QA test for invalid PACKAGECONFIGs to the recipe_qa task turned out to be a bad idea as that task is expected to be architecture independent. So move it back to be called from the do_qa_configure() function.

Also rename test_packageconfig() to configure_qa_invalid_packageconfig() to match how the test functions for the package_qa task are named.

---

PATCHv2: It is no longer a straight revert, but keeps the test_packageconfig() function as an individual function (renamed to configure_qa_invalid_packageconfig()), which is then called from do_qa_configure().

 meta/classes-global/insane.bbclass | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
meta/classes-global/insane.bbclass +14 -13
index aeffee7983..8bbe5bb19a 100644
@@ -1344,6 +1344,15 @@ python do_qa_patch() {
     oe.qa.exit_if_errors(d)
 }
 
+def configure_qa_invalid_packageconfig(pn, d):
+    pkgconfigs = (d.getVar("PACKAGECONFIG") or "").split()
+    if pkgconfigs:
+        pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
+        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)
+
 python do_qa_configure() {
     import subprocess
 
@@ -1353,11 +1362,12 @@ python do_qa_configure() {
 
     configs = []
     workdir = d.getVar('WORKDIR')
+    pn = d.getVar('PN')
 
     skip = (d.getVar('INSANE_SKIP') or "").split()
     skip_configure_unsafe = False
     if 'configure-unsafe' in skip:
-        bb.note("Recipe %s skipping qa checking: configure-unsafe" % d.getVar('PN'))
+        bb.note(f"Recipe {pn} skipping qa checking: configure-unsafe")
         skip_configure_unsafe = True
 
     if bb.data.inherits_class('autotools', d) and not skip_configure_unsafe:
@@ -1382,7 +1392,7 @@ Rerun configure task after fixing this."""
 
     skip_configure_gettext = False
     if 'configure-gettext' in skip:
-        bb.note("Recipe %s skipping qa checking: configure-gettext" % d.getVar('PN'))
+        bb.note(f"Recipe {pn} skipping qa checking: configure-gettext")
         skip_configure_gettext = True
 
     cnf = d.getVar('EXTRA_OECONF') or ""
@@ -1417,12 +1427,13 @@ Rerun configure task after fixing this."""
             ignore_opts = set(d.getVar("UNKNOWN_CONFIGURE_OPT_IGNORE").split())
             options -= ignore_opts
             if options:
-                pn = d.getVar('PN')
                 error_msg = pn + ": configure was passed unrecognised options: " + " ".join(options)
                 oe.qa.handle_error("unknown-configure-option", error_msg, d)
         except subprocess.CalledProcessError:
             pass
 
+    configure_qa_invalid_packageconfig(pn, d)
+
     oe.qa.exit_if_errors(d)
 }
 
@@ -1484,21 +1495,11 @@ 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 {}
-            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_naming(pn, d)
     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 v2 2/2 insane.bbclass: Add a package QA test for invalid PACKAGECONFIGs

Normally, this test is run as part of the do_qa_configure() postfunc to the configure task. However, for the rare case that the configure task has been deleted (e.g., in packagegroups), then run it as a package QA test instead.

---

PATCHv2: New in v2. Replaces the previous solution that instead modified packagegroup.bbclass.

 meta/classes-global/insane.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)
meta/classes-global/insane.bbclass +7 -0
index 8bbe5bb19a..77d708f367 100644
@@ -1087,6 +1087,13 @@ def package_qa_check_missing_update_alternatives(pn, d):
         if d.getVar('ALTERNATIVE:%s' % pkg) and not bb.data.inherits_class('update-alternatives', d):
             oe.qa.handle_error("missing-update-alternatives", "%s: recipe defines ALTERNATIVE:%s but doesn't inherit update-alternatives. This might fail during do_rootfs later!" % (pn, pkg), d)
 
+QARECIPETEST[invalid-packageconfig] = "package_qa_invalid_packageconfig"
+def package_qa_invalid_packageconfig(pn, d):
+    # For almost all recipes, the check for invalid PACKAGECONFIGs will be run
+    # as part of the do_qa_configure() postfunc to the configure task instead.
+    if 'do_configure' not in bb.build.listtasks(d):
+        configure_qa_invalid_packageconfig(pn, d)
+
 def parse_test_matrix(matrix_name, skip, d):
         testmatrix = d.getVarFlags(matrix_name) or {}
         g = globals()