<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"><<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 class="HOEnZb"><div class="h5">On Thu, 9 Feb 2017, Leonardo Sandoval wrote:<br>
<br>
><br>
><br>
> On 02/09/2017 06:06 AM, Robert P. J. Day wrote:<br>
> > i *thought* i understood this, but a colleague insists i don't so<br>
> > ... dumb question time.<br>
> ><br>
> > recently, i asked about the netdata recipe file "<a href="http://netdata_git.bb" rel="noreferrer" target="_blank">netdata_git.bb</a>",<br>
> > which contains the snippet:<br>
> ><br>
> > SRC_URI = "git://<a href="http://github.com/firehol/netdata.git;protocol=https" rel="noreferrer" target="_blank">github.com/firehol/<wbr>netdata.git;protocol=https</a>"<br>
> > SRCREV = "<wbr>36c1304e37094174ea51001903058e<wbr>65053107ca"<br>
> > PV = "1.0.1+git${SRCPV}"<br>
> ><br>
> > perhaps i've been wrong all this time, but i understood the above to<br>
> > mean that the source checked out would be based on commit<br>
> > 36c1304e37094174ea51001903058e<wbr>65053107ca, and that the "1.0.1+" part<br>
> > of the PV variable was simply for aesthetics.<br>
> ><br>
> > i realize that the full value of PV would be used to generate the<br>
> > final rpm files, and here's what i get:<br>
> ><br>
> > netdata-1.0.1+git0+36c1304e37-<wbr>r0.0.ppc7400.rpm<br>
> > netdata-dbg-1.0.1+git0+<wbr>36c1304e37-r0.0.ppc7400.rpm<br>
> > netdata-dev-1.0.1+git0+<wbr>36c1304e37-r0.0.ppc7400.rpm<br>
> ><br>
> > but is there some other significance or functionality associated<br>
> > with that "1.0.1+" prefix for PV?<br>
> that is the version and it should be the most recent release or tag<br>
> point of the SCM.<br>
> ><br>
> > the only thing i can think of is OE's algorithm for selecting<br>
> > the most recent recipe. AIUI, if i have multiple versions for the<br>
> > same recipe. all things being equal, OE would choose the "git"<br>
> > recipe file over a numerically-versioned recipe file, correct?<br>
> ><br>
> > so, say 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>
> > i assume that OE would choose the second one by default, even if,<br>
> > internally, that "git" form of the recipe selected a SRCREV that<br>
> > might represent an earlier commit than the 1.0.2 version.<br>
> On this area, check this link<br>
><br>
> <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>
><br>
> If you want to use git recipe, then you need to explicitly indicate<br>
> it through the latter variable, otherwise the 1.0.2 will be used.<br>
<br>
</div></div> ok, i'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'm assuming it's part of the bitbake fetcher library, but<br>
i'm willing to be corrected.<br>
<br>
next (ignoring "git"-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 "PV" that is set/calculated for a<br>
given recipe file? i can see that one can set "PV" in any recipe file,<br>
and i'm also assuming that if one doesn't do that, the value of "PV"<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 "PV"<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 = "2.0"<br>
<br>
<a href="http://rday_2.0.bb" rel="noreferrer" target="_blank">rday_2.0.bb</a><br>
PV = "1.0"<br>
<br>
of course the above is wildly confusing, but is it legal? and given<br>
what's written above, i'm concluding that the most "recent" recipe<br>
selected by default would be "<a href="http://rday_1.0.bb" rel="noreferrer" target="_blank">rday_1.0.bb</a>", 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 "git" recipes. for all of the git-based recipes i can<br>
see, the recipe files contain some variation of:<br>
<br>
SRCREV = "<wbr>8f33f80100096f7790c7b819ce37a3<wbr>ed8ce8b5fa"<br>
PV = "2.99.917+git${SRCPV}"<br>
<br>
(side question: is there any "git"-based recipe that *doesn'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 "git" recipe files, i've always understood that, regardless<br>
of the version number prefix used in setting "PV" (in the above,<br>
"2.99.917"), the "SRCPV" value defines the actual commit that will be<br>
fetched and checked out. so where does that leave the version number<br>
prefix "2.99.917".<br>
<br>
as i'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, "this git recipe<br>
represents some level of improvement over version 2.99.917", 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 "recent" 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 "PV" set in the second version, so that if the second recipe file<br>
contained the line:<br>
<br>
PV = "1.0.1+git${SRCPV}"<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>