Source: tworld
Version: 1.3.0-6
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

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

The attached patch sets the mtimes of all files which are modified
during the built to the date of the last changelog entry in order to
produce files with reproducible metadata.

Cheers,
akira

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


diff -u tworld-1.3.0/debian/rules tworld-1.3.0/debian/rules
--- tworld-1.3.0/debian/rules
+++ tworld-1.3.0/debian/rules
@@ -18,6 +18,7 @@
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
+BUILD_DATE := $(shell dpkg-parsechangelog --show-field Date)
 
 CFLAGS  = -Wall -W -fomit-frame-pointer -DNDEBUG
 LDFLAGS = -Wall -W
@@ -114,6 +115,8 @@
                -p$(PKG1) -P$(TMP1)
        cd $(TMP1) && find * -type f ! -regex '^DEBIAN/.*' -print0 | \
                xargs -r0 md5sum > DEBIAN/md5sums
+       find $(TMP1) -newermt '$(BUILD_DATE)' -print0 | \
+               xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
        dpkg --build $(TMP1) ..
 
        $(INSTALL_FILE) debian/copyright debian/README.Debian \
@@ -125,6 +128,8 @@
                -p$(PKG2) -P$(TMP2)
        cd $(TMP2) && find * -type f ! -regex '^DEBIAN/.*' -print0 | \
                xargs -r0 md5sum > DEBIAN/md5sums
+       find $(TMP2) -newermt '$(BUILD_DATE)' -print0 | \
+               xargs -0r touch --no-dereference --date='$(BUILD_DATE)'
        dpkg --build $(TMP2) ..
 
 binary: binary-indep binary-arch
diff -u tworld-1.3.0/debian/changelog tworld-1.3.0/debian/changelog
--- tworld-1.3.0/debian/changelog
+++ tworld-1.3.0/debian/changelog
@@ -1,3 +1,10 @@
+tworld (1.3.0-6.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix mtimes before building binary packages to produce reproducible output
+
+ -- akira <marival...@gmail.com>  Wed, 15 Jul 2015 19:14:15 +0200
+
 tworld (1.3.0-6) unstable; urgency=low
 
   [ Peter Pentchev ]
_______________________________________________
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