Skip to contentSkip to conversation

base.bbclass: Fix COMPATIBLE_MACHINE for -native recipe variants.

PATCH In review Paulo Neves 2 participants 2 messages Jan 12, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 base.bbclass: Fix COMPATIBLE_MACHINE for -native recipe variants.

From: Paulo Neves <[email protected]>

Hello I am having a problem where I want a recipe, along with its -native version to only be available when allowed by compatible machine.

In the non native case, COMPATIBLE_MACHINE is correctly honored. But in the -native version the COMPATIBLE_MACHINE is not honored because in the native.bbclass there is:

MACHINEOVERRIDES = ""

This change was introduced in d09e6d883042e5d094cd08d829327c4bbbfae135.
While the explanation provided by the commit is accurate for specific case mentioned it also breaks the COMPATIBLE_MACHINE mechanism which relies on the MACHINEOVERRIDES variable.

Further evidence that this was not intended is that the exception text is false:

ERROR: Nothing PROVIDES 'x-filter-native' x-filter-native was skipped: incompatible with machine m1 (not in COMPATIBLE_MACHINE)

And the x-filter-native'.bb recipe header contains:

COMPATIBLE_MACHINE = "^m1$"

So the exception uses ${MACHINE} to report that a ${MACHINEOVERRIDE} was not matched with the COMPATIBLE_MACHINE, which is a false statement.

This fix attempts to correct the issue with minimal changes.

---
 meta/classes/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/base.bbclass +1 -1
index d95afb7..d1c31c2 100644
@@ -488,7 +488,7 @@ python () {
     need_machine = d.getVar('COMPATIBLE_MACHINE')
     if need_machine:
         import re
-        compat_machines = (d.getVar('MACHINEOVERRIDES') or "").split(":")
+        compat_machines = (d.getVar('MACHINEOVERRIDES') or d.getVar('MACHINE')).split(":")
         for m in compat_machines:
             if re.match(need_machine, m):
                 break
Signature · 1 line
2.7.4
#1 lore raw
Quoted 47 lines · Paulo Neves

From: Paulo Neves <[email protected]>

Hello I am having a problem where I want a recipe, along with its -native version to only be available when allowed by compatible machine.

In the non native case, COMPATIBLE_MACHINE is correctly honored. But in the -native version the COMPATIBLE_MACHINE is not honored because in the native.bbclass there is:

MACHINEOVERRIDES = ""

This change was introduced in d09e6d883042e5d094cd08d829327c4bbbfae135.
While the explanation provided by the commit is accurate for specific case mentioned it also breaks the COMPATIBLE_MACHINE mechanism which relies on the MACHINEOVERRIDES variable.

Further evidence that this was not intended is that the exception text is false:

ERROR: Nothing PROVIDES 'x-filter-native' x-filter-native was skipped: incompatible with machine m1 (not in COMPATIBLE_MACHINE)

And the x-filter-native'.bb recipe header contains:

COMPATIBLE_MACHINE = "^m1$"

So the exception uses ${MACHINE} to report that a ${MACHINEOVERRIDE} was not matched with the COMPATIBLE_MACHINE, which is a false statement.

This fix attempts to correct the issue with minimal changes.

---
 meta/classes/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/base.bbclass +0 -0
index d95afb7..d1c31c2 100644

meta/classes/base.bbclass python () { · line 491

Quoted 5 lines
meta/classes/base.bbclass +1 -1
@@ -488,7 +488,7 @@ python () {
     need_machine = d.getVar('COMPATIBLE_MACHINE')
     if need_machine:
         import re
-        compat_machines = (d.getVar('MACHINEOVERRIDES') or "").split(":")
+        compat_machines = (d.getVar('MACHINEOVERRIDES') or d.getVar('MACHINE')).split(":")

This test used to be against MACHINE but was changed to MACHINEOVERRIDES under the assumption that MACHINEOVERRIDES always contains MACHINE.

http://git.openembedded.org/openembedded-core/commit/?id=8ceef74dd4f662b4c7e3c170ce486e966ebebeff

Reverting back to the way things were done prior to that commit (ie explicitly testing both MACHINE and SOC_FAMILY and not relying on MACHINEOVERRIDES to contain them both) may be the more complete solution (ie fixes the issue if COMPATIBLE_MACHINE is defined in terms of SOC_FAMILY).

Forcing COMPATIBLE_MACHINE to "" in native.bbclass might be even better.

Quoted 11 lines
meta/classes/base.bbclass +0 -1
         for m in compat_machines:
             if re.match(need_machine, m):
                 break
--

2.7.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core