summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-11-25 00:19:18 +0100
committerMichał Górny <mgorny@gentoo.org>2017-11-25 00:19:18 +0100
commit5f7660e6c3639aa77c9414082589976a3d2a6716 (patch)
treebe57b83193804e5b91c9346c660342da3b0de570
parent89cfd10d1a88d95e6f28270f60980b459d06b71a (diff)
downloadgemato-5f7660e6c3639aa77c9414082589976a3d2a6716.tar.gz
compression: Zero out mtime in gzip files for deterministic results
-rw-r--r--gemato/compression.py4
-rwxr-xr-xutils/gen_fast_manifest.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/gemato/compression.py b/gemato/compression.py
index 4a3c9c6..cb3fa5a 100644
--- a/gemato/compression.py
+++ b/gemato/compression.py
@@ -50,9 +50,9 @@ def open_compressed_file(suffix, f, mode='rb'):
def read1(self, *args, **kwargs):
return self.read(*args, **kwargs)
- return FixedGzipFile(fileobj=f, mode=mode)
+ return FixedGzipFile(fileobj=f, mode=mode, mtime=0)
- return gzip.GzipFile(fileobj=f, mode=mode)
+ return gzip.GzipFile(fileobj=f, mode=mode, mtime=0)
elif suffix == "bz2" and bz2 is not None:
return bz2.BZ2File(f, mode=mode)
elif suffix == "lzma" and lzma is not None:
diff --git a/utils/gen_fast_manifest.py b/utils/gen_fast_manifest.py
index ccba791..049761f 100755
--- a/utils/gen_fast_manifest.py
+++ b/utils/gen_fast_manifest.py
@@ -107,7 +107,7 @@ def gen_manifest(top_dir):
manifest_data = b'\n'.join(manifest_entries) + b'\n'
if len(manifest_data) > 4096 and not compat_mode:
- with gzip.GzipFile(os.path.join(top_dir, 'Manifest.gz'), 'wb') as f:
+ with gzip.GzipFile(os.path.join(top_dir, 'Manifest.gz'), 'wb', mtime=0) as f:
f.write(manifest_data)
if had_manifest:
os.unlink(os.path.join(top_dir, 'Manifest'))