All of lore.kernel.org
 help / color / mirror / Atom feed
* is standard for COMPATIBLE_MACHINE to use "()" or not?
@ 2015-03-05  8:43 Robert P. J. Day
  2015-03-06  9:14 ` Mike Looijmans
  0 siblings, 1 reply; 6+ messages in thread
From: Robert P. J. Day @ 2015-03-05  8:43 UTC (permalink / raw)
  To: OE Core mailing list


  a style guide thing ... it appears that COMPATIBLE_MACHINE happily
acccepts a matching RE within parentheses or not, is there a
preference?

  also, in checking that, i ran across this in oe-core:

linux-yocto_3.14.bb:COMPATIBLE_MACHINE = "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
linux-yocto_3.19.bb:COMPATIBLE_MACHINE = "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
linux-yocto-dev.bb:COMPATIBLE_MACHINE = "(qemuarm|qemux86|qemuppc|qemumips|qemumips64|qemux86-64)"

where the first two recipes list "qemuarm64" but the dev version
doesn't ... is that deliberate?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: is standard for COMPATIBLE_MACHINE to use "()" or not?
  2015-03-05  8:43 is standard for COMPATIBLE_MACHINE to use "()" or not? Robert P. J. Day
@ 2015-03-06  9:14 ` Mike Looijmans
  2015-03-06  9:19   ` Robert P. J. Day
  2015-03-06  9:35   ` Robert P. J. Day
  0 siblings, 2 replies; 6+ messages in thread
From: Mike Looijmans @ 2015-03-06  9:14 UTC (permalink / raw)
  To: openembedded-core

On 05-03-15 09:43, Robert P. J. Day wrote:
>
>    a style guide thing ... it appears that COMPATIBLE_MACHINE happily
> acccepts a matching RE within parentheses or not, is there a
> preference?
>
>    also, in checking that, i ran across this in oe-core:
>
> linux-yocto_3.14.bb:COMPATIBLE_MACHINE = "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> linux-yocto_3.19.bb:COMPATIBLE_MACHINE = "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> linux-yocto-dev.bb:COMPATIBLE_MACHINE = "(qemuarm|qemux86|qemuppc|qemumips|qemumips64|qemux86-64)"

The regex should have been "qemu(arm|x86|ppc|mips|mips64|x86-64)"

And since "x86-64" already matches "x86", that could have been omitted.

> where the first two recipes list "qemuarm64" but the dev version
> doesn't ... is that deliberate?

