Skip to contentSkip to conversation

insane.bbclass: add a SUMMARY/HOMEPAGE check (oe-core recipes only)

PATCH In review Alexander Kanavin 3 participants 9 messages Apr 27, 2023 – May 5, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 insane.bbclass: add a SUMMARY/HOMEPAGE check (oe-core recipes only)

This was done in a selftest, but that is too late and creates friction in integration as errors are not seen until autobuilder fails.

Bonus fix: SUMMARY check wasn't even working, as in the absence of one set in the recipe there is a default value set from bitbake.conf.

I left DESCRIPTION check out for now, as many recipes don't actually have it, and it's set from SUMMARY (plus a dot) if absent.

---
 meta/classes-global/insane.bbclass         | 27 +++++++++++++++-
 meta/lib/oeqa/selftest/cases/distrodata.py | 36 ----------------------
 2 files changed, 26 insertions(+), 37 deletions(-)
meta/classes-global/insane.bbclass +26 -1
index ee34d5208d1..64ad76c48e9 100644
@@ -44,7 +44,7 @@ ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
             already-stripped installed-vs-shipped ldflags compile-host-path \
             install-host-path pn-overrides unknown-configure-option \
             useless-rpaths rpaths staticdev empty-dirs \
-            patch-fuzz patch-status-core\
+            patch-fuzz patch-status-core missing-metadata \
             "
 # Add usrmerge QA check based on distro feature
 ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}"
@@ -1481,6 +1481,28 @@ python do_qa_unpack() {
     unpack_check_src_uri(d.getVar('PN'), d)
 }
 
+python do_qa_fetch() {
+    def test_missing_metadata(d):
+        fn = d.getVar("FILE")
+        if not '/meta/recipes-' in fn:
+            # We are only interested in OE-Core
+            return
+        pn = d.getVar('BPN')
+        srcfile = d.getVar('SRC_URI').split()
+        # Check that SUMMARY is not the same as the default from bitbake.conf
+        if d.getVar('SUMMARY') == d.expand("${PN} version ${PV}-${PR}"):
+            oe.qa.handle_error("missing-metadata", "Recipe {} in {} does not contain a SUMMARY. Please add an entry.".format(pn, fn), d)
+        if not d.getVar('HOMEPAGE'):
+            if srcfile and srcfile[0].startswith('file') or not d.getVar('SRC_URI'):
+                # We are only interested in recipes SRC_URI fetched from external sources
+                pass
+            else:
+                oe.qa.handle_error("missing-metadata", "Recipe {} in {} does not contain a HOMEPAGE. Please add an entry.".format(pn, fn), d)
+
+    test_missing_metadata(d)
+    oe.qa.exit_if_errors(d)
+}
+
 # Check for patch fuzz
 do_patch[postfuncs] += "do_qa_patch "
 
@@ -1492,6 +1514,9 @@ do_configure[postfuncs] += "do_qa_configure "
 # Check does S exist.
 do_unpack[postfuncs] += "do_qa_unpack"
 
