summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: