<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 18, 2015 at 3:44 PM, Christopher Larson <span dir="ltr"><<a href="mailto:kergoth@gmail.com" target="_blank">kergoth@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="adM"><br></div><div class="gmail_quote"><div class="adM"><div class="h5">On Tue, Aug 18, 2015 at 11:51 AM, Martin Jansa <span dir="ltr"><<a href="mailto:martin.jansa@gmail.com" target="_blank">martin.jansa@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On Tue, Aug 18, 2015 at 11:35:03AM -0700, Christopher Larson wrote:<br>
> On Tue, Aug 18, 2015 at 7:28 AM, Christopher Larson <<a href="mailto:kergoth@gmail.com" target="_blank">kergoth@gmail.com</a>><br>
> wrote:<br>
><br>
> ><br>
> > On Tue, Aug 18, 2015 at 1:45 AM, Martin Jansa <<a href="mailto:martin.jansa@gmail.com" target="_blank">martin.jansa@gmail.com</a>><br>
> > wrote:<br>
> ><br>
> >> On Fri, Aug 14, 2015 at 08:57:17AM -0700, Christopher Larson wrote:<br>
> >> > On Thu, Aug 13, 2015 at 4:46 PM, Christopher Larson <<a href="mailto:kergoth@gmail.com" target="_blank">kergoth@gmail.com</a>><br>
> >> > wrote:<br>
> >> ><br>
> >> > > From: Christopher Larson <<a href="mailto:chris_larson@mentor.com" target="_blank">chris_larson@mentor.com</a>><br>
> >> > ><br>
> >> > > Please review the following changes for suitability for inclusion. If<br>
> >> you<br>
> >> > > have<br>
> >> > > any objections or suggestions for improvement, please respond to the<br>
> >> > > patches. If<br>
> >> > > you agree with the changes, please provide your Acked-by.<br>
> >> > ><br>
> >> > > This only implements support for shallow mirror tarballs, not shallow<br>
> >> > > clones.<br>
> >> > ><br>
> >> > > The mirror tarball filename includes branch, revision, and depth. To<br>
> >> > > enable,<br>
> >> > > use the `BB_GIT_SHALLOW` variable, or `BB_GIT_SHALLOW_<name>` for<br>
> >> specific<br>
> >> > > URLs. This variable can hold either a clone depth (e.g. `1` to just<br>
> >> get<br>
> >> > > SRCREV), or a ref or commit, in which case we keep history up to that<br>
> >> > > commit.<br>
> >> > ><br>
> >> > > The shallow support will not, at this time, function correctly for<br>
> >> > > linux-yocto, due to its branching scheme & validation.<br>
> >> > ><br>
> >> > > Example:<br>
> >> > ><br>
> >> > > BB_GIT_SHALLOW ?= "1"<br>
> >> > > BB_GIT_SHALLOW_pn-linux-yocto = ""<br>
> >> > > BB_GIT_SHALLOW_pn-linux-mel_mx6 = "v3.14"<br>
> >> > > BB_GIT_SHALLOW_pn-testrepo = "testbranch"<br>
> >> > ><br>
> >> > > This implementation will attempt to fetch a full mirror tarball if it<br>
> >> was<br>
> >> > > unable to fetch a shallow tarball. If `BB_GIT_SHALLOW` and<br>
> >> > > `BB_GENERATE_MIRROR_TARBALLS` are enabled for a given recipe, a<br>
> >> shallow<br>
> >> > > tarball will be emitted.<br>
> >><br>
> >> It would be nice to describe what this implementation does when there is<br>
> >> some local git clone already (will it first try to update it with "git<br>
> >> fetch"<br>
> >> or download shallow tarball?)<br>
> ><br>
> ><br>
> > In that case, I believe it will update the clone and use that, unless we<br>
> > have a current tarball already downloaded, but I'll double check the logic<br>
> > and get back to you.<br>
><br>
><br>
> I was correct about the behavioral inconsistency of the current<br>
> implementation -- if both existed, localpath was returning the mirror<br>
> tarball, needs_update was returning false regardless of the state of the<br>
> clone, and then unpack would unpack the out of date clone instead of the<br>
> tarball :) Not ideal, obviously -- either we prefer a shallow tarball to a<br>
> clone or vice versa, not somewhere in-between. I'm fixing that now.<br>
><br>
> I think that since the clone is essentially a superset (or should be) of<br>
> the clone tarball, it should probably be preferred when both are around,<br>
> but I'm open to opinions on that.<br>
<br>
</div></div>I agree that existing clone should be preferred over shallow tarball<br>
(doing incremental update should be faster in most repositories and<br>
updating local clone will be useful next time SRCREV is upgraded again).<br></blockquote><div><br></div></div></div><div>The one concern I have is, what if we have a perfectly useful shallow tarball, and an out of date clone, and upstream is down, so the fetch to update it fails. Ideally, the MIRRORS (not PREMIRRORS) would then be fetched, and it'd realize that the shallow tarball already exists and use that, but I suspect unpack() would end up using the out of date clone in that case, since we prefer the clone. I'll have to test that case out and see if I need to manually check needs_update() in unpack to decide which to use.</div><span class=""><div></div></span></div></blockquote></div><br>FYI, I confirmed that this is handled, though in a slightly surprising way. If you have an existing out of date clone, and the attempt to update it fails, the fetcher *removes* the entire local clone and you start fresh. Not ideal, obviously, and I have a fix for it locally, but in that case the fallback to mirrors works painlessly, as the out of date clonedir is removed by the time the mirror fetching and unpack happens. I'll prep another RFC commit to change that behavior.<br>-- <br><div class="gmail_signature"><div dir="ltr">Christopher Larson<br>kergoth at gmail dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Maintainer - Tslib<br>Senior Software Engineer, Mentor Graphics</div></div>
</div></div>