+# Check basic recipe metadata (e.g. SUMMARY/HOMEPAGE/RECIPE_MAINTAINER)
+do_fetch[postfuncs] += "do_qa_fetch"
+
 python () {
     import re
     
meta/lib/oeqa/selftest/cases/distrodata.py +0 -36
index b5554a6c3c3..b443f2d3af6 100644
@@ -39,42 +39,6 @@ but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re
 """ + "\n".join(regressed_successes)
         self.assertTrue(len(regressed_failures) == 0 and len(regressed_successes) == 0, msg)
 
-    def test_missing_homepg(self):
-        """
-        Summary:     Test for oe-core recipes that don't have a HOMEPAGE or DESCRIPTION
-        Expected:    All oe-core recipes should have a DESCRIPTION entry
-        Expected:    All oe-core recipes should have a HOMEPAGE entry except for recipes that are not fetched from external sources.
-        Product:     oe-core
-        """
-        with bb.tinfoil.Tinfoil() as tinfoil:
-            tinfoil.prepare(config_only=False)
-            no_description = []
-            no_homepage = []
-            for fn in tinfoil.all_recipe_files(variants=False):
-                if not '/meta/recipes-' in fn:
-                    # We are only interested in OE-Core
-                    continue
-                rd = tinfoil.parse_recipe_file(fn, appends=False)
-                pn = rd.getVar('BPN')
-                srcfile = rd.getVar('SRC_URI').split()
-                #Since DESCRIPTION defaults to SUMMARY if not set, we are only interested in recipes without DESCRIPTION or SUMMARY
-                if not (rd.getVar('SUMMARY') or rd.getVar('DESCRIPTION')):
-                    no_description.append((pn, fn))
-                if not rd.getVar('HOMEPAGE'):
-                    if srcfile and srcfile[0].startswith('file') or not rd.getVar('SRC_URI'):
-                        # We are only interested in recipes SRC_URI fetched from external sources
-                        continue
-                    no_homepage.append((pn, fn))
-        if no_homepage:
-            self.fail("""
-The following recipes do not have a HOMEPAGE. Please add an entry for HOMEPAGE in the recipe.
-""" + "\n".join(['%s (%s)' % i for i in no_homepage]))
-
-        if no_description:
-            self.fail("""
-The following recipes do not have a DESCRIPTION. Please add an entry for DESCRIPTION in the recipe.
-""" + "\n".join(['%s (%s)' % i for i in no_description]))
-
     def test_maintainers(self):
         """
         Summary:     Test that oe-core recipes have a maintainer and entries in maintainers list have a recipe
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/5 selftest/distrodata: clean up exception lists in recipe maintainers test

Specifically:
- add missing maintainer.inc entries for initramfs-module-*, systemd-machine-units and target-sdk-provides-dummy and drop them from exception list.

- remove rust from exception list for unbuildable-by-default recipes as it is now buildable.

- add missing maintainer.inc entry for libx11-compose-data and cve-update-nvd2-native; as they are also unbuildable by default, they needs to be in exception list as well.

---
 meta/conf/distro/include/maintainers.inc   | 7 +++++++
 meta/lib/oeqa/selftest/cases/distrodata.py | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)
meta/conf/distro/include/maintainers.inc +7 -0
index 682ec2cfdfb..66f8eb6af3e 100644
@@ -129,6 +129,7 @@ RECIPE_MAINTAINER:pn-cryptodev-tests = "Robert Yang <[email protected]>"
 RECIPE_MAINTAINER:pn-cups = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-curl = "Robert Joslyn <[email protected]>"
 RECIPE_MAINTAINER:pn-cve-update-db-native = "Ross Burton <[email protected]>"
+RECIPE_MAINTAINER:pn-cve-update-nvd2-native = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-cwautomacros = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-db = "Unassigned <[email protected]>"
 RECIPE_MAINTAINER:pn-dbus = "Chen Qi <[email protected]>"
@@ -278,6 +279,9 @@ RECIPE_MAINTAINER:pn-initramfs-live-install = "Anuj Mittal <[email protected]
 RECIPE_MAINTAINER:pn-initramfs-live-install-efi = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-initramfs-live-install-efi-testfs = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-initramfs-live-install-testfs = "Anuj Mittal <[email protected]>"
+RECIPE_MAINTAINER:pn-initramfs-module-install = "Anuj Mittal <[email protected]>"
+RECIPE_MAINTAINER:pn-initramfs-module-install-efi = "Anuj Mittal <[email protected]>"
+RECIPE_MAINTAINER:pn-initramfs-module-setup-live = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-initscripts = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-intltool = "Alexander Kanavin <[email protected]>"
 RECIPE_MAINTAINER:pn-iproute2 = "Changhyeok Bae <[email protected]>"
@@ -419,6 +423,7 @@ RECIPE_MAINTAINER:pn-libvorbis = "Zang Ruochen <[email protected]>"
 RECIPE_MAINTAINER:pn-libwebp = "Alexander Kanavin <[email protected]>"
 RECIPE_MAINTAINER:pn-libwpe = "Alexander Kanavin <[email protected]>"
 RECIPE_MAINTAINER:pn-libx11 = "Unassigned <[email protected]>"
+RECIPE_MAINTAINER:pn-libx11-compose-data = "Unassigned <[email protected]>"
 RECIPE_MAINTAINER:pn-libxau = "Unassigned <[email protected]>"
 RECIPE_MAINTAINER:pn-libxcb = "Unassigned <[email protected]>"
 RECIPE_MAINTAINER:pn-libxcvt = "Oleksandr Kravchuk <[email protected]>"
