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