insane: Add test for native/nativesdk inherit order

Classes native/nativesdk should be inherited last to prevent unexpected
behaviour.

[YOCTO #5729]

(From OE-Core rev: 55a0197fe62577fd51d41d87822e6d64d85c7680)

Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Tomasz Dziendzielski
2021-01-24 10:55:45 +01:00
committed by Richard Purdie
parent a2a34451c9
commit 0f0c0df633

View File

@@ -27,7 +27,7 @@ WARN_QA ?= " libdir xorg-driver-abi \
infodir build-deps src-uri-bad symlink-to-sysroot multilib \
invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \
mime mime-xdg unlisted-pkg-lics unhandled-features-check \
missing-update-alternatives \
missing-update-alternatives native-last \
"
ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -1366,6 +1366,32 @@ python () {
d.setVarFlag('do_package_qa', 'rdeptask', '')
for i in issues:
package_qa_handle_error("pkgvarcheck", "%s: Variable %s is set as not being package specific, please fix this." % (d.getVar("FILE"), i), d)
for native_class in ['native', 'nativesdk']:
if bb.data.inherits_class(native_class, d):
inherited_classes = d.getVar('__inherit_cache', False) or []
needle = os.path.join('classes', native_class)
bbclassextend = (d.getVar('BBCLASSEXTEND') or '').split()
# BBCLASSEXTEND items are always added in the end
skip_classes = bbclassextend
if bb.data.inherits_class('native', d) or 'native' in bbclassextend:
# native also inherits nopackages and relocatable bbclasses
skip_classes.extend(['nopackages', 'relocatable'])
for class_item in reversed(inherited_classes):
if needle not in class_item:
for extend_item in skip_classes:
if os.path.join('classes', '%s.bbclass' % extend_item) in class_item:
break
else:
pn = d.getVar('PN')
package_qa_handle_error("native-last", "%s: native/nativesdk class is not inherited last, this can result in unexpected behaviour. " % pn, d)
break
else:
break
qa_sane = d.getVar("QA_SANE")
if not qa_sane:
bb.fatal("Fatal QA errors found, failing task.")