From 82e5f4d5e0c87d587bc13323ee49e70c3d03cbcd Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sat, 26 Mar 2011 07:47:06 +0100 Subject: git-buildpackage: Call gbp.update_submodules 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 | 5 ++++- git-buildpackage | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gbp/git.py b/gbp/git.py index e3de82e..40dc7f7 100644 --- a/gbp/git.py +++ b/gbp/git.py @@ -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)() diff --git a/git-buildpackage b/git-buildpackage index 181405f..48e3fc1 100755 --- a/git-buildpackage +++ b/git-buildpackage @@ -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("./")] -- cgit v1.2.3