<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"><<a href="mailto:pb@pbcl.net" target="_blank">pb@pbcl.net</a>></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>
> This add support to list compatible distro feature for a recipe; this<br>
> is important for example when you have two different recipes which<br>
> 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>
> + need_distro_features = d.getVar('COMPATIBLE_DISTRO_FEATURES', True)<br>
> + if need_distro_features:<br>
> + need_distro_features = need_distro_features.split()<br>
> + distro_features = (d.getVar('DISTRO_FEATURES', True) or "").split()<br>
> + for f in need_distro_features:<br>
> + if f in distro_features:<br>
> + bb.note("here")<br>
> + break<br>
> + else:<br>
> + raise bb.parse.SkipPackage("incompatible with distro features %s (not in DISTRO_FEATURES)" % need_distro_features)<br>
<br>
</div>Calling the variable "COMPATIBLE_DISTRO_FEATURES" implies that the<br>
recipe won'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 "incompatible with distro features %s (not<br>
in DISTRO_FEATURES)" is, at best, confusing. This message seems to be<br>
staying that the recipe won'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'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'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's first agree in the code so we can discuss where to put it:</div><div><br></div><div>+ need_distro_features = d.getVar('REQUIRED_DISTRO_FEATURES', True)</div>
<div>+ if need_distro_features:</div><div>+ need_distro_features = need_distro_features.split()</div><div>+ distro_features = (d.getVar('DISTRO_FEATURES', True) or "").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("missing required distro feature %s (not in DISTRO_FEATURES)" % 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>