[OE-core] a few questions about "COMPATIBLE_MACHINE" variable
Robert P. J. Day
rpjday at crashcourse.ca
Mon Dec 19 20:33:55 UTC 2016
On Mon, 19 Dec 2016, Christopher Larson wrote:
> On Mon, Dec 19, 2016 at 10:56 AM, Robert P. J. Day <rpjday at crashcourse.ca> wrote:
> i suspected as much. still, would consistency dictate using
> parentheses or not? just a style thing.
>
>
> I think it’s largely personal preference. Personally, using a
> capture when we don’t need one is ugly to me, so I’d rather see it
> only used when needed, but that’s just my opinion. The upside to
> always using a capture is it makes it clearer, at a glance, to a new
> user that it’s not just a word or list of words, but a regular
> expression.
i can see both sides, but my concern (as it always is) is
consistency. when beginners are starting out, it's tempting to RTFS to
see how things are done, and if you see more than one style, there's
the potential for confusion as the poor reader thinks, "is there a
*reason* the same thing is being done two different ways? is there
something magical about those parentheses that the documentation
doesn't explain?"
i realize that (as with perl) there's more than one way to do
things. doesn't mean we need to.
> > next, if the possibilities in a list are REs, what is the
> > point of explicitly listing, say, "qemuarm|qemuarm64"? would
> > not the RE "qemuarm" subsume the more explicit "qemuarm64"?
> > same for the other architectures. (one could suggest that that
> > entire line could be shortened to "... = (^qemu)".)
> >
> > Just qemu would potentially match future qemu machines which aren’t
> > actually supported, so I don’t think that would be appropriate. It’d
> > match too much.
>
> i realized that, i was just being technical. :-) in any event, as it
> is, it would *still* match too much, anything starting with
> "qemuarm", for example.
>
> Good point, yes.
>
> > the above seems pretty clear since the following lines would appear
> > to say that *only* the qemux86 is compatible:
> >
> > linux-yocto-tiny_4.1.bb:COMPATIBLE_MACHINE = "(qemux86$)"
> > linux-yocto-tiny_4.4.bb:COMPATIBLE_MACHINE = "(qemux86$)"
> > linux-yocto-tiny_4.8.bb:COMPATIBLE_MACHINE = "(qemux86$)"
> >
> > which suggests the following passage from the YP kernel dev manual is
> > a bit misleading:
> >
> > "You must change it to match a list of the machines that your new
> > recipe supports. For example, to support the qemux86 and qemux86-64
> > machines, use the following form:
> >
> > COMPATIBLE_MACHINE = "qemux86|qemux86-64"
> >
> > and if all this is true, then if you're introducing a new machine, to
> > be magnificently pedantic, one should not use:
> >
> > COMPATIBLE_MACHINE_machinename = "machinename"
> >
> > but
> >
> > COMPATIBLE_MACHINE_machinename = "^machinename$"
> >
> > just to play it safe. am i reading all this correctly?
> >
> >
> > Yes, that’s correct, though we need the trailing $ but not the
> > leading ^, as it’s using re.match, not re.search — meaning it only
> > matches at the beginning of the string, it doesn’t search the string
> > to find a match.
>
> ah, quite right, i had forgotten that. again, in any event, both the
> code and documentation could probably be tweaked to make all of this
> more obvious.
>
> Absolutely agreed. For this regex specifically, an argument could be
> made that a lack of a trailing $ is almost certainly a bug. I could
> argue that it should either be implicit, though that would be
> limiting, or failing to include it could trigger a warning unless
> you explicitly state you know what you’re doing :) Hmm..
well, regardless of any tweaking, i think the docs need to be far
more clear on the processing of COMPATIBLE_MACHINE.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
More information about the Openembedded-core
mailing list