summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-11-02 09:29:08 +0100
committerMichał Górny <mgorny@gentoo.org>2017-11-02 09:29:08 +0100
commite0b34b56846d7749c9f28676f6c9dc85722f2ba3 (patch)
tree7994664c9ca5eb0fdea491ab8ddb2810d6def27b
parentf53e6a5cdf4f345cb005ac34a61fa26704c1d288 (diff)
downloadgemato-e0b34b56846d7749c9f28676f6c9dc85722f2ba3.tar.gz
profile: Do not compress package Manifests in old-ebuild
-rw-r--r--gemato/profile.py11
-rw-r--r--tests/test_profile.py25
2 files changed, 36 insertions, 0 deletions
diff --git a/gemato/profile.py b/gemato/profile.py
index 4c7ef1e..998f699 100644
--- a/gemato/profile.py
+++ b/gemato/profile.py
@@ -121,6 +121,17 @@ class BackwardsCompatEbuildRepositoryProfile(EbuildRepositoryProfile):
return (super(BackwardsCompatEbuildRepositoryProfile, self)
.get_entry_type_for_path(path))
+ def want_compressed_manifest(self, relpath, manifest, unc_size,
+ compress_watermark):
+ for e in manifest.entries:
+ # disable compression in package directories
+ if e.tag == 'EBUILD':
+ return False
+
+ return (super(BackwardsCompatEbuildRepositoryProfile, self)
+ .want_compressed_manifest(relpath, manifest, unc_size,
+ compress_watermark))
+
PROFILE_MAPPING = {
'default': DefaultProfile,
diff --git a/tests/test_profile.py b/tests/test_profile.py
index 75da1d5..adcdf04 100644
--- a/tests/test_profile.py
+++ b/tests/test_profile.py
@@ -153,3 +153,28 @@ class BackwardsCompatEbuildRepositoryTests(EbuildRepositoryTests):
self.assertEqual(
m.find_path_entry('dev-foo/bar/files/test.patch').aux_path,
'test.patch')
+
+ def test_compression(self):
+ """
+ Test that package directory Manifests are not compressed.
+ """
+
+ m = gemato.recursiveloader.ManifestRecursiveLoader(
+ os.path.join(self.dir, 'Manifest'),
+ hashes=['SHA256', 'SHA512'],
+ compress_watermark=0,
+ allow_create=True,
+ profile=self.PROFILE())
+ m.update_entries_for_directory('')
+ m.save_manifests()
+
+ for mpath in self.EXPECTED_MANIFESTS:
+ # package manifest should be left uncompressed
+ if mpath == 'dev-foo/bar/Manifest':
+ self.assertTrue(os.path.exists(os.path.join(
+ self.dir, mpath)))
+ else:
+ self.assertTrue(os.path.exists(os.path.join(
+ self.dir, mpath + '.gz')))
+ self.assertFalse(os.path.exists(os.path.join(
+ self.dir, mpath)))