[kvm-unit-tests PATCH] avoid encoding mtime in standalone scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reproducible builds aid in caching builds and tests. Ideally rebuilding
the same source produces identical outputs.

The standalone kvm test scripts contain base64 encoded gzip compressed
test binaries. Compression and encoding is done with
"gzip -c FILE | base64" which stores FILE's name and mtime in the
compressed output.

Binaries are expanded with
  base64 -d << 'BIN_EOF' | zcat > OUTPUT
This expansion pipeline ignores the gzip stored name and mtime.

Use "gzip -n" to avoid saving mtime in the output. This makes the
standalone test scripts reproducible. Their contents are the same
regardless of when they are built.

Signed-off-by: Greg Thelen <gthelen@xxxxxxxxxx>
---
 scripts/mkstandalone.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index 86c7e5498246..1e6d308b43f7 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -16,7 +16,8 @@ temp_file ()
 	echo "cleanup=\"\$$var \$cleanup\""
 	echo "base64 -d << 'BIN_EOF' | zcat > \$$var || exit 2"
 
-	gzip -c "$file" | base64
+	# For reproductible builds avoid saving $file mtime with -n
+	gzip -nc "$file" | base64
 
 	echo "BIN_EOF"
 	echo "chmod +x \$$var"
-- 
2.39.0.rc0.267.gcb52ba06e7-goog




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux