git-buildpackage: Call gbp.update_submodules
authorGuido Günther <agx@sigxcpu.org>
Sat, 26 Mar 2011 06:47:06 +0000 (07:47 +0100)
committerGuido Günther <agx@sigxcpu.org>
Wed, 6 Apr 2011 18:24:07 +0000 (20:24 +0200)
before exporting a tarball or creating a separate build tree. We invoke
git-submodule with --no-fetch to not break offline operation.

gbp/git.py
git-buildpackage

index e3de82e..40dc7f7 100644 (file)
@@ -503,7 +503,7 @@ class GitRepository(object):
         GitCommand("submodule", [ "add", repo_path ])()
 
 
-    def update_submodules(self, init=True, recursive=True):
+    def update_submodules(self, init=True, recursive=True, fetch=False):
         """Update all submodules"""
         if not self.has_submodules():
             return
@@ -512,6 +512,9 @@ class GitRepository(object):
             args.append("--recursive")
         if init:
             args.append("--init")
+        if not fetch:
+            args.append("--no-fetch")
+
         GitCommand("submodule", args)()
 
 
index 181405f..48e3fc1 100755 (executable)
@@ -106,6 +106,7 @@ def git_archive(repo, cp, output_dir, treeish, comp_type, comp_level):
 
     try:
         if repo.has_submodules():
+            repo.update_submodules()
             git_archive_submodules(repo, treeish, output, prefix,
                                    comp_type, comp_level, comp_opts)
 
@@ -140,6 +141,8 @@ def dump_tree(repo, export_dir, treeish):
         if ret:
             raise GbpError, "Error in dump_tree archive pipe"
 
+        if repo.has_submodules():
+            repo.update_submodules()
         for (subdir, commit) in repo.get_submodules(treeish):
             gbp.log.info("Processing submodule  %s (%s)" % (subdir, commit[0:8]))
             tarpath = [subdir, subdir[2:]][subdir.startswith("./")]