Thread (14 messages) 14 messages, 5 authors, 2021-02-12

Re: [OE-core] [PATCH 1/2] insane: Add test for native/nativesdk inherit order

From: Martin Jansa <hidden>
Date: 2021-01-27 19:11:38
Subsystem: the rest · Maintainer: Linus Torvalds

Would it make sense to show some shortened version of inherited_classes?

The whole variable is too long, e.g. in my case with:
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 3597943ddd..03481489c3 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -1387,7 +1387,7 @@ python () {
                             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)
+                        package_qa_handle_error("native-last", "%s:
native/nativesdk class is not inherited last, this can result in unexpected
behaviour. Current order: '%s'" % (pn, inherited_classes), d)
                         break
                 else:
                     break

it shows:
WARNING: /jenkins/mjansa/build/ose-github/hardknott/meta-qt5/recipes-qt/qt5/
qtbase-native_git.bb: QA Issue: qtbase-native: native/nativesdk class is
not inherited last, this can result in unexpected behaviour. Current order:
'['/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/image-artifact-names.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/base.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/patch.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/terminal.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/staging.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-webosose/meta-webos/classes/mirrors.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/utils.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/utility-tasks.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/metadata_scm.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/logging.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-virtualization/classes/sanity-meta-virt.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/own-mirrors.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/rm_work.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-updater/classes/sota.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-updater/classes/sota_sanity.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-webosose/meta-webos-raspberrypi/classes/sota_webos-rpi.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/reproducible_build_simple.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/uninative.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/package_ipk.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/package.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/packagedata.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/chrpath.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/package_pkgdata.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/insane.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/buildhistory.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/buildstats.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/image-mklibs.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/linuxloader.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-virtualization/classes/meta-virt-cfg.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-virtualization/classes/meta-virt-k8s-cfg.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-virtualization/classes/meta-virt-xen-cfg.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/debian.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/devshell.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/sstate.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/license.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/buildstats-summary.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-webosose/meta-webos/classes/webos_base.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/remove-libtool.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/image-buildinfo.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/icecc.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/blacklist.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/sanity.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-qt5/classes/qmake5_base.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-qt5/classes/qmake5_paths.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/native.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/relocatable.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/oe-core/meta/classes/nopackages.bbclass',
'/jenkins/mjansa/build/ose-github/hardknott/meta-webosose/meta-webos/classes/webos_qmake5_base.bbclass']'
[native-last]

It would make it a bit easier to find out, what was inheritted after
native/nativesdk as "bitbake -e" doesn't show it very clearly (or I don't
see it there).

Which also points to interesting case caused by
https://github.com/webosose/meta-webosose/blob/master/meta-webos/recipes-qt/qt5/qtbase-native_git.bbappend
which inherits:
https://github.com/webosose/meta-webosose/blob/master/meta-webos/classes/webos_qmake5_base.bbclass
but because it's a bbappend, it's not easy to re-order inherits to make
this QA check happy (the webos_qmake5_base.bbclass should be safe to
inherit after native(sdk) anyway).

So I guess when someone needs to inherit something for native recipe from
bbappend, then the only option is to use .inc file instead of .bbclass or
ignore this warning? Unfortunately INSANE_SKIP doesn't seem to work with
native-last as well. Is this expected?
https://bugzilla.yoctoproject.org/show_bug.cgi?id=5729 doesn't really show
what exact issues this QA check is going to prevent.

Regards,

On Sun, Jan 24, 2021 at 10:53 AM Tomasz Dziendzielski <
tomasz.dziendzielski@gmail.com> wrote:
quoted hunk ↗ jump to hunk
Classes native/nativesdk should be inherited last to prevent unexpected
behaviour.

[YOCTO #5729]

Signed-off-by: Tomasz Dziendzielski <redacted>
---
 meta/classes/insane.bbclass | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 105d2a5ce8..3597943ddd 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -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.")
--
2.29.2



Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help