<div dir="ltr">On Mon, May 14, 2018 at 8:18 AM, Peter Kjellerstedt <span dir="ltr">&lt;<a href="mailto:peter.kjellerstedt@axis.com" target="_blank">peter.kjellerstedt@axis.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">&gt; -----Original Message-----<br>
&gt; From: <a href="mailto:bitbake-devel-bounces@lists.openembedded.org">bitbake-devel-bounces@lists.<wbr>openembedded.org</a> [mailto:<a href="mailto:bitbake-">bitbake-</a><br>
&gt; <a href="mailto:devel-bounces@lists.openembedded.org">devel-bounces@lists.<wbr>openembedded.org</a>] On Behalf Of Matt Hoosier<br>
&gt; Sent: den 11 maj 2018 21:27<br>
&gt; To: <a href="mailto:bitbake-devel@lists.openembedded.org">bitbake-devel@lists.<wbr>openembedded.org</a><br>
&gt; Subject: [bitbake-devel] [PATCH] fetch/gitsm: avoid live submodule<br>
&gt; fetching during unpack()<br>
&gt; <br>
&gt; Although the submodules&#39; histories have been fetched during the<br>
&gt; do_fetch() phase, the mechanics used to clone the workdir copy<br>
&gt; of the repo haven&#39;t been transferring the actual .git/modules<br>
&gt; directory from the repo fetched into downloads/ during the<br>
&gt; fetch task.<br>
&gt; <br>
&gt; Fix that, and for good measure also explicitly tell Git to avoid<br>
&gt; hitting the network during do_unpack() of the submodules.<br>
&gt; <br>
&gt; Rev3 changes:<br>
&gt; <br>
&gt; - Really fix the shallow-clone issue claimed to be addressed in rev2.<br>
&gt; <br>
&gt; Rev2 changes:<br>
&gt; <br>
&gt; - Fixed a failure when unpacking a shallow cloned mirror repository.<br>
<br>
</span>The Rev2 and Rev3 changes information should go below the --- below <br>
as it should not be part of the commit message as it relates to the <br>
patch submission process rather than the actual change. If any of it <br>
is relevant for the commit message, then the commit message should <br>
be changed as well.<br></blockquote><div><br></div><div>Thanks; done. Resubmitted (as v4) to the list.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
&gt; [YOCTO #12739]<br>
&gt; <br>
&gt; Signed-off-by: Matt Hoosier &lt;<a href="mailto:matt.hoosier@gmail.com">matt.hoosier@gmail.com</a>&gt;<br>
&gt; ---<br>
&gt;  lib/bb/fetch2/gitsm.py | 28 +++++++++++++++++++++++++++-<br>
&gt;  1 file changed, 27 insertions(+), 1 deletion(-)<br>
&gt; <br>
&gt; diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py<br>
&gt; index 0aff1008..3969f2f5 100644<br>
&gt; --- a/lib/bb/fetch2/gitsm.py<br>
&gt; +++ b/lib/bb/fetch2/gitsm.py<br>
&gt; @@ -132,4 +132,30 @@ class GitSM(Git):<br>
&gt; <br>
&gt;          if self.uses_submodules(ud, d, ud.destdir):<br>
&gt;              runfetchcmd(ud.basecmd + &quot; checkout &quot; + ud.revisions[ud.names[0]], d, workdir=ud.destdir)<br>
&gt; -            runfetchcmd(ud.basecmd + &quot; submodule update --init --recursive&quot;, d, workdir=ud.destdir)<br>
&gt; +<br>
&gt; +            updateflags = &quot;&quot;<br>
&gt; +<br>
&gt; +            # Copy over the submodules&#39; fetched histories too.<br>
&gt; +            if ud.bareclone:<br>
&gt; +                repo_conf = ud.destdir<br>
&gt; +            else:<br>
&gt; +                repo_conf = os.path.join(ud.destdir, &#39;.git&#39;)<br>
&gt; +<br>
&gt; +            if os.path.exists(ud.clonedir):<br>
&gt; +                # This is not a copy unpacked from a shallow mirror clone. So<br>
&gt; +                # the manual intervention to populate the .git/modules done<br>
&gt; +                # in clone_shallow_local() won&#39;t have been done yet.<br>
&gt; +                runfetchcmd(&quot;cp -pr %s %s&quot; % (os.path.join(ud.clonedir, &#39;modules&#39;), repo_conf), d)<br>
&gt; +                updateflags += &quot; --no-fetch&quot;<br>
&gt; +            elif os.path.exists(os.path.join(<wbr>repo_conf, &#39;modules&#39;)):<br>
&gt; +                # Unpacked from a shallow mirror clone. Manual population of<br>
&gt; +                # .git/modules is already done.<br>
&gt; +                updateflags += &quot; --no-fetch&quot;<br>
&gt; +            else:<br>
&gt; +                # This isn&#39;t fatal; git-submodule will just fetch it<br>
&gt; +                # during do_unpack().<br>
&gt; +                bb.error(&quot;submodule history not retrieved during do_fetch()&quot;)<br>
&gt; +<br>
&gt; +            # Careful not to hit the network during unpacking; all history should already<br>
&gt; +            # be fetched.<br>
&gt; +            runfetchcmd(ud.basecmd + &quot; submodule update --init --recursive %s&quot; % updateflags, d, workdir=ud.destdir)<br>
&gt; --<br>
&gt; 2.13.6<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">//Peter<br>
<br>
</font></span></blockquote></div><br></div></div>