Since the order of inheriting native/nativesdk is important, rather than adding warnings about when it is done in the wrong order, which conflicts with bbappends that want to add inherit statements for native recipes, wouldn’t it make sense to instead handle this properly in the code so that native/nativesdk are always inherited last. An idea to solve this would be to rename native.bbclass and nativesdk.bbclass to, e.g., native-internal.bbclass and nativesdk-internal.bbclass, and then make the original classes only set a special variable (similar to BBCLASSEXTEND), and then later when it is appropriate check this variable and import the native-internal/nativesdk-internal class.

 

//Peter

 

From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Tomasz Dziendzielski
Sent: den 11 februari 2021 11:30
To: Konrad Weihmann <kweihmann@outlook.com>
Cc: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH 1/2] insane: Add test for native/nativesdk inherit order

 

>After this patch got merged I notice some "noise" in my builds.
>
>For bbappends which inherit unrelated classes I get a lot of warning like
>
>Issue: nativesdk-openssh: native/nativesdk class is not inherited last,
>this can result in unexpected behaviour. Classes inherited after
>native/nativesdk: my-custom-class.bbclass [native-last]
>
>First it doesn't give any hint that this is caused by the bbappend and
>secondly I have no idea how to fix that (if that is even possible).
>
>So I would like to have at least an option to ignore these warnings for
>classes I'm sure don't cause any conflict - something more granular then
>just to deactivate this pretty useful check.
>

>Thoughts?

 

I think it's a good idea to just ignore specific classes. The diff below should be enough, with some additional note in the warning message. I'll check if it works correctly later today.

 

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 53230fc667..2f53a9be09 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -1381,6 +1381,10 @@ python () {
                     # native also inherits nopackages and relocatable bbclasses
                     skip_classes.extend(['nopackages', 'relocatable'])
 
+                extra_skip_classes = (d.getVar('NATIVE_LAST_IGNORE_CLASSES') or '').split()
+                if extra_skip_classes:
+                    skip_classes.extend(extra_skip_classes)
+
                 broken_order = []
                 for class_item in reversed(inherited_classes):
                     if needle not in class_item:

 

Best regards,

Tomasz Dziendzielski