aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/component/deb/test_import_dsc.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/component/deb/test_import_dsc.py')
-rw-r--r--tests/component/deb/test_import_dsc.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/tests/component/deb/test_import_dsc.py b/tests/component/deb/test_import_dsc.py
index 615ef979..bc10962a 100644
--- a/tests/component/deb/test_import_dsc.py
+++ b/tests/component/deb/test_import_dsc.py
@@ -17,7 +17,6 @@
# <http://www.gnu.org/licenses/>
import os
-import hashlib
from tests.component import (ComponentTestBase,
ComponentTestGitRepository)
@@ -33,15 +32,7 @@ from gbp.deb.dscfile import DscFile
class TestImportDsc(ComponentTestBase):
"""Test importing of debian source packages"""
- @staticmethod
- def _hash_file(filename):
- h = hashlib.md5()
- with open(filename, 'rb') as f:
- buf = f.read()
- h.update(buf)
- return h.hexdigest()
-
- def test_debian_import(self):
+ def test_import_debian_native(self):
"""Test that importing of debian native packages works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR,
@@ -120,7 +111,7 @@ class TestImportDsc(ComponentTestBase):
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
dsc = DscFile.parse(dscfile)
- # Check if we can rebuild the tarball and subtarball
+ # Check if we can rebuild the tarball and component
ptars = [('hello-debhelper_2.8.orig.tar.gz', 'pristine-tar', '', dsc.tgz),
('hello-debhelper_2.8.orig-foo.tar.gz', 'pristine-tar^', 'foo', dsc.additional_tarballs['foo'])]
@@ -128,9 +119,9 @@ class TestImportDsc(ComponentTestBase):
outdir = os.path.abspath('.')
for f, w, s, o in ptars:
eq_(repo.get_subject(w), 'pristine-tar data for %s' % f)
- old = self._hash_file(o)
- p.checkout('hello-debhelper', '2.8', 'gzip', outdir, subtarball=s)
- new = self._hash_file(os.path.join(outdir, f))
+ old = self.hash_file(o)
+ p.checkout('hello-debhelper', '2.8', 'gzip', outdir, component=s)
+ new = self.hash_file(os.path.join(outdir, f))
eq_(old, new, "Checksum %s of regenerated tarball %s does not match original %s" %
(f, old, new))
@@ -155,3 +146,17 @@ class TestImportDsc(ComponentTestBase):
dsc]) == 1
self._check_log(0, "gbp:error: Directory 'hello-debhelper' already exists. If you want to import into it, "
"please change into this directory otherwise move it away first")
+
+ def test_import_10(self):
+ """Test if importing a 1.0 source format package works"""
+ def _dsc(version):
+ return os.path.join(DEB_TEST_DATA_DIR,
+ 'dsc-1.0',
+ 'hello-debhelper_%s.dsc' % version)
+
+ dsc = _dsc('2.6-2')
+ assert import_dsc(['arg0', dsc]) == 0
+ repo = ComponentTestGitRepository('hello-debhelper')
+ self._check_repo_state(repo, 'master', ['master', 'upstream'],
+ tags=['upstream/2.6', 'debian/2.6-2'])
+ assert len(repo.get_commits()) == 2