diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-08-22 16:24:13 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-11-14 14:22:08 +0200 |
commit | aa7179eac94111bff602f0a04e186ee19e0cb29a (patch) | |
tree | a0ecea4673814abbba90aebf216993e2ad343fd5 /tests/06_test_upstream_source.py | |
parent | ed4a2c4ae5610ef95b2ed1c5425a1225b135043c (diff) | |
download | git-buildpackage-aa7179eac94111bff602f0a04e186ee19e0cb29a.tar.gz git-buildpackage-aa7179eac94111bff602f0a04e186ee19e0cb29a.tar.bz2 git-buildpackage-aa7179eac94111bff602f0a04e186ee19e0cb29a.zip |
UpstreamSource: implement prefix guessing
Add a new attribure 'prefix', i.e. the "leading directory name" in an
archive. For example, this usually is '<name>-<version>' in release
tarballs.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ćukasz Stelmach <l.stelmach@samsung.com>
Diffstat (limited to 'tests/06_test_upstream_source.py')
-rw-r--r-- | tests/06_test_upstream_source.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/06_test_upstream_source.py b/tests/06_test_upstream_source.py index b5989725..c6df6f14 100644 --- a/tests/06_test_upstream_source.py +++ b/tests/06_test_upstream_source.py @@ -28,6 +28,7 @@ class TestDir(unittest.TestCase): self.assertEqual(source.path, self.upstream_dir) self.assertEqual(source.unpacked, self.upstream_dir) self.assertEqual(source.guess_version(), ('test', '1.0')) + self.assertEqual(source.prefix, 'test-1.0') def tearDown(self): context.teardown() @@ -65,6 +66,7 @@ class TestTar(unittest.TestCase): self.assertEqual(repacked.guess_version(), ('gbp', '0.1')) self.assertEqual(repacked.archive_fmt, 'tar') self.assertEqual(repacked.compression, 'bzip2') + self.assertEqual(repacked.prefix, 'gbp') self._check_tar(repacked, ["gbp/errors.py", "gbp/__init__.py"]) def test_pack_filtered(self): @@ -94,7 +96,8 @@ class TestZip(unittest.TestCase): self.zipfile = self.tmpdir.join("gbp-0.1.zip") z = zipfile.ZipFile(self.zipfile, "w") for f in glob.glob(os.path.join(context.projectdir, "gbp/*.py")): - z.write(f, f, zipfile.ZIP_DEFLATED) + arcname = os.path.relpath(f, context.projectdir) + z.write(f, arcname, zipfile.ZIP_DEFLATED) z.close() def tearDown(self): @@ -109,6 +112,7 @@ class TestZip(unittest.TestCase): self.assertEqual(source.guess_version(), ('gbp', '0.1')) self.assertEqual(source.archive_fmt, 'zip') self.assertEqual(source.compression, None) + self.assertEqual(source.prefix, 'gbp') source.unpack(str(self.tmpdir)) self.assertNotEqual(source.unpacked, None) |