[Pkg-rust-maintainers] Bug#1092917: rust-xh: please make the build reproducible

Chris Lamb lamby at debian.org
Mon Jan 13 12:18:24 GMT 2025


Source: rust-xh
Version: 0.23.1-2
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed that
rust-xh could not be built reproducibly.

This is because the manual page embeds the current build date.

The patch attached mangles this date after the file has been generated
to use SOURCE_DATE_EPOCH. There is an alternative solution that parses
SOURCE_DATE_EPOCH within Rust itself, but I think that might require
an additional Rust crate [1].

 [0] https://reproducible-builds.org/
 [1] https://reproducible-builds.org/docs/source-date-epoch/#rust


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
--- a/debian/rules	2025-01-13 11:38:41.366168680 +0000
--- b/debian/rules	2025-01-13 11:52:09.832195254 +0000
@@ -1,7 +1,10 @@
 #!/usr/bin/make -f
 
+BUILD_DATE := $(shell LC_ALL=C date --utc "+%Y-%m-%d" -d "@$(SOURCE_DATE_EPOCH)")
+
 %:
 	dh $@ --buildsystem cargo --with shell_completions
 
 execute_after_dh_auto_install:
 	debian/*/usr/bin/xh --generate man > debian/xh.1
+	sed -i -e 's@^\(.TH XH 1 \)\([^ ]*\)@\1$(BUILD_DATE)@g' debian/xh.1


More information about the Pkg-rust-maintainers mailing list