<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 19, 2016 at 8:17 AM, Robert P. J. Day <span dir="ltr"><<a href="mailto:rpjday@crashcourse.ca" target="_blank">rpjday@crashcourse.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":29s" class="a3s aXjCH m15917a9fa05d4cb7"> as a starting point, COMPATIBLE_MACHINE is processed on a per-recipe<br>
basis, and if it has no value, then there is no machine restriction<br>
being applied to that recipe, correct? that's based on this snippet<br>
from base.bbclass:<br>
<br>
need_machine = d.getVar('COMPATIBLE_MACHINE')<br>
if need_machine:<br>
import re<br>
compat_machines = (d.getVar('MACHINEOVERRIDES') or "").split(":")<br>
for m in compat_machines:<br>
if re.match(need_machine, m):<br>
break<br>
else:<br>
raise bb.parse.SkipPackage("<wbr>incompatible with machine %s (not in COMPATIBLE_MACHINE)" % d.getVar('MACHINE'))<br>
<br>
so far, so good?<br>
<br>
next, the documentation describes the value of that variable as a<br>
regular expression, so the values are processed as RE patterns, but<br>
some of the actual uses are confusing. from<br>
poky/meta/recipes-kernel/<wbr>linux:<br>
<br>
$ grep -r COMPATIBLE_MACHINE *<br>
linux-dummy.bb:#COMPATIBLE_<wbr>MACHINE = "your_machine"<br>
linux-yocto_4.1.bb:COMPATIBLE_<wbr>MACHINE = "qemuarm|qemuarm64|qemux86|<wbr>qemuppc|qemumips|qemumips64|<wbr>qemux86-64"<br>
linux-yocto_4.4.bb:COMPATIBLE_<wbr>MACHINE = "qemuarm|qemuarm64|qemux86|<wbr>qemuppc|qemumips|qemumips64|<wbr>qemux86-64"<br>
linux-yocto_4.8.bb:COMPATIBLE_<wbr>MACHINE = "qemuarm|qemuarm64|qemux86|<wbr>qemuppc|qemumips|qemumips64|<wbr>qemux86-64"<br>
linux-yocto-dev.bb:COMPATIBLE_<wbr>MACHINE = "(qemuarm|qemux86|qemuppc|<wbr>qemumips|qemumips64|qemux86-<wbr>64)"<br>
linux-yocto-rt_4.1.bb:COMPATIB<wbr>LE_MACHINE = "(qemux86|qemux86-64|qemuarm|<wbr>qemuppc|qemumips)"<br>
linux-yocto-rt_4.4.bb:COMPATIB<wbr>LE_MACHINE = "(qemux86|qemux86-64|qemuarm|<wbr>qemuppc|qemumips)"<br>
linux-yocto-rt_4.8.bb:COMPATIB<wbr>LE_MACHINE = "(qemux86|qemux86-64|qemuarm|<wbr>qemuppc|qemumips)"<br>
linux-yocto-tiny_4.1.bb:COMPAT<wbr>IBLE_MACHINE = "(qemux86$)"<br>
linux-yocto-tiny_4.4.bb:COMPAT<wbr>IBLE_MACHINE = "(qemux86$)"<br>
linux-yocto-tiny_4.8.bb:COMPAT<wbr>IBLE_MACHINE = "(qemux86$)"<br>
$<br>
<br>
first, what is best practice -- to use parentheses or not? i'm<br>
assuming it makes no difference, but it does seem inconsistent and<br>
could cause some confusion.<br></div></blockquote><div><br></div><div>They’re not needed in a case like this. </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":29s" class="a3s aXjCH m15917a9fa05d4cb7">
next, if the possibilities in a list are REs, what is the point of<br>
explicitly listing, say, "qemuarm|qemuarm64"? would not the RE<br>
"qemuarm" subsume the more explicit "qemuarm64"? same for the other<br>
architectures. (one could suggest that that entire line could be<br>
shortened to "... = (^qemu)".)<br></div></blockquote><div><br></div><div>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.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":29s" class="a3s aXjCH m15917a9fa05d4cb7">
the above seems pretty clear since the following lines would appear<br>
to say that *only* the qemux86 is compatible:<br>
<br>
linux-yocto-tiny_4.1.bb:COMPAT<wbr>IBLE_MACHINE = "(qemux86$)"<br>
linux-yocto-tiny_4.4.bb:COMPAT<wbr>IBLE_MACHINE = "(qemux86$)"<br>
linux-yocto-tiny_4.8.bb:COMPAT<wbr>IBLE_MACHINE = "(qemux86$)"<br>
<br>
which suggests the following passage from the YP kernel dev manual is<br>
a bit misleading:<br>
<br>
"You must change it to match a list of the machines that your new<br>
recipe supports. For example, to support the qemux86 and qemux86-64<br>
machines, use the following form:<br>
<br>
COMPATIBLE_MACHINE = "qemux86|qemux86-64"<br>
<br>
and if all this is true, then if you're introducing a new machine, to<br>
be magnificently pedantic, one should not use:<br>
<br>
COMPATIBLE_MACHINE_machinename = "machinename"<br>
<br>
but<br>
<br>
COMPATIBLE_MACHINE_machinename = "^machinename$"<br>
<br>
just to play it safe. am i reading all this correctly?</div></blockquote></div><br>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.<br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Christopher Larson<br>clarson at kergoth dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Maintainer - Tslib<br>Senior Software Engineer, Mentor Graphics</div>
</div></div>