diff mbox series

[1/2] insane: Add QA check for RRECOMMENDS on non-existent packages

Message ID 20230223232939.3932270-2-yoann.congal@smile.fr
State New
Headers show
Series Handling of ${PN}-dev RRECOMMENDS non-existent ${PN} | expand

Commit Message

Yoann Congal Feb. 23, 2023, 11:29 p.m. UTC
From: Fawzi KHABER <fawzi.khaber@smile.fr>

Add a package QA check for when a package RRECOMMENDS another that won't
be built because it is empty and ALLOW_EMPTY is not set. This happens
usually when ${PN}-dev RRECOMMENDS ${PN} but ${PN} is empty. This is not
an error but might be something to look into.

Example of a generated warning:
WARNING: python3-3.11.2-r0 do_package_qa:
QA Issue: python3-dev -> python3 but won't be build [rrecommends-non-existant]

This will make [YOCTO #8222] appears in the QA logs.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Fawzi KHABER <fawzi.khaber@smile.fr>
---
 meta/classes-global/insane.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index ee34d5208d..a3e8c57955 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -34,6 +34,7 @@  WARN_QA ?= " libdir xorg-driver-abi buildpaths \
             missing-update-alternatives native-last missing-ptest \
             license-exists license-no-generic license-syntax license-format \
             license-incompatible license-file-missing obsolete-license \
+            rrecommends-non-existant \
             "
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
             perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -1089,6 +1090,16 @@  def package_qa_check_empty_dirs(pkg, d, messages):
             msg = "%s installs files in %s, %s" % (pkg, dir, recommendation)
             oe.qa.add_message(messages, "empty-dirs", msg)
 
+QAPKGTEST[rrecommends-non-existant] = "package_qa_check_rrecommends_non_existant"
+def package_qa_check_rrecommends_non_existant(pkg, d, messages):
+    localdata = bb.data.createCopy(d)
+    localdata.setVar('OVERRIDES', pkg)
+    for rec in bb.utils.explode_dep_versions2(localdata.getVar("RRECOMMENDS") or ""):
+        if rec in (d.getVar("PACKAGES") or "").split() and not os.listdir(os.path.join(d.getVar("PKGDEST"), rec)):
+            localdata.setVar("OVERRIDES", rec)
+            if not bb.utils.to_boolean(localdata.getVar("ALLOW_EMPTY"), False):
+                oe.qa.add_message(messages, "rrecommends-non-existant", "{0} -> {1} but won't be build".format(pkg, rec))
+
 def package_qa_check_encoding(keys, encode, d):
     def check_encoding(key, enc):
         sane = True