Probably not, but "qemuarm64" matches "qemuarm" already.



Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: is standard for COMPATIBLE_MACHINE to use "()" or not?
  2015-03-06  9:14 ` Mike Looijmans
@ 2015-03-06  9:19   ` Robert P. J. Day
  2015-03-06  9:35   ` Robert P. J. Day
  1 sibling, 0 replies; 6+ messages in thread
From: Robert P. J. Day @ 2015-03-06  9:19 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: openembedded-core

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1543 bytes --]

On Fri, 6 Mar 2015, Mike Looijmans wrote:

> On 05-03-15 09:43, Robert P. J. Day wrote:
> >
> >    a style guide thing ... it appears that COMPATIBLE_MACHINE happily
> > acccepts a matching RE within parentheses or not, is there a
> > preference?
> >
> >    also, in checking that, i ran across this in oe-core:
> >
> > linux-yocto_3.14.bb:COMPATIBLE_MACHINE =
> > "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> > linux-yocto_3.19.bb:COMPATIBLE_MACHINE =
> > "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> > linux-yocto-dev.bb:COMPATIBLE_MACHINE =
> > "(qemuarm|qemux86|qemuppc|qemumips|qemumips64|qemux86-64)"
>
> The regex should have been "qemu(arm|x86|ppc|mips|mips64|x86-64)"
>
> And since "x86-64" already matches "x86", that could have been omitted.
>
> > where the first two recipes list "qemuarm64" but the dev version
> > doesn't ... is that deliberate?
>
> Probably not, but "qemuarm64" matches "qemuarm" already.

  by that same standard, i guess "qemumips64" is already matched by
"qemumips" and could also be omitted.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: is standard for COMPATIBLE_MACHINE to use "()" or not?
  2015-03-06  9:14 ` Mike Looijmans
  2015-03-06  9:19   ` Robert P. J. Day
@ 2015-03-06  9:35   ` Robert P. J. Day
  2015-03-06 11:16     ` Mike Looijmans
  1 sibling, 1 reply; 6+ messages in thread
From: Robert P. J. Day @ 2015-03-06  9:35 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: openembedded-core

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2432 bytes --]

On Fri, 6 Mar 2015, Mike Looijmans wrote:

> On 05-03-15 09:43, Robert P. J. Day wrote:
> >
> >    a style guide thing ... it appears that COMPATIBLE_MACHINE happily
> > acccepts a matching RE within parentheses or not, is there a
> > preference?
> >
> >    also, in checking that, i ran across this in oe-core:
> >
> > linux-yocto_3.14.bb:COMPATIBLE_MACHINE =
> > "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> > linux-yocto_3.19.bb:COMPATIBLE_MACHINE =
> > "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> > linux-yocto-dev.bb:COMPATIBLE_MACHINE =
> > "(qemuarm|qemux86|qemuppc|qemumips|qemumips64|qemux86-64)"
>
> The regex should have been "qemu(arm|x86|ppc|mips|mips64|x86-64)"
>
> And since "x86-64" already matches "x86", that could have been omitted.
>
> > where the first two recipes list "qemuarm64" but the dev version
> > doesn't ... is that deliberate?
>
> Probably not, but "qemuarm64" matches "qemuarm" already.

  more nitpcking pedantry, but as i read it from the python code in
base.bbclass:

        need_machine = d.getVar('COMPATIBLE_MACHINE', True)
        if need_machine:
            import re
            compat_machines = (d.getVar('MACHINEOVERRIDES', True) or "").split(":")
            for m in compat_machines:
                if re.match(need_machine, m):
                    break

the "re.match"ing does not implicitly anchor the RE to the beginning
or end of string, correct? it couldn't, or "qemuarm64" could not
possibly match "qemuarm".

  does that not suggest that one should add those anchors to avoid the
(admittedly unlikely) situation where i define a machine named, say,
"rdayqemux86" which, as i read it, will match a "qemux86" machine even
if i didn't want it to? would i then avoid this by setting:

  COMPATIBLE_MACHINE = "^rdayqemu"

to match *all* machines whose names *start* with "rdayqemu"? this
really isn't explained carefully anywhere i can see.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: is standard for COMPATIBLE_MACHINE to use "()" or not?
  2015-03-06  9:35   ` Robert P. J. Day
@ 2015-03-06 11:16     ` Mike Looijmans
  2015-03-06 11:34       ` Robert P. J. Day
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Looijmans @ 2015-03-06 11:16 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: openembedded-core

On 06-03-15 10:35, Robert P. J. Day wrote:
> On Fri, 6 Mar 2015, Mike Looijmans wrote:
>
>> On 05-03-15 09:43, Robert P. J. Day wrote:
>>>
>>>     a style guide thing ... it appears that COMPATIBLE_MACHINE happily
>>> acccepts a matching RE within parentheses or not, is there a
>>> preference?
>>>
>>>     also, in checking that, i ran across this in oe-core:
>>>
>>> linux-yocto_3.14.bb:COMPATIBLE_MACHINE =
>>> "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
>>> linux-yocto_3.19.bb:COMPATIBLE_MACHINE =
>>> "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
>>> linux-yocto-dev.bb:COMPATIBLE_MACHINE =
>>> "(qemuarm|qemux86|qemuppc|qemumips|qemumips64|qemux86-64)"
>>
>> The regex should have been "qemu(arm|x86|ppc|mips|mips64|x86-64)"
>>
>> And since "x86-64" already matches "x86", that could have been omitted.
>>
>>> where the first two recipes list "qemuarm64" but the dev version
>>> doesn't ... is that deliberate?
>>
>> Probably not, but "qemuarm64" matches "qemuarm" already.
>
>    more nitpcking pedantry, but as i read it from the python code in
> base.bbclass:
>
>          need_machine = d.getVar('COMPATIBLE_MACHINE', True)
>          if need_machine:
>              import re
>              compat_machines = (d.getVar('MACHINEOVERRIDES', True) or "").split(":")
>              for m in compat_machines:
>                  if re.match(need_machine, m):
>                      break
>
> the "re.match"ing does not implicitly anchor the RE to the beginning
> or end of string, correct? it couldn't, or "qemuarm64" could not
> possibly match "qemuarm".
>
>    does that not suggest that one should add those anchors to avoid the
> (admittedly unlikely) situation where i define a machine named, say,
> "rdayqemux86" which, as i read it, will match a "qemux86" machine even
> if i didn't want it to? would i then avoid this by setting:
>
>    COMPATIBLE_MACHINE = "^rdayqemu"
>
> to match *all* machines whose names *start* with "rdayqemu"? this
> really isn't explained carefully anywhere i can see.

