diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py index f978be4ac..985b0e94d 100644 --- a/mesonbuild/scripts/meson_install.py +++ b/mesonbuild/scripts/meson_install.py @@ -227,7 +227,9 @@ def install_man(d): if outfilename.endswith('.gz') and not full_source_filename.endswith('.gz'): with open(outfilename, 'wb') as of: with open(full_source_filename, 'rb') as sf: - of.write(gzip.compress(sf.read())) + # Set mtime and filename for reproducibility. + with gzip.GzipFile(fileobj=of, mode='wb', filename='', mtime=0) as gz: + gz.write(sf.read()) shutil.copystat(full_source_filename, outfilename) append_to_log(outfilename) else: