Skip to contentSkip to conversation

base.bbclass: Fix matching of MACHINEOVERRIDES in COMPATIBLE_MACHINE

PATCH Superseded Otavio Salvador 3 participants 4 messages Apr 8, 2013 – Apr 9, 2013

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 base.bbclass: Fix matching of MACHINEOVERRIDES in COMPATIBLE_MACHINE

When a MACHINEOVERRIDES has more than one value, split by ':' as usual OVERRIDES, this were not being properly checked in COMPATIBLE_MACHINE matching as we need to iterate over each SoC family and check if it is compatible or not.

---
Changes for v4:
- Fix wrong assignment of compat_machines

 meta/classes/base.bbclass | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
meta/classes/base.bbclass +6 -5
index abd6a52..641316d 100644
@@ -515,11 +515,12 @@ python () {
         need_machine = d.getVar('COMPATIBLE_MACHINE', True)
         if need_machine:
             import re
-            this_machine = d.getVar('MACHINE', True)
-            if this_machine and not re.match(need_machine, this_machine):
-                this_soc_family = d.getVar('SOC_FAMILY', True)
-                if (this_soc_family and not re.match(need_machine, this_soc_family)) or not this_soc_family:
-                    raise bb.parse.SkipPackage("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % this_machine)
+            compat_machines = (d.getVar('MACHINEOVERRIDES', True) or "").split(":")
+            for m in compat_machines:
+                if re.match(need_machine, m):
+                    break
+            else:
+                raise bb.parse.SkipPackage("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % d.getVar('MACHINE', True))
 
 
         bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE', True) or "").split()
Signature · 1 line
1.8.1
#1 lore raw
Quoted 4 lines · Otavio Salvador

When a MACHINEOVERRIDES has more than one value, split by ':' as usual OVERRIDES, this were not being properly checked in COMPATIBLE_MACHINE matching as we need to iterate over each SoC family and check if it is compatible or not.

[...]

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

Quoted 9 lines

import re

meta/classes/base.bbclass +3 -5
-            this_machine = d.getVar('MACHINE', True)
-            if this_machine and not re.match(need_machine, this_machine):
-                this_soc_family = d.getVar('SOC_FAMILY', True)
-                if (this_soc_family and not re.match(need_machine, this_soc_family)) or not this_soc_family:
-                    raise bb.parse.SkipPackage("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % this_machine)
+            compat_machines = (d.getVar('MACHINEOVERRIDES', True) or "").split(":")
+            for m in compat_machines:
+                if re.match(need_machine, m):

The checkin comment above doesn't really capture the semantic changes going on in this patch. The comment implies that there was previously an issue with MACHINEOVERRIDES not being split when it contains multiple entries, but this is misleading: prior to this patch, COMPATIBLE_MACHINE wasn't being matched against MACHINEOVERRIDES at all. So, the effect of this is that anything in MACHINEOVERRIDES (which could potentially be quite a large set of strings) will be considered as a candidate for matching COMPATIBLE_MACHINE.

It's not abundantly clear to me whether this is a good thing or not, but it certainly ought to be accurately described in the commit log.

p.

#2 lore raw
Quoted 27 lines · Phil Blundell
Quoted 4 lines · Otavio Salvador

When a MACHINEOVERRIDES has more than one value, split by ':' as usual OVERRIDES, this were not being properly checked in COMPATIBLE_MACHINE matching as we need to iterate over each SoC family and check if it is compatible or not.

[...]

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

Quoted 9 lines

import re

meta/classes/base.bbclass +3 -5
-            this_machine = d.getVar('MACHINE', True)
-            if this_machine and not re.match(need_machine, this_machine):
-                this_soc_family = d.getVar('SOC_FAMILY', True)
-                if (this_soc_family and not re.match(need_machine, this_soc_family)) or not this_soc_family:
-                    raise bb.parse.SkipPackage("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % this_machine)
+            compat_machines = (d.getVar('MACHINEOVERRIDES', True) or "").split(":")
+            for m in compat_machines:
+                if re.match(need_machine, m):

The checkin comment above doesn't really capture the semantic changes going on in this patch. The comment implies that there was previously an issue with MACHINEOVERRIDES not being split when it contains multiple entries, but this is misleading: prior to this patch, COMPATIBLE_MACHINE wasn't being matched against MACHINEOVERRIDES at all. So, the effect of this is that anything in MACHINEOVERRIDES (which could potentially be quite a large set of strings) will be considered as a candidate for matching COMPATIBLE_MACHINE.

Quoted 2 lines

It's not abundantly clear to me whether this is a good thing or not, but it certainly ought to be accurately described in the commit log.

In fact it was being matched as SOC_FAMILY, in fact, extended MACHINEOVERRIDES. I will send a new version with improved commit log in either case.

--
Otavio Salvador O.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br

#3 lore raw
In reply to Phil Blundell
Quoted 27 lines · Phil Blundell
Quoted 4 lines · Otavio Salvador

When a MACHINEOVERRIDES has more than one value, split by ':' as usual OVERRIDES, this were not being properly checked in COMPATIBLE_MACHINE matching as we need to iterate over each SoC family and check if it is compatible or not.

[...]

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

Quoted 9 lines

import re

meta/classes/base.bbclass +3 -5
-            this_machine = d.getVar('MACHINE', True)
-            if this_machine and not re.match(need_machine, this_machine):
-                this_soc_family = d.getVar('SOC_FAMILY', True)
-                if (this_soc_family and not re.match(need_machine, this_soc_family)) or not this_soc_family:
-                    raise bb.parse.SkipPackage("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % this_machine)
+            compat_machines = (d.getVar('MACHINEOVERRIDES', True) or "").split(":")
+            for m in compat_machines:
+                if re.match(need_machine, m):

The checkin comment above doesn't really capture the semantic changes going on in this patch. The comment implies that there was previously an issue with MACHINEOVERRIDES not being split when it contains multiple entries, but this is misleading: prior to this patch, COMPATIBLE_MACHINE wasn't being matched against MACHINEOVERRIDES at all. So, the effect of this is that anything in MACHINEOVERRIDES (which could potentially be quite a large set of strings) will be considered as a candidate for matching COMPATIBLE_MACHINE.

Quoted 2 lines

It's not abundantly clear to me whether this is a good thing or not, but it certainly ought to be accurately described in the commit log.

Agreed. We're getting close to the release so in this case I've rewritten the commit message since I need to get things pulled together for the -rc build. People do need to think more about commit messages and how to convey the right information in them...

Cheers,

Richard