aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gbp/deb.py4
-rwxr-xr-xgit-buildpackage1
-rw-r--r--tests/05_test_detection.py12
3 files changed, 17 insertions, 0 deletions
diff --git a/gbp/deb.py b/gbp/deb.py
index 9f81c6a5..7d612d3b 100644
--- a/gbp/deb.py
+++ b/gbp/deb.py
@@ -46,6 +46,10 @@ compressor_opts = { 'gzip' : [ '-n', 'gz' ],
'lzma' : [ '', 'lzma' ],
'xz' : [ '', 'xz' ] }
+# Map frequently used names of compression types to the internal ones:
+compressor_aliases = { 'bz2' : 'bzip2',
+ 'gz' : 'gzip', }
+
class NoChangelogError(Exception):
"""no changelog found"""
pass
diff --git a/git-buildpackage b/git-buildpackage
index c52cd017..6bbe52e5 100755
--- a/git-buildpackage
+++ b/git-buildpackage
@@ -270,6 +270,7 @@ def guess_comp_type(repo, comp_type, cp, tarball_dir):
upstream_version = cp['Upstream-Version']
if comp_type != 'auto':
+ comp_type = du.compressor_aliases.get(comp_type, comp_type)
try:
dummy = du.compressor_opts[comp_type]
except KeyError:
diff --git a/tests/05_test_detection.py b/tests/05_test_detection.py
index e8ca64b7..a60cab17 100644
--- a/tests/05_test_detection.py
+++ b/tests/05_test_detection.py
@@ -91,3 +91,15 @@ class TestDetection(unittest.TestCase):
guessed = git_buildpackage.guess_comp_type(
repo, 'lzma', self.cp, None)
self.assertEqual("lzma", guessed)
+
+ def test_guess_comp_type_bz2(self):
+ repo = MockGitRepository(with_branch=False)
+ guessed = git_buildpackage.guess_comp_type(
+ repo, 'bz2', self.cp, None)
+ self.assertEqual("bzip2", guessed)
+
+ def test_guess_comp_type_gz(self):
+ repo = MockGitRepository(with_branch=False)
+ guessed = git_buildpackage.guess_comp_type(
+ repo, 'gz', self.cp, None)
+ self.assertEqual("gzip", guessed)