diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-11-09 13:27:54 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-11-09 13:30:07 +0100 |
commit | 62fdc2b552366afb337b5e75342efbd6a0854352 (patch) | |
tree | 276ba337376672b178723526da69b894b73fcbb7 /tests | |
parent | 4378eae4cc22ea612dc48823dfbe74b4d9f45ba9 (diff) |
buildpackage: test additional tarball build with export-dir too
Diffstat (limited to 'tests')
-rw-r--r-- | tests/component/deb/fixtures.py | 31 | ||||
-rw-r--r-- | tests/component/deb/test_buildpackage.py | 14 |
2 files changed, 43 insertions, 2 deletions
diff --git a/tests/component/deb/fixtures.py b/tests/component/deb/fixtures.py index cec34476..1009a600 100644 --- a/tests/component/deb/fixtures.py +++ b/tests/component/deb/fixtures.py @@ -22,7 +22,7 @@ from tests.component import (ComponentTestBase, ComponentTestGitRepository) from tests.component.deb import DEB_TEST_DATA_DIR -from nose.tools import eq_ +from nose.tools import eq_, ok_ from gbp.command_wrappers import UnpackTarArchive from gbp.git import GitRepository @@ -37,11 +37,14 @@ DEFAULT_QUILT30 = os.path.join(DEB_TEST_DATA_DIR, 'dsc-3.0', 'hello-debhelper_%s.dsc' % '2.8-1') +DEFAULT_ADDITIONAL_TAR = os.path.join(DEB_TEST_DATA_DIR, + 'dsc-3.0-additional-tarballs', + 'hello-debhelper_%s.dsc' % '2.8-1') + DEFAULT_OVERLAY = os.path.join(DEB_TEST_DATA_DIR, 'dsc-3.0', 'hello-debhelper_%s.debian.tar.gz' % '2.8-1') - class RepoFixtures(object): @classmethod def native(cls, dsc=DEFAULT_NATIVE, opts=None): @@ -66,6 +69,17 @@ class RepoFixtures(object): return wrapper @classmethod + def quilt30_additional_tarball(cls, dsc=DEFAULT_ADDITIONAL_TAR, opts=None): + """Decorator to be used as 3.0 (quilt) with additional tarball test fixture""" + def wrapper(fn): + @wraps(fn) + def _quilt30_additional_tar_repo(*args): + repo = cls.import_quilt30_additional_tarball(dsc, opts) + return fn(*args, repo=repo) + return _quilt30_additional_tar_repo + return wrapper + + @classmethod def overlay(cls, debian=DEFAULT_OVERLAY, opts=None): """Decorator to be used as overay mode test fixture""" def wrapper(fn): @@ -105,6 +119,19 @@ class RepoFixtures(object): return repo @classmethod + def import_quilt30_additional_tarball(cls, dsc=DEFAULT_ADDITIONAL_TAR, opts=None): + """Import a 3.0 (quilt) package with additional tarball, verify and change into repo""" + repo = cls._import_one(dsc, opts) + expected_branches = ['master', 'upstream'] + if opts and '--pristine-tar' in opts: + expected_branches.append('pristine-tar') + ComponentTestBase._check_repo_state(repo, 'master', expected_branches) + eq_(len(repo.get_commits()), 2) + os.chdir(repo.path) + ok_(os.path.exists('./foo')) + return repo + + @classmethod def import_debian_tarball(cls, debian=DEFAULT_OVERLAY, opts=None): """Import a 3.0 (quilt) debian dir for overlay mode""" repo = GitRepository.create(os.path.split('/')[-1].split('_')[0]) diff --git a/tests/component/deb/test_buildpackage.py b/tests/component/deb/test_buildpackage.py index 3c42032c..71c30c96 100644 --- a/tests/component/deb/test_buildpackage.py +++ b/tests/component/deb/test_buildpackage.py @@ -16,6 +16,7 @@ # along with this program; if not, please see # <http://www.gnu.org/licenses/> +import glob import hashlib import os import subprocess @@ -175,6 +176,19 @@ class TestBuildpackage(ComponentTestBase): self._test_buildpackage(repo, ['--git-export-dir=../foo/bar']) ok_(os.path.exists('../foo/bar')) + @RepoFixtures.quilt30_additional_tarball() + def test_export_dir_additional_tar(self, repo): + """Test that building with a export dir and additional tarball works""" + self._test_buildpackage(repo, ['--git-export-dir=../foo/bar', + '--git-no-purge', + '--git-component=foo']) + # Check that all needed tarballs end up in the build-area + eq_(sorted(glob.glob('../foo/bar/*')), ['../foo/bar/hello-debhelper-2.8', + '../foo/bar/hello-debhelper_2.8.orig-foo.tar.gz', + '../foo/bar/hello-debhelper_2.8.orig.tar.gz']) + # Check that directories from additional tarballs get exported too + ok_(os.path.exists('../foo/bar/hello-debhelper-2.8/foo')) + @RepoFixtures.overlay() def test_export_dir_overlay(self, repo): """Test that building in overlay mode with export dir works""" |