@@ -774,6 +779,7 @@ RECIPE_MAINTAINER:pn-systemd-bootchart = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-bootconf = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-conf = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-compat-units = "Chen Qi <[email protected]>"
+RECIPE_MAINTAINER:pn-systemd-machine-units = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-serialgetty = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-systemctl-native = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemtap = "Victor Kamensky <[email protected]>"
@@ -783,6 +789,7 @@ RECIPE_MAINTAINER:pn-sysvinit = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-sysvinit-inittab = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-taglib = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-tar = "Chen Qi <[email protected]>"
+RECIPE_MAINTAINER:pn-target-sdk-provides-dummy = "Richard Purdie <[email protected]>"
 RECIPE_MAINTAINER:pn-tcf-agent = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-tcl = "Yi Zhao <[email protected]>"
 RECIPE_MAINTAINER:pn-tcp-wrappers = "Robert Yang <[email protected]>"
meta/lib/oeqa/selftest/cases/distrodata.py +3 -3
index b443f2d3af6..fd262fe3c9e 100644
@@ -48,15 +48,15 @@ but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re
         Author:      Alexander Kanavin <[email protected]>
         """
         def is_exception(pkg):
-            exceptions = ["packagegroup-", "initramfs-", "systemd-machine-units", "target-sdk-provides-dummy"]
+            exceptions = ["packagegroup-",]
             for i in exceptions:
                  if i in pkg:
                      return True
             return False
 
         def is_maintainer_exception(entry):
-            exceptions = ["musl", "newlib", "linux-yocto", "linux-dummy", "mesa-gl", "libgfortran",
-                          "cve-update-db-native", "rust"]
+            exceptions = ["musl", "newlib", "linux-yocto", "linux-dummy", "mesa-gl", "libgfortran", "libx11-compose-data",
+                          "cve-update-db-native","cve-update-nvd2-native",]
             for i in exceptions:
                  if i in entry:
                      return True
Signature · 1 line
2.30.2
#2 lore raw

PATCH 3/5 insane.bbclass: add a RECIPE_MAINTAINER check (oe-core recipes only)

In reply to Alexander Kanavin

Absent maintainer entries are as well a frequent source of friction, as they are checked only in selftest, and so aren't revealed until autobuilder runs.

The selftest is retained as it also checks for obsolete entries in maintainers.inc (not possible to do in insane class).

---
 meta/classes-global/insane.bbclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)
meta/classes-global/insane.bbclass +12 -0
index 64ad76c48e9..0847fb0807a 100644
@@ -1499,7 +1499,19 @@ python do_qa_fetch() {
             else:
                 oe.qa.handle_error("missing-metadata", "Recipe {} in {} does not contain a HOMEPAGE. Please add an entry.".format(pn, fn), d)
 
+    def test_missing_maintainer(d):
+        fn = d.getVar("FILE")
+        if not '/meta/recipes-' in fn:
+            # We are only interested in OE-Core
+            return
+        pn = d.getVar("PN")
+        if pn.endswith("-native") or pn.startswith("nativesdk-"):
+            return
+        if not d.getVar('RECIPE_MAINTAINER'):
+            oe.qa.handle_error("missing-metadata", "Recipe {} in {} does not have an assigned maintainer. Please add an entry into meta/conf/distro/include/maintainers.inc.".format(pn, fn), d)
+
     test_missing_metadata(d)
+    test_missing_maintainer(d)
     oe.qa.exit_if_errors(d)
 }
 
Signature · 1 line
2.30.2
#3 lore raw

Re: [OE-core] [PATCH 3/5] insane.bbclass: add a RECIPE_MAINTAINER check (oe-core recipes only)

Quoted 8 lines · Alexander Kanavin

Absent maintainer entries are as well a frequent source of friction, as they are checked
only in selftest, and so aren't revealed until autobuilder runs.

The selftest is retained as it also checks for obsolete entries in maintainers.inc
(not possible to do in insane class).

I've seen many errors triggered by this and was wondering what's going on and it's caused by meta-security layers which provide own conf/distro/include/maintainers.inc:

meta-security $ find . -name maintainers.inc
./meta-tpm/conf/distro/include/maintainers.inc
./conf/distro/include/maintainers.inc

So this doesn't work well with:
meta/conf/distro/defaultsetup.conf:include
conf/distro/include/maintainers.inc

as it "replaces" the file instead of adding more RECIPE_MAINTAINERs.

I think this should be fixed somehow before this gets enabled in oe-core.

#4 lore raw

Re: [OE-core] [PATCH 3/5] insane.bbclass: add a RECIPE_MAINTAINER check (oe-core recipes only)

Quoted 6 lines · Martin Jansa

I've seen many errors triggered by this and was wondering what's going on and it's caused by meta-security layers which provide own conf/distro/include/maintainers.inc:

meta-security $ find . -name maintainers.inc
./meta-tpm/conf/distro/include/maintainers.inc
./conf/distro/include/maintainers.inc

Quoted 6 lines

So this doesn't work well with:
meta/conf/distro/defaultsetup.conf:include conf/distro/include/maintainers.inc

as it "replaces" the file instead of adding more RECIPE_MAINTAINERs.

I think this should be fixed somehow before this gets enabled in oe-core.

I sent a patch for this to yocto@ list.

Alex

#5 lore raw

PATCH 4/5 dhcpcd: use git instead of tarballs

In reply to Alexander Kanavin

As announced here:
https://roy.marples.name/downloads/dhcpcd/

---
 meta/recipes-connectivity/dhcpcd/dhcpcd_9.4.1.bb | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
meta/recipes-connectivity/dhcpcd/dhcpcd_9.4.1.bb +3 -4
index 579fa95df70..21b2eebbd8a 100644
@@ -9,9 +9,7 @@ HOMEPAGE = "http://roy.marples.name/projects/dhcpcd/"
 LICENSE = "BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=d148485768fe85b9f1072b186a7e9b4d"
 
-UPSTREAM_CHECK_URI = "https://roy.marples.name/downloads/dhcpcd/"
-
-SRC_URI = "https://roy.marples.name/downloads/${BPN}/${BPN}-${PV}.tar.xz \
+SRC_URI = "git://github.com/NetworkConfiguration/dhcpcd;protocol=https;branch=dhcpcd-9 \
            file://0001-remove-INCLUDEDIR-to-prevent-build-issues.patch \
            file://0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch \
            file://0001-privsep-Allow-getrandom-sysctl-for-newer-glibc.patch \
@@ -22,7 +20,8 @@ SRC_URI = "https://roy.marples.name/downloads/${BPN}/${BPN}-${PV}.tar.xz \
            file://0001-dhcpcd.8-Fix-conflict-error-when-enable-multilib.patch \
            "
 
-SRC_URI[sha256sum] = "819357634efed1ea5cf44ec01b24d3d3f8852fec8b4249925dcc5667c54e376c"
+SRCREV = "3c458fc7fa4146029a1e4f9e98cd7e7adf03081a"
+S = "${WORKDIR}/git"
 
 inherit pkgconfig autotools-brokensep systemd useradd
 
Signature · 1 line
2.30.2
#6 lore raw

PATCH 5/5 perl: patch out build paths from native binaries

In reply to Alexander Kanavin
---
 meta/recipes-devtools/perl/perl_5.36.0.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-devtools/perl/perl_5.36.0.bb +4 -0
index 4d8a919d1ee..b8dba00f188 100644
@@ -109,6 +109,10 @@ do_configure:class-native() {
     -Ui_xlocale \
     -Alddlflags=' ${LDFLAGS}' \
     ${PACKAGECONFIG_CONFARGS}
+
+    # This prevents leakage of build paths into perl-native binaries, which
+    # causes non-deterministic troubles when those paths no longer exist or aren't accessible.
+    sed -i -e "s,${STAGING_LIBDIR},/completelyboguspath,g" config.h
 }
 
 do_configure:append() {
Signature · 1 line
2.30.2
#7 lore raw
In reply to Alexander Kanavin
Quoted 9 lines · Alexander Kanavin via lists.openembedded.org

This was done in a selftest, but that is too late and creates friction in integration as errors are not seen until autobuilder fails.

Bonus fix: SUMMARY check wasn't even working, as in the absence of one set in the recipe there is a default value set from bitbake.conf.

I left DESCRIPTION check out for now, as many recipes don't actually have it, and it's set from SUMMARY (plus a dot) if absent.

I’m torn over this and the maintainer check. I like that the checks are being done earlier so they don’t trip up in oe-selftest, but I don’t like that they’re errors.

If I want to add a new recipe to core and use devtool, it will immediately fail to build with errors due to the summary, homepage, and maintainer fields being missing. For this reason, I believe these should be warnings: they tell you that something needs to be done, but you can focus first on making a recipe that *compiles* before having to write a nice summary.

Ross

#8 lore raw
Quoted 3 lines · Ross Burton

I’m torn over this and the maintainer check. I like that the checks are being done earlier so they don’t trip up in oe-selftest, but I don’t like that they’re errors.

If I want to add a new recipe to core and use devtool, it will immediately fail to build with errors due to the summary, homepage, and maintainer fields being missing. For this reason, I believe these should be warnings: they tell you that something needs to be done, but you can focus first on making a recipe that *compiles* before having to write a nice summary.

No problem. I'll correct that.

Alex