<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 28, 2013 at 12:12 PM, Phil Blundell <span dir="ltr">&lt;<a href="mailto:pb@pbcl.net" target="_blank">pb@pbcl.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On Tue, 2013-05-28 at 12:04 -0300, Otavio Salvador wrote:<br>

&gt; This add support to list compatible distro feature for a recipe; this<br>
&gt; is important for example when you have two different recipes which<br>
&gt; should be choosen depending on the distro features set.<br>
<br>
</div>The terminology used here seems to be wrong/misleading/confusing:<br>
<div class="im"><br>
&gt; +        need_distro_features = d.getVar(&#39;COMPATIBLE_DISTRO_FEATURES&#39;, True)<br>
&gt; +        if need_distro_features:<br>
&gt; +            need_distro_features = need_distro_features.split()<br>
&gt; +            distro_features = (d.getVar(&#39;DISTRO_FEATURES&#39;, True) or &quot;&quot;).split()<br>
&gt; +            for f in need_distro_features:<br>
&gt; +                if f in distro_features:<br>
&gt; +                    bb.note(&quot;here&quot;)<br>
&gt; +                    break<br>
&gt; +            else:<br>
&gt; +                raise bb.parse.SkipPackage(&quot;incompatible with distro features %s (not in DISTRO_FEATURES)&quot; % need_distro_features)<br>
<br>
</div>Calling the variable &quot;COMPATIBLE_DISTRO_FEATURES&quot; implies that the<br>
recipe won&#39;t work with any features not in the list.  But the actual<br>
implementation shown above is that the recipe will be skipped unless all<br>
of the features listed are present in DISTRO_FEATURES.  If those are the<br>
intended semantics then it seems as though the variable ought to be<br>
named REQUIRED_DISTRO_FEATURES or something.<br></blockquote><div><br></div><div style>Done.</div><div style> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Similarly, the error message &quot;incompatible with distro features %s (not<br>
in DISTRO_FEATURES)&quot; is, at best, confusing.  This message seems to be<br>
staying that the recipe won&#39;t work if the named features are set, but it<br>
then goes on to say that they are not in fact set.  Plus, it lists the<br>
entire contents of COMPATIBLE_DISTRO_FEATURES rather than just the items<br>
that are causing a problem.<br></blockquote><div><br></div><div style>Done.</div><div style> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Also, you seem to have a spurious bb.note() call in there.<br></blockquote><div><br></div><div style>Arrg, done.</div><div style> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Also also, we&#39;ve managed without this functionality in oe-core for some<br>
time which makes me wonder how widely useful it would actually be.  If<br>
it&#39;s only going to be used by a few recipes then it could go in a class,<br>
or in in the recipes themselves, rather than adding parse time and<br>
memory footprint to every recipe.<br></blockquote><div><br></div><div style>Right; let&#39;s first agree in the code so we can discuss where to put it:</div><div><br></div><div>+        need_distro_features = d.getVar(&#39;REQUIRED_DISTRO_FEATURES&#39;, True)</div>
<div>+        if need_distro_features:</div><div>+            need_distro_features = need_distro_features.split()</div><div>+            distro_features = (d.getVar(&#39;DISTRO_FEATURES&#39;, True) or &quot;&quot;).split()</div>
<div>+            for f in need_distro_features:</div><div>+                if f in distro_features:</div><div>+                    break</div><div>+            else:</div><div>+                raise bb.parse.SkipPackage(&quot;missing required distro feature %s (not in DISTRO_FEATURES)&quot; % need_distro_features)</div>
<div><br></div><div><br></div></div><div><br></div>-- <br>Otavio Salvador                             O.S. Systems<br><a href="http://www.ossystems.com.br" target="_blank">http://www.ossystems.com.br</a>        <a href="http://projetos.ossystems.com.br" target="_blank">http://projetos.ossystems.com.br</a><br>
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750<br>
</div></div>