<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">&lt;<a href="mailto:rpjday@crashcourse.ca" target="_blank">rpjday@crashcourse.ca</a>&gt;</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&#39;s based on this snippet<br>
from base.bbclass:<br>
<br>
  need_machine = d.getVar(&#39;COMPATIBLE_MACHINE&#39;)<br>
  if need_machine:<br>
      import re<br>
      compat_machines = (d.getVar(&#39;MACHINEOVERRIDES&#39;) or &quot;&quot;).split(&quot;:&quot;)<br>
      for m in compat_machines:<br>
          if re.match(need_machine, m):<br>
              break<br>
      else:<br>
          raise bb.parse.SkipPackage(&quot;<wbr>incompatible with machine %s (not in COMPATIBLE_MACHINE)&quot; % d.getVar(&#39;MACHINE&#39;))<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 = &quot;your_machine&quot;<br>
linux-yocto_4.1.bb:COMPATIBLE_<wbr>MACHINE = &quot;qemuarm|qemuarm64|qemux86|<wbr>qemuppc|qemumips|qemumips64|<wbr>qemux86-64&quot;<br>
linux-yocto_4.4.bb:COMPATIBLE_<wbr>MACHINE = &quot;qemuarm|qemuarm64|qemux86|<wbr>qemuppc|qemumips|qemumips64|<wbr>qemux86-64&quot;<br>
linux-yocto_4.8.bb:COMPATIBLE_<wbr>MACHINE = &quot;qemuarm|qemuarm64|qemux86|<wbr>qemuppc|qemumips|qemumips64|<wbr>qemux86-64&quot;<br>
linux-yocto-dev.bb:COMPATIBLE_<wbr>MACHINE = &quot;(qemuarm|qemux86|qemuppc|<wbr>qemumips|qemumips64|qemux86-<wbr>64)&quot;<br>
linux-yocto-rt_4.1.bb:COMPATIB<wbr>LE_MACHINE = &quot;(qemux86|qemux86-64|qemuarm|<wbr>qemuppc|qemumips)&quot;<br>
linux-yocto-rt_4.4.bb:COMPATIB<wbr>LE_MACHINE = &quot;(qemux86|qemux86-64|qemuarm|<wbr>qemuppc|qemumips)&quot;<br>
linux-yocto-rt_4.8.bb:COMPATIB<wbr>LE_MACHINE = &quot;(qemux86|qemux86-64|qemuarm|<wbr>qemuppc|qemumips)&quot;<br>
linux-yocto-tiny_4.1.bb:COMPAT<wbr>IBLE_MACHINE = &quot;(qemux86$)&quot;<br>
linux-yocto-tiny_4.4.bb:COMPAT<wbr>IBLE_MACHINE = &quot;(qemux86$)&quot;<br>
linux-yocto-tiny_4.8.bb:COMPAT<wbr>IBLE_MACHINE = &quot;(qemux86$)&quot;<br>
$<br>
<br>
  first, what is best practice -- to use parentheses or not? i&#39;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, &quot;qemuarm|qemuarm64&quot;? would not the RE<br>
&quot;qemuarm&quot; subsume the more explicit &quot;qemuarm64&quot;? same for the other<br>
architectures. (one could suggest that that entire line could be<br>
shortened to &quot;... = (^qemu)&quot;.)<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 = &quot;(qemux86$)&quot;<br>
  linux-yocto-tiny_4.4.bb:COMPAT<wbr>IBLE_MACHINE = &quot;(qemux86$)&quot;<br>
  linux-yocto-tiny_4.8.bb:COMPAT<wbr>IBLE_MACHINE = &quot;(qemux86$)&quot;<br>
<br>
which suggests the following passage from the YP kernel dev manual is<br>
a bit misleading:<br>
<br>
  &quot;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 = &quot;qemux86|qemux86-64&quot;<br>
<br>
and if all this is true, then if you&#39;re introducing a new machine, to<br>
be magnificently pedantic, one should not use:<br>
<br>
  COMPATIBLE_MACHINE_machinename = &quot;machinename&quot;<br>
<br>
but<br>
<br>
  COMPATIBLE_MACHINE_machinename = &quot;^machinename$&quot;<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>