<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 13, 2017 at 6:51 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 class="HOEnZb"><div class="h5">On Thu, 9 Feb 2017, Leonardo Sandoval wrote:<br>
<br>
&gt;<br>
&gt;<br>
&gt; On 02/09/2017 06:06 AM, Robert P. J. Day wrote:<br>
&gt; &gt;    i *thought* i understood this, but a colleague insists i don&#39;t so<br>
&gt; &gt; ... dumb question time.<br>
&gt; &gt;<br>
&gt; &gt;    recently, i asked about the netdata recipe file &quot;<a href="http://netdata_git.bb" rel="noreferrer" target="_blank">netdata_git.bb</a>&quot;,<br>
&gt; &gt; which contains the snippet:<br>
&gt; &gt;<br>
&gt; &gt;    SRC_URI = &quot;git://<a href="http://github.com/firehol/netdata.git;protocol=https" rel="noreferrer" target="_blank">github.com/firehol/<wbr>netdata.git;protocol=https</a>&quot;<br>
&gt; &gt;    SRCREV = &quot;<wbr>36c1304e37094174ea51001903058e<wbr>65053107ca&quot;<br>
&gt; &gt;    PV = &quot;1.0.1+git${SRCPV}&quot;<br>
&gt; &gt;<br>
&gt; &gt; perhaps i&#39;ve been wrong all this time, but i understood the above to<br>
&gt; &gt; mean that the source checked out would be based on commit<br>
&gt; &gt; 36c1304e37094174ea51001903058e<wbr>65053107ca, and that the &quot;1.0.1+&quot; part<br>
&gt; &gt; of the PV variable was simply for aesthetics.<br>
&gt; &gt;<br>
&gt; &gt;    i realize that the full value of PV would be used to generate the<br>
&gt; &gt; final rpm files, and here&#39;s what i get:<br>
&gt; &gt;<br>
&gt; &gt;    netdata-1.0.1+git0+36c1304e37-<wbr>r0.0.ppc7400.rpm<br>
&gt; &gt;    netdata-dbg-1.0.1+git0+<wbr>36c1304e37-r0.0.ppc7400.rpm<br>
&gt; &gt;    netdata-dev-1.0.1+git0+<wbr>36c1304e37-r0.0.ppc7400.rpm<br>
&gt; &gt;<br>
&gt; &gt; but is there some other significance or functionality associated<br>
&gt; &gt; with that &quot;1.0.1+&quot; prefix for PV?<br>
&gt; that is the version and it should be the most recent release or tag<br>
&gt; point of the SCM.<br>
&gt; &gt;<br>
&gt; &gt;    the only thing i can think of is OE&#39;s algorithm for selecting<br>
&gt; &gt; the most recent recipe. AIUI, if i have multiple versions for the<br>
&gt; &gt; same recipe. all things being equal, OE would choose the &quot;git&quot;<br>
&gt; &gt; recipe file over a numerically-versioned recipe file, correct?<br>
&gt; &gt;<br>
&gt; &gt;    so, say i have two recipe files:<br>
&gt; &gt;<br>
&gt; &gt;    <a href="http://netdata_1.0.2.bb" rel="noreferrer" target="_blank">netdata_1.0.2.bb</a><br>
&gt; &gt;    <a href="http://netdata_git.bb" rel="noreferrer" target="_blank">netdata_git.bb</a><br>
&gt; &gt;<br>
&gt; &gt; i assume that OE would choose the second one by default, even if,<br>
&gt; &gt; internally, that &quot;git&quot; form of the recipe selected a SRCREV that<br>
&gt; &gt; might represent an earlier commit than the 1.0.2 version.<br>
&gt; On this area, check this link<br>
&gt;<br>
&gt; <a href="http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#var-PREFERRED_VERSION" rel="noreferrer" target="_blank">http://www.yoctoproject.org/<wbr>docs/2.2/ref-manual/ref-<wbr>manual.html#var-PREFERRED_<wbr>VERSION</a><br>
&gt;<br>
&gt; If you want to use git recipe, then you need to explicitly indicate<br>
&gt; it through the latter variable, otherwise the 1.0.2 will be used.<br>
<br>
</div></div>  ok, i&#39;ve never dug into the recipe versioning really, really deeply<br>
so a few questions if i may. (and if all this is written out<br>
somewhere already, a link would be just ducky.)<br>
<br>
  first, where is the code that handles recipe versioning and<br>
