insane: add test for recipe naming/class mismatches

It's not unheard of for new users to create a recipe called foo-native
that has BBCLASSEXTEND="native" instead of "inherit native". This will
result in a foo-native recipe that is actually a target recipe, and a
foo-native-native recipe for native builds.

Add a test in recipe_qa to verify that recipes called -native inherit
native, and recipes called nativesdk- inherit nativesdk.

As this behaviour is expected, add the new test to the set of tests
required to pass for Yocto Project Compatible status.

(From OE-Core rev: ec2c10a3e85d0772135289fe416d13fa3afca571)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton 2025-06-05 21:11:51 +01:00 committed by Richard Purdie
parent dfb58eeeab
commit 8644f202a1

View File

@ -32,7 +32,7 @@ CHECKLAYER_REQUIRED_TESTS = "\
invalid-packageconfig la \ invalid-packageconfig la \
license-checksum license-exception license-exists license-file-missing license-format license-no-generic license-syntax \ license-checksum license-exception license-exists license-file-missing license-format license-no-generic license-syntax \
mime mime-xdg missing-update-alternatives multilib obsolete-license \ mime mime-xdg missing-update-alternatives multilib obsolete-license \
packages-list patch-fuzz patch-status perllocalpod perm-config perm-line perm-link \ packages-list patch-fuzz patch-status perllocalpod perm-config perm-line perm-link recipe-naming \
pkgconfig pkgvarcheck pkgv-undefined pn-overrides shebang-size src-uri-bad symlink-to-sysroot \ pkgconfig pkgvarcheck pkgv-undefined pn-overrides shebang-size src-uri-bad symlink-to-sysroot \
unhandled-features-check unknown-configure-option unlisted-pkg-lics uppercase-pn useless-rpaths \ unhandled-features-check unknown-configure-option unlisted-pkg-lics uppercase-pn useless-rpaths \
var-undefined virtual-slash xorg-driver-abi" var-undefined virtual-slash xorg-driver-abi"
@ -1438,6 +1438,12 @@ python do_qa_unpack() {
python do_recipe_qa() { python do_recipe_qa() {
import re import re
def test_naming(pn, d):
if pn.endswith("-native") and not bb.data.inherits_class("native", d):
oe.qa.handle_error("recipe-naming", "Recipe %s appears native but is not, should inherit native" % pn, d)
if pn.startswith("nativesdk-") and not bb.data.inherits_class("nativesdk", d):
oe.qa.handle_error("recipe-naming", "Recipe %s appears nativesdk but is not, should inherit nativesdk" % pn, d)
def test_missing_metadata(pn, d): def test_missing_metadata(pn, d):
fn = d.getVar("FILE") fn = d.getVar("FILE")
srcfile = d.getVar('SRC_URI').split() srcfile = d.getVar('SRC_URI').split()
@ -1482,6 +1488,7 @@ python do_recipe_qa() {
oe.qa.handle_error("invalid-packageconfig", error_msg, d) oe.qa.handle_error("invalid-packageconfig", error_msg, d)
pn = d.getVar('PN') pn = d.getVar('PN')
test_naming(pn, d)
test_missing_metadata(pn, d) test_missing_metadata(pn, d)
test_missing_maintainer(pn, d) test_missing_maintainer(pn, d)
test_srcuri(pn, d) test_srcuri(pn, d)