aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-01-11 19:00:48 +0100
committerGuido Günther <agx@sigxcpu.org>2017-01-11 19:01:10 +0100
commit4a41d496a8006fdc05e4eb0faf762d6ad043a96e (patch)
treeda46f0f9038b537ac224fbb72aebaf8812b37049 /tests
parent734143b4e0a53a044a20a569ed41632cc90ff360 (diff)
import-orig: Move orig.tar.gz with filter-pristine-tar
If we filter a tarball and use filter-pristine-tar we want pristine-tar to see the correct file name. If a file already exists at that location move it. If we wouldn't move the existing tarball but rather e.g. create the symlink in a temp directory we risk gbp buildpackage picking up the unfiltered tarball later. Closes: #558777
Diffstat (limited to 'tests')
-rw-r--r--tests/component/deb/test_import_orig.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/component/deb/test_import_orig.py b/tests/component/deb/test_import_orig.py
index a9b7645..d9e171e 100644
--- a/tests/component/deb/test_import_orig.py
+++ b/tests/component/deb/test_import_orig.py
@@ -295,3 +295,41 @@ class TestImportOrig(ComponentTestBase):
with assert_raises(KeyError):
t.getmember(f)
t.close()
+
+ def test_filter_with_orig_tarball(self):
+ """
+ Test that using a filter works even with an upstream tarball
+ that has already the correct name (#558777)
+ """
+ dsc = self._dsc('2.6-2')
+ ok_(import_dsc(['arg0', '--pristine-tar', dsc]) == 0)
+ repo = ComponentTestGitRepository(self.pkg)
+ os.chdir(self.pkg)
+ self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'])
+
+ f = 'hello-debhelper_2.8.orig.tar.gz'
+ src = os.path.join(DEB_TEST_DATA_DIR, 'dsc-3.0', f)
+ shutil.copy(src, '..')
+
+ ok_(import_orig(['arg0',
+ '--no-interactive',
+ '--pristine-tar',
+ '--filter-pristine-tar',
+ '--filter=README*',
+ '../hello-debhelper_2.8.orig.tar.gz']) == 0)
+ self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'],
+ tags=['debian/2.6-2', 'upstream/2.6', 'upstream/2.8'])
+
+ filtered = os.path.join('..', f)
+ ok_(os.path.exists(filtered))
+ eq_(os.readlink(filtered).split('/')[-1],
+ 'hello-debhelper_2.8.orig.gbp.tar.gz')
+ # Check if tar got filtered properly
+ t = tarfile.open(name=filtered, mode="r:gz")
+ for f in ['hello-2.8/configure']:
+ i = t.getmember(f)
+ eq_(type(i), tarfile.TarInfo)
+ for f in ['hello-2.8/README']:
+ with assert_raises(KeyError):
+ t.getmember(f)
+ t.close()