summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-11-02 09:07:30 +0100
committerMichał Górny <mgorny@gentoo.org>2017-11-02 09:08:51 +0100
commitcf5762cfd1dd07bbcf12987b32afaafca41ec527 (patch)
tree5bc4f15b2f2fad392950b4258b77bb43668094d8
parentb27a25f6d124751be8a29aaad9d54bf7169592aa (diff)
downloadgemato-cf5762cfd1dd07bbcf12987b32afaafca41ec527.tar.gz
Move Manifest compression control into profile
-rw-r--r--gemato/profile.py13
-rw-r--r--gemato/recursiveloader.py7
2 files changed, 17 insertions, 3 deletions
diff --git a/gemato/profile.py b/gemato/profile.py
index cd5d641..4c7ef1e 100644
--- a/gemato/profile.py
+++ b/gemato/profile.py
@@ -42,6 +42,19 @@ class DefaultProfile(object):
"""
return False
+ def want_compressed_manifest(self, relpath, manifest, unc_size,
+ compress_watermark):
+ """
+ Determine whether the specified Manifest (at @relpath) can
+ be compressed. @manifest is the Manifest instance. @unc_size
+ specified the uncompressed data size, and @compress_watermark
+ is the watermark value at the time of invocation.
+
+ Should return True to compress Manifest, False to uncompress it
+ or None to leave as-is.
+ """
+ return unc_size >= compress_watermark
+
class EbuildRepositoryProfile(DefaultProfile):
"""
diff --git a/gemato/recursiveloader.py b/gemato/recursiveloader.py
index d353f86..0bc00b1 100644
--- a/gemato/recursiveloader.py
+++ b/gemato/recursiveloader.py
@@ -542,9 +542,10 @@ class ManifestRecursiveLoader(object):
compr = (gemato.compression
.get_compressed_suffix_from_filename(mpath))
is_compr = compr is not None
- is_large = unc_size >= compress_watermark
- if is_compr != is_large:
- if is_large:
+ want_compr = self.profile.want_compressed_manifest(
+ mpath, m, unc_size, compress_watermark)
+ if want_compr is not None and is_compr != want_compr:
+ if want_compr:
# compress it!
new_mpath = mpath + '.' + compress_format
else: