On Thu, 2017-09-21 at 12:43 +0200, Martin Jansa wrote:
> null and nothing can also be matched in MACHINE names, so to make sure
> people should use:
> 
> COMPATIBLE_MACHINE = "(^$)"
> 
[trimmed]
> > >
> > > COMAPTIBLE_MACHINE uses regexp syntax
> > 
> > Which actually makes that a pretty weird COMPATIBLE_MACHINE,
> > 
> > especially if it is intended for blacklisting.

Yes, I think seeking consensus on the best practice here would make a lot of
sense.  Clearly people copy each other, but there are still *so* many
variants of this out there!

Very often machine overrides are used because there's no real sane way of
adding a specific machine, to the value that is there already:

This is actually written in many places:

COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}"

So if I see it correctly, that's going to apply if and only if MACHINE is
core2-32-intel-common and if so, then the ${MACHINE} regexp will also expand
to "core2-32-intel-common", and then finally bitbake will match that (as a
regexp) against the same $MACHINE name again to see if it yields true
(which it always will)...  I mean it's a little crazy isn't it?

Luckily special characters are usually not used in the machine names, or the
above might have unintended consequences too.

Sometimes the pattern matching is good but most of the time we just to say
basically: IS_COMPATIBLE(mymachinename)!

There are also these variations in various layers:

COMPATIBLE_MACHINE_genericx86 = "genericx86"

and this one seems popular:

# (Always match my string, but using MACHINE override):
COMPATIBLE_MACHINE_x86-64 = "(.*)"

That's a bit more straight forward, but not much.

If it's a true regexp match as Martin indicates with the ^$ example to
exclude non-empty string - presumably then, this syntax is yet another
working alternative because an empty regexp matches, right?

COMPATIBLE_MACHINE_x86-64 = ""

Being able to append your new machine in a sane way would make sense, but
with regexps it seems the reasonable syntax would then be:

COMPATIBLE_MACHINE_append = "|core2-32-intel-common"

Is that right?  And is that syntax also being used?  I'm not sure if that
will result in a valid regexp 100% of the time, but presumably it might
work.

And what is this?  I'm not sure I understand this one...

COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}"


There is legacy and compatibility to consider I understand, but just looking
at it with fresh eyes, this thing seems to beg for a more easy to understand
mechanism.

I wonder if what one might like is a kind of array (of regexps), so you can
add new machines or machine-patterns to it in a sane manner.  Admittedly it
makes it harder to reset/subtract from the value if you want to remove some
previous setting.

Perhaps in a new design I'd consider two mechanisms, one for exact matches,
which could act as a list of words - many other bitbake variables do - and
one for patterns:

COMPATIBLE_MACHINE_EXACT = "first-machine second-machine"
COMPATIBLE_MACHINE_EXACT += " third-machine"

COMPATIBLE_MACHINE_PATTERN = "(.*x86.*)"

Just my 2c, take it for what it's worth.

- Gunnar

-- 
Gunnar Andersson <ganders...@genivi.org>
Development Lead
GENIVI Alliance



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

Reply via email to