From 203da1e51ba8aff1c5bc6232d20b708f1cc72221 Mon Sep 17 00:00:00 2001 From: Robert Sturla Date: Thu, 25 Dec 2025 18:02:13 +0000 Subject: [PATCH] compressor_command: Use gzip -n for reproducible output The gzip format includes an MTIME field in its header that stores the modification time of the original file. This causes compressed archives to differ between builds even when the uncompressed content is identical. Add the --no-name flag to gzip which suppresses storing the original filename and timestamp, making gzip output reproducible. Signed-off-by: Robert Sturla --- mkosi/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 976fb399e..deac0ef33 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -2349,7 +2349,7 @@ def compressor_command(context: Context, compression: Compression) -> list[PathS """Returns a command suitable for compressing archives.""" if compression == Compression.gz: - return [gzip_binary(context), f"-{context.config.compress_level}", "--stdout", "-"] + return [gzip_binary(context), "--no-name", f"-{context.config.compress_level}", "--stdout", "-"] elif compression == Compression.xz: return ["xz", "--check=crc32", f"-{context.config.compress_level}", "-T0", "--stdout", "-"] elif compression == Compression.zstd: -- 2.47.3