[oe-commits] [bitbake] 02/02: fetch/gitsm: avoid live submodule fetching during unpack()

git at git.openembedded.org git at git.openembedded.org
Mon May 14 11:03:10 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 12757aec9450ee15745d531e78b54a3d3484a58b
Author: Matt Hoosier <matt.hoosier at gmail.com>
AuthorDate: Fri May 11 14:26:36 2018 -0500

    fetch/gitsm: avoid live submodule fetching during unpack()
    
    Although the submodules' histories have been fetched during the
    do_fetch() phase, the mechanics used to clone the workdir copy
    of the repo haven't been transferring the actual .git/modules
    directory from the repo fetched into downloads/ during the
    fetch task.
    
    Fix that, and for good measure also explicitly tell Git to avoid
    hitting the network during do_unpack() of the submodules.
    
    Rev3 changes:
    
    - Really fix the shallow-clone issue claimed to be addressed in rev2.
    
    Rev2 changes:
    
    - Fixed a failure when unpacking a shallow cloned mirror repository.
    
    [YOCTO #12739]
    
    Signed-off-by: Matt Hoosier <matt.hoosier at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/gitsm.py | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py
index 0aff100..3969f2f 100644
--- a/lib/bb/fetch2/gitsm.py
+++ b/lib/bb/fetch2/gitsm.py
@@ -132,4 +132,30 @@ class GitSM(Git):
 
         if self.uses_submodules(ud, d, ud.destdir):
             runfetchcmd(ud.basecmd + " checkout " + ud.revisions[ud.names[0]], d, workdir=ud.destdir)
-            runfetchcmd(ud.basecmd + " submodule update --init --recursive", d, workdir=ud.destdir)
+
+            updateflags = ""
+
+            # Copy over the submodules' fetched histories too.
+            if ud.bareclone:
+                repo_conf = ud.destdir
+            else:
+                repo_conf = os.path.join(ud.destdir, '.git')
+
+            if os.path.exists(ud.clonedir):
+                # This is not a copy unpacked from a shallow mirror clone. So
+                # the manual intervention to populate the .git/modules done
+                # in clone_shallow_local() won't have been done yet.
+                runfetchcmd("cp -pr %s %s" % (os.path.join(ud.clonedir, 'modules'), repo_conf), d)
+                updateflags += " --no-fetch"
+            elif os.path.exists(os.path.join(repo_conf, 'modules')):
+                # Unpacked from a shallow mirror clone. Manual population of
+                # .git/modules is already done.
+                updateflags += " --no-fetch"
+            else:
+                # This isn't fatal; git-submodule will just fetch it
+                # during do_unpack().
+                bb.error("submodule history not retrieved during do_fetch()")
+
+            # Careful not to hit the network during unpacking; all history should already
+            # be fetched.
+            runfetchcmd(ud.basecmd + " submodule update --init --recursive %s" % updateflags, d, workdir=ud.destdir)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list