Source: lrzsz
Version: 0.12.21-7
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps

Hi!

While working on the “reproducible builds” effort [1], we have noticed
that lrzsz could not be built reproducibly.

The attached patch removes extra timestamps from the gzip files and
sets the files mtime to a known value (last debian package changelog
date) before calling `dpkg --build` to generate the binary packages.
Once applied, lrzsz can be built reproducibly in our current
experimental framework.

 [1]: https://wiki.debian.org/ReproducibleBuilds

-- 
Dhole
diff --git a/lrzsz-0.12.21/debian/rules b/lrzsz-0.12.21/debian/rules
index c24655b..8a75cbc 100755
--- a/lrzsz-0.12.21/debian/rules
+++ b/lrzsz-0.12.21/debian/rules
@@ -13,6 +13,7 @@ endif
 CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
 CFLAGS   = $(shell dpkg-buildflags --get CFLAGS)
 LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
+BUILD_DATE=$(shell dpkg-parsechangelog --show-field Date)
 export CPPFLAGS
 export CFLAGS
 export LDFLAGS
@@ -60,9 +61,9 @@ endif
        install -p -m 0644 -D ChangeLog debian/tmp/usr/share/doc/lrzsz/changelog
        install -p -m 0644 -D debian/changelog 
debian/tmp/usr/share/doc/lrzsz/changelog.Debian
 
-       find debian/tmp/usr/share/man -type f -print0 | xargs -0 gzip -9
+       find debian/tmp/usr/share/man -type f -print0 | xargs -0 gzip -9n
        find debian/tmp/usr/share/doc -type f ! -name copyright ! -name 
'*.html' \
-               \( -name 'changelog*' -o -size +8 \) -print0 | xargs -0 gzip -9
+               \( -name 'changelog*' -o -size +8 \) -print0 | xargs -0 gzip -9n
 
        ln -s rz.1.gz debian/tmp/usr/share/man/man1/rb.1.gz
        ln -s rz.1.gz debian/tmp/usr/share/man/man1/rx.1.gz
@@ -78,6 +79,8 @@ endif
 
        dpkg-shlibdeps debian/tmp/usr/bin/*
        dpkg-gencontrol -isp -plrzsz
+       find debian/tmp -depth -newermt '$(BUILD_DATE)' -print0 | \
+               xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
        dpkg --build debian/tmp ..
 
 binary-indep:

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to