Source: rsync
Version: 3.1.1-3
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps

Hi!

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

The attached patch removes extra timestamps from the gzipped docs and
fixes the files mtime before building the binary packages. Once applied,
rsync can be built reproducibly in our current experimental framework.

 [1]: https://wiki.debian.org/ReproducibleBuilds
-- 
Dhole
diff --git a/rsync-3.1.1/debian/rules b/rsync-3.1.1/debian/rules
index 998ad76..54faa0c 100755
--- a/rsync-3.1.1/debian/rules
+++ b/rsync-3.1.1/debian/rules
@@ -42,6 +42,7 @@ DEB_HOST_GNU_TYPE=$(DEB_BUILD_GNU_TYPE)
 
 DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+BUILD_DATE=$(shell dpkg-parsechangelog --show-field Date)
 
 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
 INSTALL_CROSS := 
@@ -111,7 +112,7 @@ endif
        $(INSTALL_FILE) debian/README.Debian   debian/tmp/usr/share/doc/rsync/
        echo -e '\n\f' >> debian/tmp/usr/share/doc/rsync/changelog
        cat OLDNEWS    >> debian/tmp/usr/share/doc/rsync/changelog
-       gzip -9fr `find debian/tmp/usr/share/doc/ debian/tmp/usr/share/man/ 
-type f`
+       gzip -9frn `find debian/tmp/usr/share/doc/ debian/tmp/usr/share/man/ 
-type f`
        $(INSTALL_FILE) debian/rsyncd.conf debian/logrotate.conf.rsync 
debian/tmp/usr/share/doc/rsync/examples/
        $(INSTALL_FILE) debian/copyright debian/tmp/usr/share/doc/rsync/
        # $(INSTALL_SCRIPT) test.sh debian/tmp/usr/lib/debian-test/tests/rsync
@@ -128,6 +129,8 @@ endif
        dpkg-gencontrol -isp
        chown -R root.root debian/tmp
        chmod -R go=rX debian/tmp
+       find debian/tmp -depth -newermt '$(BUILD_DATE)' -print0 | \
+               xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
        dpkg --build debian/tmp ..
 
 # Below here is fairly generic really

Reply via email to