blob: a1db2987ac4498387c9913b788d19e1cf100632e [file] [log] [blame]
Andrew Geissler09209ee2020-12-13 08:44:15 -06001From 1919bb7f4072d73dcbb64d0e06eff5b04529c3db Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Mon, 16 Nov 2020 18:01:02 +0000
4Subject: [PATCH] serializer.py: make .gz files reproducible
5
6.gz format contains mtime of the compressed data, and
7SOURCE_DATE_EPOCH is the standard way to make it reproducuble.
8
Andrew Geissler595f6302022-01-24 19:11:47 +00009Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/610]
Andrew Geissler09209ee2020-12-13 08:44:15 -060010Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11---
12 tests/serializer.py | 5 ++++-
13 1 file changed, 4 insertions(+), 1 deletion(-)
14
15diff --git a/tests/serializer.py b/tests/serializer.py
16index bd14bc3db..bc5b45d7f 100644
17--- a/tests/serializer.py
18+++ b/tests/serializer.py
19@@ -138,7 +138,10 @@ def serializer(name, profile, outfile):
20 et.SubElement(env, 'env', name=k, value=v)
21
22 tree = et.ElementTree(root)
23- with gzip.open(outfile, 'wb') as f:
24+ reproducible_mtime = None
25+ if 'SOURCE_DATE_EPOCH' in os.environ:
26+ reproducible_mtime=os.environ['SOURCE_DATE_EPOCH']
27+ with gzip.GzipFile(outfile, 'wb', mtime=reproducible_mtime) as f:
28 tree.write(f, encoding='utf-8', xml_declaration=True)
29
30