summaryrefslogtreecommitdiff
path: root/git-buildpackage
diff options
context:
space:
mode:
Diffstat (limited to 'git-buildpackage')
-rwxr-xr-xgit-buildpackage28
1 files changed, 26 insertions, 2 deletions
diff --git a/git-buildpackage b/git-buildpackage
index d5c3ce8..dba20a9 100755
--- a/git-buildpackage
+++ b/git-buildpackage
@@ -1,7 +1,7 @@
#!/usr/bin/python -u
# vim: set fileencoding=utf-8 :
#
-# (C) 2006,2007,2008 Guido Guenther <agx@sigxcpu.org>
+# (C) 2006-2010 Guido Guenther <agx@sigxcpu.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@@ -27,7 +27,7 @@ import time
import gbp.deb as du
from gbp.git import (GitRepositoryError, GitRepository, build_tag)
from gbp.command_wrappers import (GitTag, Command, RunAtCommand, CommandExecFailed,
- PristineTar, RemoveTree, GitAdd)
+ PristineTar, RemoveTree, GitAdd, PristineTar)
from gbp.config import (GbpOptionParser, GbpOptionGroup)
from gbp.errors import GbpError
from glob import glob
@@ -174,6 +174,29 @@ def extract_orig(orig_tarball, dest_dir):
# Remove that single folder:
os.rmdir(tar_topdir)
+
+def guess_comp_type(repo, comp_type):
+ """Guess compression type"""
+
+ if comp_type != 'auto':
+ try:
+ dummy = du.compressor_opts[comp_type]
+ except KeyError:
+ print >>sys.stderr, "Unknown compression type - guessing."
+ comp_type = 'auto'
+ else:
+ if not repo.has_branch(PristineTar.branch):
+ comp_type = 'gzip'
+ print >>sys.stderr, "No pristine tar branch found - assuming %s." % comp_type
+ else:
+ tarball = repo.get_subject(PristineTar.branch)
+ comp_type = du.get_compression(tarball)
+ if not comp_type:
+ comp_type = 'gzip'
+ print >>sys.stderr, "Unknown compression type of %s, assuming %s" % (tarball, comp_type)
+ return comp_type
+
+
def main(argv):
changelog = 'debian/changelog'
retval = 0
@@ -304,6 +327,7 @@ def main(argv):
else:
tarball_dir = output_dir
+ options.comp_type = guess_comp_type (repo, options.comp_type)
# Get/build the orig.tar.gz if necessary:
if not du.is_native(cp):
orig_file = du.orig_file(cp, options.comp_type)