<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 18, 2015 at 11:51 AM, Martin Jansa <span dir="ltr">&lt;<a href="mailto:martin.jansa@gmail.com" target="_blank">martin.jansa@gmail.com</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 adM"><div class="h5">On Tue, Aug 18, 2015 at 11:35:03AM -0700, Christopher Larson wrote:<br>
&gt; On Tue, Aug 18, 2015 at 7:28 AM, Christopher Larson &lt;<a href="mailto:kergoth@gmail.com">kergoth@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; On Tue, Aug 18, 2015 at 1:45 AM, Martin Jansa &lt;<a href="mailto:martin.jansa@gmail.com">martin.jansa@gmail.com</a>&gt;<br>
&gt; &gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt; On Fri, Aug 14, 2015 at 08:57:17AM -0700, Christopher Larson wrote:<br>
&gt; &gt;&gt; &gt; On Thu, Aug 13, 2015 at 4:46 PM, Christopher Larson &lt;<a href="mailto:kergoth@gmail.com">kergoth@gmail.com</a>&gt;<br>
&gt; &gt;&gt; &gt; wrote:<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; From: Christopher Larson &lt;<a href="mailto:chris_larson@mentor.com">chris_larson@mentor.com</a>&gt;<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; Please review the following changes for suitability for inclusion. If<br>
&gt; &gt;&gt; you<br>
&gt; &gt;&gt; &gt; &gt; have<br>
&gt; &gt;&gt; &gt; &gt; any objections or suggestions for improvement, please respond to the<br>
&gt; &gt;&gt; &gt; &gt; patches. If<br>
&gt; &gt;&gt; &gt; &gt; you agree with the changes, please provide your Acked-by.<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; This only implements support for shallow mirror tarballs, not shallow<br>
&gt; &gt;&gt; &gt; &gt; clones.<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; The mirror tarball filename includes branch, revision, and depth. To<br>
&gt; &gt;&gt; &gt; &gt; enable,<br>
&gt; &gt;&gt; &gt; &gt; use the `BB_GIT_SHALLOW` variable, or `BB_GIT_SHALLOW_&lt;name&gt;` for<br>
&gt; &gt;&gt; specific<br>
&gt; &gt;&gt; &gt; &gt; URLs. This variable can hold either a clone depth (e.g. `1` to just<br>
&gt; &gt;&gt; get<br>
&gt; &gt;&gt; &gt; &gt; SRCREV), or a ref or commit, in which case we keep history up to that<br>
&gt; &gt;&gt; &gt; &gt; commit.<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; The shallow support will not, at this time, function correctly for<br>
&gt; &gt;&gt; &gt; &gt; linux-yocto, due to its branching scheme &amp; validation.<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; Example:<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt;     BB_GIT_SHALLOW ?= &quot;1&quot;<br>
&gt; &gt;&gt; &gt; &gt;     BB_GIT_SHALLOW_pn-linux-yocto = &quot;&quot;<br>
&gt; &gt;&gt; &gt; &gt;     BB_GIT_SHALLOW_pn-linux-mel_mx6 = &quot;v3.14&quot;<br>
&gt; &gt;&gt; &gt; &gt;     BB_GIT_SHALLOW_pn-testrepo = &quot;testbranch&quot;<br>
&gt; &gt;&gt; &gt; &gt;<br>
&gt; &gt;&gt; &gt; &gt; This implementation will attempt to fetch a full mirror tarball if it<br>
&gt; &gt;&gt; was<br>
&gt; &gt;&gt; &gt; &gt; unable to fetch a shallow tarball. If `BB_GIT_SHALLOW` and<br>
&gt; &gt;&gt; &gt; &gt; `BB_GENERATE_MIRROR_TARBALLS` are enabled for a given recipe, a<br>
&gt; &gt;&gt; shallow<br>
&gt; &gt;&gt; &gt; &gt; tarball will be emitted.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; It would be nice to describe what this implementation does when there is<br>
&gt; &gt;&gt; some local git clone already (will it first try to update it with &quot;git<br>
&gt; &gt;&gt; fetch&quot;<br>
&gt; &gt;&gt; or download shallow tarball?)<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; In that case, I believe it will update the clone and use that, unless we<br>
&gt; &gt; have a current tarball already downloaded, but I&#39;ll double check the logic<br>
&gt; &gt; and get back to you.<br>
&gt;<br>
&gt;<br>
&gt; I was correct about the behavioral inconsistency of the current<br>
&gt; implementation -- if both existed, localpath was returning the mirror<br>
&gt; tarball, needs_update was returning false regardless of the state of the<br>
&gt; clone, and then unpack would unpack the out of date clone instead of the<br>
&gt; tarball :) Not ideal, obviously -- either we prefer a shallow tarball to a<br>
&gt; clone or vice versa, not somewhere in-between. I&#39;m fixing that now.<br>
&gt;<br>
&gt; I think that since the clone is essentially a superset (or should be) of<br>
&gt; the clone tarball, it should probably be preferred when both are around,<br>
&gt; but I&#39;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>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&#39;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&#39;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><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When fetching from premirror shallow tarball should be preferred over<br>
full clone (maybe make it configureable for cases where shallow clone is<br>
still big compared with full clone and when developer expects many<br>
SRCREV bumps - e.g. for AUTOREV - better to fetch full 10GB clone once<br>
per builder machine and do git fetch every 2 days, than downloading 1GB<br>
shallow clone tarball every 2 days - we have this case with huge<br>
*webkit* or chromium repos already).</blockquote></div><br><div>Yeah, that should be doable with this implementation, either enable it globally and then disable on a per-recipe basis, or use inline python to change the value based on AUTOREV usage, or keep it off globally and opt-in on a per-recipe basis.</div>-- <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>