summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2023-07-27 16:36:10 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-07-30 09:16:52 +0100
commitba961128e2d7d1b4c15daf749ea878efa5cf5da6 (patch)
tree468d5e13ed336e6a00bd48754efe202421437546
parent2c7a4a80215a64934d64c3fe16b139925fed2a86 (diff)
downloadpoky-ba961128e2d7d1b4c15daf749ea878efa5cf5da6.tar.gz
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. (From OE-Core rev: 4144c2f43da39336b03cfd612cbe1694cbf8c7bd) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-global/insane.bbclass16
-rw-r--r--meta/lib/oeqa/selftest/cases/distrodata.py36
2 files changed, 16 insertions, 36 deletions
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index 148ae4b7ad..78506c30b1 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -50,6 +50,7 @@ ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
50# Add usrmerge QA check based on distro feature 50# Add usrmerge QA check based on distro feature
51ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}" 51ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}"
52ERROR_QA:append:layer-core = " patch-status" 52ERROR_QA:append:layer-core = " patch-status"
53WARN_QA:append:layer-core = " missing-metadata"
53 54
54FAKEROOT_QA = "host-user-contaminated" 55FAKEROOT_QA = "host-user-contaminated"
55FAKEROOT_QA[doc] = "QA tests which need to run under fakeroot. If any \ 56FAKEROOT_QA[doc] = "QA tests which need to run under fakeroot. If any \
@@ -1470,6 +1471,21 @@ python do_qa_unpack() {
1470} 1471}
1471 1472
1472python do_recipe_qa() { 1473python do_recipe_qa() {
1474 def test_missing_metadata(d):
1475 fn = d.getVar("FILE")
1476 pn = d.getVar('BPN')
1477 srcfile = d.getVar('SRC_URI').split()
1478 # Check that SUMMARY is not the same as the default from bitbake.conf
1479 if d.getVar('SUMMARY') == d.expand("${PN} version ${PV}-${PR}"):
1480 oe.qa.handle_error("missing-metadata", "Recipe {} in {} does not contain a SUMMARY. Please add an entry.".format(pn, fn), d)
1481 if not d.getVar('HOMEPAGE'):
1482 if srcfile and srcfile[0].startswith('file') or not d.getVar('SRC_URI'):
1483 # We are only interested in recipes SRC_URI fetched from external sources
1484 pass
1485 else:
1486 oe.qa.handle_error("missing-metadata", "Recipe {} in {} does not contain a HOMEPAGE. Please add an entry.".format(pn, fn), d)
1487
1488 test_missing_metadata(d)
1473 oe.qa.exit_if_errors(d) 1489 oe.qa.exit_if_errors(d)
1474} 1490}
1475 1491
diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py b/meta/lib/oeqa/selftest/cases/distrodata.py
index 111bd3c9be..ad952c004b 100644
--- a/meta/lib/oeqa/selftest/cases/distrodata.py
+++ b/meta/lib/oeqa/selftest/cases/distrodata.py
@@ -39,42 +39,6 @@ but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re
39""" + "\n".join(regressed_successes) 39""" + "\n".join(regressed_successes)
40 self.assertTrue(len(regressed_failures) == 0 and len(regressed_successes) == 0, msg) 40 self.assertTrue(len(regressed_failures) == 0 and len(regressed_successes) == 0, msg)
41 41
42 def test_missing_homepg(self):
43 """
44 Summary: Test for oe-core recipes that don't have a HOMEPAGE or DESCRIPTION
45 Expected: All oe-core recipes should have a DESCRIPTION entry
46 Expected: All oe-core recipes should have a HOMEPAGE entry except for recipes that are not fetched from external sources.
47 Product: oe-core
48 """
49 with bb.tinfoil.Tinfoil() as tinfoil:
50 tinfoil.prepare(config_only=False)
51 no_description = []
52 no_homepage = []
53 for fn in tinfoil.all_recipe_files(variants=False):
54 if not '/meta/recipes-' in fn:
55 # We are only interested in OE-Core
56 continue
57 rd = tinfoil.parse_recipe_file(fn, appends=False)
58 pn = rd.getVar('BPN')
59 srcfile = rd.getVar('SRC_URI').split()
60 #Since DESCRIPTION defaults to SUMMARY if not set, we are only interested in recipes without DESCRIPTION or SUMMARY
61 if not (rd.getVar('SUMMARY') or rd.getVar('DESCRIPTION')):
62 no_description.append((pn, fn))
63 if not rd.getVar('HOMEPAGE'):
64 if srcfile and srcfile[0].startswith('file') or not rd.getVar('SRC_URI'):
65 # We are only interested in recipes SRC_URI fetched from external sources
66 continue
67 no_homepage.append((pn, fn))
68 if no_homepage:
69 self.fail("""
70The following recipes do not have a HOMEPAGE. Please add an entry for HOMEPAGE in the recipe.
71""" + "\n".join(['%s (%s)' % i for i in no_homepage]))
72
73 if no_description:
74 self.fail("""
75The following recipes do not have a DESCRIPTION. Please add an entry for DESCRIPTION in the recipe.
76""" + "\n".join(['%s (%s)' % i for i in no_description]))
77
78 def test_maintainers(self): 42 def test_maintainers(self):
79 """ 43 """
80 Summary: Test that oe-core recipes have a maintainer and entries in maintainers list have a recipe 44 Summary: Test that oe-core recipes have a maintainer and entries in maintainers list have a recipe