Source: coreutils
Version: 8.23-4
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 coreutils could not be built reproducibly. The build process uses
help2man to create some of manpages.

help2man author added support for the SOURCE_DATE_EPOCH environment
variable [2] in version 1.47.1 which makes it possible to use a
pre-defined value instead of the time of the build.

As coreutils source currently contains an old version of help2man, the
attached patch will copy the version in the help2man Debian package
before running ./configure on top of setting SOURCE_DATE_EPOCH to the
date of the latest debian/changelog entry.

Once applied, coreutils can be built reproducibly in our current
experimental framework.

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

-- 
Lunar                                .''`. 
lu...@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
diff -u coreutils-8.23/debian/changelog coreutils-8.23/debian/changelog
--- coreutils-8.23/debian/changelog
+++ coreutils-8.23/debian/changelog
@@ -1,3 +1,14 @@
+coreutils (8.23-4.0~reproducible1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Make the build reproducible:
+    - Replace in-tree help2man by the one in the help2man package. Add
+      the required Build-Depends. The in-tree help2man doesn't support
+      SOURCE_DATE_EPOCH.
+    - Set SOURCE_DATE_EPOCH to the date of the latest debian/changelog entry.
+
+ -- Jérémy Bobbio <lu...@debian.org>  Thu, 26 Nov 2015 12:43:39 +0100
+
 coreutils (8.23-4) unstable; urgency=low
 
   * [33] remove chroot optimization that avoids the actual chroot when 
diff -u coreutils-8.23/debian/control coreutils-8.23/debian/control
--- coreutils-8.23/debian/control
+++ coreutils-8.23/debian/control
@@ -3,7 +3,7 @@
 Section: utils
 Priority: required
 Standards-Version: 3.9.6.0
-Build-Depends: gettext (>= 0.10.37), debhelper (>= 5.0.0), autotools-dev, dh-buildinfo, texinfo (>= 4.2), groff, dpatch, libattr1-dev [linux-any], libacl1-dev [linux-any], libselinux1-dev (>= 1.32) [linux-any], gperf, bison
+Build-Depends: gettext (>= 0.10.37), debhelper (>= 5.0.0), autotools-dev, dh-buildinfo, texinfo (>= 4.2), groff, dpatch, libattr1-dev [linux-any], libacl1-dev [linux-any], libselinux1-dev (>= 1.32) [linux-any], gperf, bison, help2man
 XS-Testsuite: autopkgtest
 
 Package: coreutils
diff -u coreutils-8.23/debian/rules coreutils-8.23/debian/rules
--- coreutils-8.23/debian/rules
+++ coreutils-8.23/debian/rules
@@ -20,6 +20,9 @@
   endif
 endif
 
+# ensure reproducible output
+export SOURCE_DATE_EPOCH = $(shell date -d "$$(dpkg-parsechangelog -SDate)" +%s)
+
 # implement no optimization build option
 CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
 LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
@@ -46,6 +46,9 @@
 	dh_testdir
 	dh_autotools-dev_updateconfig
 
+	# replace in-tree help2man by the one in Debian
+	cp /usr/bin/help2man man/help2man
+
 	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
 		LDFLAGS='$(LDFLAGS)' ./configure \
 		--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \

Attachment: signature.asc
Description: Digital signature

Reply via email to