summaryrefslogtreecommitdiff
path: root/morphlib/builder.py
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-02-22 13:09:48 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-02-22 13:09:48 +0000
commitaa4834c1a911600ffa26b04285eb56cc863b63de (patch)
treec027c596d08f1c821f050f48c714543908a0c9e7 /morphlib/builder.py
parent18f896eb1f539497ba50ccae372a557398c6b5d4 (diff)
downloadmorph-aa4834c1a911600ffa26b04285eb56cc863b63de.tar.gz
Use "cp -a" and "git checkout" to unpack sources in the build tree.
This is done to keep the git repository intact with history and all that. cp + checkout turns out to be faster than a regular "git clone". In order to avoid roundtrips to the internet whenever a chunk tries to do something with submodules, we force the submodule URLs to point to our locally cached repos.
Diffstat (limited to 'morphlib/builder.py')
-rw-r--r--morphlib/builder.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py
index ad0b14f9..dc7d51db 100644
--- a/morphlib/builder.py
+++ b/morphlib/builder.py
@@ -325,13 +325,20 @@ class ChunkBuilder(BlobBuilder):
self.msg('Extracting %s into %s' %
(treeish.repo, self.builddir))
- morphlib.git.archive_and_extract(
- self.app, treeish, destdir, self.msg)
+ morphlib.git.copy_repository(treeish, destdir, self.msg)
+ morphlib.git.checkout_ref(destdir, treeish.ref, self.msg)
for submodule in treeish.submodules:
directory = os.path.join(destdir, submodule.path)
extract_treeish(submodule.treeish, directory)
+ # we need to do this to keep any "git submodule" commands
+ # from accessing the internet. instead, we redirect them
+ # to the locally cached submodule repo
+ morphlib.git.set_submodule_url(destdir, submodule.name,
+ submodule.treeish.repo,
+ self.msg)
+
extract_treeish(self.blob.morph.treeish, self.builddir)
def build_with_system_or_commands(self):