summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-12-06 16:00:45 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2011-12-06 16:00:45 +0000
commit15aaa49bb85012c1d274993ce3808686810ce929 (patch)
treeb40e8bfa07ce0b88f790241d664de2695aba1de5
parent09f4260d78c2be43e4174b9efa381de0ce05b9b1 (diff)
downloadmorph-15aaa49bb85012c1d274993ce3808686810ce929.tar.gz
have git export directly to a tar file
Later, add compression by piping to a gzip process.
-rw-r--r--morphlib/builder.py2
-rw-r--r--morphlib/git.py7
2 files changed, 2 insertions, 7 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py
index 704a9d84..2889c3a5 100644
--- a/morphlib/builder.py
+++ b/morphlib/builder.py
@@ -183,7 +183,7 @@ class Chunk(BinaryBlob):
def create_source_and_tarball(self):
self.msg('Creating source tree and tarball')
- tarball = self.cache_prefix + '.src.tar.gz'
+ tarball = self.cache_prefix + '.src.tar'
morphlib.git.export_sources(self.repo, self.ref, tarball)
os.mkdir(self.builddir)
f = tarfile.open(tarball)
diff --git a/morphlib/git.py b/morphlib/git.py
index 14cba0e6..59f59c9b 100644
--- a/morphlib/git.py
+++ b/morphlib/git.py
@@ -14,7 +14,6 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import gzip
import logging
import urlparse
@@ -40,11 +39,7 @@ class TooManyMorphs(Exception):
def export_sources(repo, ref, tar_filename):
'''Export the contents of a specific commit into a compressed tarball.'''
ex = morphlib.execute.Execute('.', msg=logging.debug)
- tar = ex.runv(['git', 'archive', '--remote', repo, ref])
- f = gzip.open(tar_filename, 'wb')
- f.write(tar)
- f.close()
-
+ ex.runv(['git', 'archive', '-o', tar_filename, '--remote', repo, ref])
def get_commit_id(repo, ref):
'''Return the full SHA-1 commit id for a repo+ref.'''