From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: Christopher Larson <clarson@kergoth.com>
Cc: OE Core mailing list <openembedded-core@lists.openembedded.org>
Subject: Re: a few questions about "COMPATIBLE_MACHINE" variable
Date: Mon, 19 Dec 2016 12:56:20 -0500 (EST) [thread overview]
Message-ID: <alpine.LFD.2.20.1612191246350.4848@localhost.localdomain> (raw)
In-Reply-To: <CABcZAN=X+O23y=utG3iBvsdPNo1g9qM7H2JAT1PUpt-R=AYCBg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5187 bytes --]
On Mon, 19 Dec 2016, Christopher Larson wrote:
> On Mon, Dec 19, 2016 at 8:17 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> as a starting point, COMPATIBLE_MACHINE is processed on a
> per-recipe basis, and if it has no value, then there is no
> machine restriction being applied to that recipe, correct?
> that's based on this snippet from base.bbclass:
>
> need_machine = d.getVar('COMPATIBLE_MACHINE')
> if need_machine:
> import re
> compat_machines = (d.getVar('MACHINEOVERRIDES') 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'))
>
> so far, so good?
>
> next, the documentation describes the value of that variable
> as a regular expression, so the values are processed as RE
> patterns, but some of the actual uses are confusing. from
> poky/meta/recipes-kernel/linux:
>
> $ grep -r COMPATIBLE_MACHINE *
> linux-dummy.bb:#COMPATIBLE_MACHINE = "your_machine"
> linux-yocto_4.1.bb:COMPATIBLE_MACHINE = "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> linux-yocto_4.4.bb:COMPATIBLE_MACHINE = "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> linux-yocto_4.8.bb:COMPATIBLE_MACHINE = "qemuarm|qemuarm64|qemux86|qemuppc|qemumips|qemumips64|qemux86-64"
> linux-yocto-dev.bb:COMPATIBLE_MACHINE = "(qemuarm|qemux86|qemuppc|qemumips|qemumips64|qemux86-64)"
> linux-yocto-rt_4.1.bb:COMPATIBLE_MACHINE = "(qemux86|qemux86-64|qemuarm|qemuppc|qemumips)"
> linux-yocto-rt_4.4.bb:COMPATIBLE_MACHINE = "(qemux86|qemux86-64|qemuarm|qemuppc|qemumips)"
> linux-yocto-rt_4.8.bb:COMPATIBLE_MACHINE = "(qemux86|qemux86-64|qemuarm|qemuppc|qemumips)"
> 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$)"
> $
>
> first, what is best practice -- to use parentheses or not?
> i'm assuming it makes no difference, but it does seem
> inconsistent and could cause some confusion.
>
> They’re not needed in a case like this.
i suspected as much. still, would consistency dictate using
parentheses or not? just a style thing.
> 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.
> 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.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
next prev parent reply other threads:[~2016-12-19 17:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 15:17 a few questions about "COMPATIBLE_MACHINE" variable Robert P. J. Day
2016-12-19 15:28 ` Christopher Larson
[not found] ` <CABcZAN=X+O23y=utG3iBvsdPNo1g9qM7H2JAT1PUpt-R=AYCBg@mail.gmail.com>
2016-12-19 17:56 ` Robert P. J. Day [this message]
2016-12-19 18:46 ` Christopher Larson
2016-12-19 20:33 ` Robert P. J. Day
2017-02-26 11:36 ` Robert P. J. Day
2017-02-26 11:58 ` Robert P. J. Day
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.20.1612191246350.4848@localhost.localdomain \
--to=rpjday@crashcourse.ca \
--cc=clarson@kergoth.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox