summaryrefslogtreecommitdiff
path: root/morph
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-04-25 16:41:46 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-04-25 16:41:46 +0100
commit1ac1877a3fb03daa282526273cbcc845faf8e6c5 (patch)
tree1e2ec59a76f5fd5dd951bc6d0e41d0c9e1bd6e7c /morph
parent852fbab4066ebad5ac45a53bb82f55aa62b8d035 (diff)
downloadmorph-1ac1877a3fb03daa282526273cbcc845faf8e6c5.tar.gz
Fix update-gits to update repos of submodules, too
Diffstat (limited to 'morph')
-rwxr-xr-xmorph34
1 files changed, 32 insertions, 2 deletions
diff --git a/morph b/morph
index d9f1866d..777dd75f 100755
--- a/morph
+++ b/morph
@@ -386,10 +386,40 @@ class Morph(cliapp.Application):
cache = morphlib.localrepocache.LocalRepoCache(
cachedir, baseurls, bundle_base_url)
- def do_print(reponame, ref, filename, absref, morphology):
+ subs_to_process = set()
+
+ def visit(reponame, ref, filename, absref, morphology):
self.msg('Updating %s|%s|%s' % (reponame, ref, filename))
+ assert cache.has_repo(reponame)
+ cached_repo = cache.get_repo(reponame)
+ try:
+ submodules = morphlib.git.Submodules(cached_repo.path, ref)
+ submodules.load()
+ except morphlib.git.NoModulesFileError:
+ pass
+ else:
+ for submod in submodules:
+ subs_to_process.add((submod.url, submod.commit))
+
self._traverse_morphs(self._itertriplets(args), cache, None,
- update=True, visit=do_print)
+ update=True, visit=visit)
+
+ done = set()
+ while subs_to_process:
+ url, ref = subs_to_process.pop()
+ done.add((url, ref))
+ cached_repo = cache.cache_repo(url)
+ cached_repo.update()
+
+ try:
+ submodules = morphlib.git.Submodules(cached_repo.path, ref)
+ submodules.load()
+ except morphlib.git.NoModulesFileError:
+ pass
+ else:
+ for submod in submodules:
+ if (submod.url, submod.commit) not in done:
+ subs_to_process.add((submod.url, submod.commit))
def cmd_build_single(self, args):
'''Build a binary from a morphology but do not build its dependencies.