Well, I got my knowledge the hard way too (getting hit with unexpected results 
and then looking into the source code).

Without further hints, I think over 90% of the users think that 
COMPATIBLE_MACHINE does an exact match, not a regex match, and when they see 
the "|" in some recipes, they just assume some code will do a 
string.split('|') on it.

I wonder if the actual intention of that long qemu mach was "all QEMU 
machines", in which case the expression could have been simply "qemu" or 
better "^qemu".



Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: is standard for COMPATIBLE_MACHINE to use "()" or not?
  2015-03-06 11:16     ` Mike Looijmans
@ 2015-03-06 11:34       ` Robert P. J. Day
  0 siblings, 0 replies; 6+ messages in thread
From: Robert P. J. Day @ 2015-03-06 11:34 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: openembedded-core

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3433 bytes --]

On Fri, 6 Mar 2015, Mike Looijmans wrote:

> On 06-03-15 10:35, Robert P. J. Day wrote:
> > On Fri, 6 Mar 2015, Mike Looijmans wrote:
> >
> > > On 05-03-15 09:43, Robert P. J. Day wrote:
> > > >
> > > >     a style guide thing ... it appears that COMPATIBLE_MACHINE happily
> > > > acccepts a matching RE within parentheses or not, is there a
> > > > preference?
> > > >
> > > >     also, in checking that, i ran across this in oe-core:
> > > >
> > > > linux-yocto_3.14.bb:COMPATIBLE_MACHINE =
> > > > "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> > > > linux-yocto_3.19.bb:COMPATIBLE_MACHINE =
> > > > "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> > > > linux-yocto-dev.bb:COMPATIBLE_MACHINE =
> > > > "(qemuarm|qemux86|qemuppc|qemumips|qemumips64|qemux86-64)"
> > >
> > > The regex should have been "qemu(arm|x86|ppc|mips|mips64|x86-64)"
> > >
> > > And since "x86-64" already matches "x86", that could have been omitted.
> > >
> > > > where the first two recipes list "qemuarm64" but the dev version
> > > > doesn't ... is that deliberate?
> > >
> > > Probably not, but "qemuarm64" matches "qemuarm" already.
> >
> >    more nitpcking pedantry, but as i read it from the python code in
> > base.bbclass:
> >
> >          need_machine = d.getVar('COMPATIBLE_MACHINE', True)
> >          if need_machine:
> >              import re
> >              compat_machines = (d.getVar('MACHINEOVERRIDES', True) or
> >              "").split(":")
> >              for m in compat_machines:
> >                  if re.match(need_machine, m):
> >                      break
> >
> > the "re.match"ing does not implicitly anchor the RE to the beginning
> > or end of string, correct? it couldn't, or "qemuarm64" could not
> > possibly match "qemuarm".
> >
> >    does that not suggest that one should add those anchors to avoid the
> > (admittedly unlikely) situation where i define a machine named, say,
> > "rdayqemux86" which, as i read it, will match a "qemux86" machine even
> > if i didn't want it to? would i then avoid this by setting:
> >
> >    COMPATIBLE_MACHINE = "^rdayqemu"
> >
> > to match *all* machines whose names *start* with "rdayqemu"? this
> > really isn't explained carefully anywhere i can see.
>
> Well, I got my knowledge the hard way too (getting hit with
> unexpected results and then looking into the source code).
>
> Without further hints, I think over 90% of the users think that
> COMPATIBLE_MACHINE does an exact match, not a regex match, and when
> they see the "|" in some recipes, they just assume some code will do
> a string.split('|') on it.
>
> I wonder if the actual intention of that long qemu mach was "all
> QEMU machines", in which case the expression could have been simply
> "qemu" or better "^qemu".

  i was going to suggest *exactly* the same thing, but i wanted to
make sure i understood the precise mechanics of the re matching first.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-06 11:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-05  8:43 is standard for COMPATIBLE_MACHINE to use "()" or not? Robert P. J. Day
2015-03-06  9:14 ` Mike Looijmans
2015-03-06  9:19   ` Robert P. J. Day
2015-03-06  9:35   ` Robert P. J. Day
2015-03-06 11:16     ` Mike Looijmans
2015-03-06 11:34       ` Robert P. J. Day

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.