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.

My solution is very simple and does not break the fix that
d09e6d883042e5d094cd08d829327c4bbbfae135 did:
From 8b78c81dc1d21bc23aeb1387c201e090f031a14a Mon Sep 17 00:00:00 2001
From: Paulo Neves <paulo.de_sousa_ne...@nokia.com>
Date: Fri, 12 Jan 2018 15:58:39 +0100
Subject: [PATCH 1/1] Fix COMPATIBLE_MACHINE for -native recipe variants.

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.

Change-Id: If5085e4e92550b8154033dd56149eb4e358ef266
---
 meta/classes/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index c3c2669939c6f0b9080727378a26a324072d7e51..b4051102d0eccfb576d8b76f6f47ce8cd763af55 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -473,7 +473,7 @@ python () {
     need_machine = d.getVar('COMPATIBLE_MACHINE', True)
     if need_machine:
         import re
-        compat_machines = (d.getVar('MACHINEOVERRIDES', True) or "").split(":")
+        compat_machines = (d.getVar('MACHINEOVERRIDES', True) or d.getVar('MACHINE', True)).split(":")
         for m in compat_machines:
             if re.match(need_machine, m):
                 break
-- 
2.6.2

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to