selection? i&#39;m assuming it&#39;s part of the bitbake fetcher library, but<br>
i&#39;m willing to be corrected.<br>
<br>
  next (ignoring &quot;git&quot;-based recipes for the moment and<br>
PREFERRED_VERSION aside), is the selection of one of a number of<br>
recipes based on the final value of &quot;PV&quot; that is set/calculated for a<br>
given recipe file? i can see that one can set &quot;PV&quot; in any recipe file,<br>
and i&#39;m also assuming that if one doesn&#39;t do that, the value of &quot;PV&quot;<br>
would be extracted from the recipe file name so, for instance, the<br>
recipe file <a href="http://busybox_1.24.1.bb" rel="noreferrer" target="_blank">busybox_1.24.1.bb</a> would automatically generate a &quot;PV&quot;<br>
value of 1.24.1. that part seems fairly obvious.<br></blockquote><div><br></div><div>It’s the default value of PV in meta/conf/bitbake.conf, which uses inline python to extract the version number from the filename. Not special, not magic, just a default value for the variable.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  next (and what might be a silly question), based on the above, is it<br>
possible to set absurdly misleading PV values in recipe files for the<br>
same recipe, such as:<br>
<br>
  <a href="http://rday_1.0.bb" rel="noreferrer" target="_blank">rday_1.0.bb</a><br>
        PV = &quot;2.0&quot;<br>
<br>
  <a href="http://rday_2.0.bb" rel="noreferrer" target="_blank">rday_2.0.bb</a><br>
        PV = &quot;1.0&quot;<br>
<br>
of course the above is wildly confusing, but is it legal? and given<br>
what&#39;s written above, i&#39;m concluding that the most &quot;recent&quot; recipe<br>
selected by default would be &quot;<a href="http://rday_1.0.bb" rel="noreferrer" target="_blank">rday_1.0.bb</a>&quot;, yes?<br></blockquote><div><br></div><div>It’s legal, and the default lacking any specified preference would be the higher PV, 2.0, which is the <a href="http://rday_2.0.bb">rday_2.0.bb</a> recipe. Default version selection when nothing is preferred (and no layer priorities are involved in the selection) goes based on PV, not the filename.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  now, on to &quot;git&quot; recipes. for all of the git-based recipes i can<br>
see, the recipe files contain some variation of:<br>
<br>
  SRCREV = &quot;<wbr>8f33f80100096f7790c7b819ce37a3<wbr>ed8ce8b5fa&quot;<br>
  PV = &quot;2.99.917+git${SRCPV}&quot;<br>
<br>
(side question: is there any &quot;git&quot;-based recipe that *doesn&#39;t* have<br>
some form of the above? would a file like that be considered an error?<br>
or at least badly written?)<br>
<br>
  as for &quot;git&quot; recipe files, i&#39;ve always understood that, regardless<br>
of the version number prefix used in setting &quot;PV&quot; (in the above,<br>
&quot;2.99.917&quot;), the &quot;SRCPV&quot; value defines the actual commit that will be<br>
fetched and checked out. so where does that leave the version number<br>
prefix &quot;2.99.917&quot;.<br>
<br>
  as i&#39;ve read it all this time, even when using a git-based recipe,<br>
developers like to choose that version number prefix to represent some<br>
official tag that was not so far in the recent past from the git<br>
commit ID -- kind of an aesthetic reminder that, &quot;this git recipe<br>
represents some level of improvement over version 2.99.917&quot;, but not<br>
as far as the *next* official version number, something like that.<br></blockquote><div><br></div><div>Its purpose isn’t an aesthetic reminder, it’s to ensure that 2.99.917+gitsomething is seen as newer than the 2.99.917 release version for package upgrades.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  in addition, though, that numeric version prefix is used to select<br>
the most &quot;recent&quot; recipe version, so that (if i read this correctly),<br>
if i have two recipe files:<br>
<br>
  * <a href="http://netdata_1.0.2.bb" rel="noreferrer" target="_blank">netdata_1.0.2.bb</a><br>
  * <a href="http://netdata_git.bb" rel="noreferrer" target="_blank">netdata_git.bb</a><br>
<br>
while the first file is a fixed version, it all depends on the value<br>
of &quot;PV&quot; set in the second version, so that if the second recipe file<br>
contained the line:<br>
<br>
  PV = &quot;1.0.1+git${SRCPV}&quot;<br>
<br>
then PREFERRED_VERSION aside, the fixed version (1.0.2) would be<br>
selected as the more recent recipe file, even if that git SRCPV<br>
represented newer content. how am i doing so far?<br></blockquote><div><br></div><div>That’s correct, but remember that DEFAULT_PREFERENCE is always a factor, most often when there’s both a release recipe and a git recipe, the git recipe will have a -1 default preference. That said, nowadays we shouldn’t have multiple versions in a layer anyway.</div></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Christopher Larson<br>kergoth at gmail dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Senior Software Engineer, Mentor Graphics</div></div></div></div>
</div></div>