Source: python3.4
Version: 3.4.3-6
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 python3.4 could not be built reproducibly.

The attached patch fixes several timestamps related issues:

 * CPP gets passed `-DDATE` and `-DTIME` using the time of the latest
   debian/changelog entry. This will fix variations in binaries.
 * The time of the latest debian/changelog entry is given to sphinx via
   `SPHINXOPTS`. This will fix variations in the documentation.
 * `-n` is given to gzip when compressing devhelp to avoid a timestamp.

Unfortunately, this only makes python3.4 reproducible when
`noopt` is in `DEB_BUILD_OPTIONS`. Otherwise, objects contain random
names due to `-ffat-lto-objects`, but this ought to be fixed in GCC.

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

-- 
Lunar                                .''`. 
lu...@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
diff -Nru python3.4-3.4.3/debian/changelog python3.4-3.4.3/debian/changelog
--- python3.4-3.4.3/debian/changelog	2015-05-07 12:43:58.000000000 +0200
+++ python3.4-3.4.3/debian/changelog	2015-05-27 10:35:40.000000000 +0200
@@ -1,3 +1,12 @@
+python3.4 (3.4.3-6.0~reproducible1) UNRELEASED; urgency=medium
+
+  * Make the build reproducible:
+    - Set -DDATE and -DTIME to match the latest debian/changelog entry.
+    - Pass time of latest debian/changelog entry to sphinx via SPHINXOPTS.
+    - Do not store a timestamps when compressing devhelp.
+
+ -- Jérémy Bobbio <lu...@debian.org>  Wed, 27 May 2015 10:15:54 +0200
+
 python3.4 (3.4.3-6) unstable; urgency=medium
 
   * Update to 20150429 from the 3.4 branch.
diff -Nru python3.4-3.4.3/debian/rules python3.4-3.4.3/debian/rules
--- python3.4-3.4.3/debian/rules	2015-04-30 13:58:06.000000000 +0200
+++ python3.4-3.4.3/debian/rules	2015-05-27 10:35:12.000000000 +0200
@@ -23,6 +23,17 @@
 PKGSOURCE  := $(call vafilt,$(CHANGELOG_VARS),Source)
 PKGVERSION := $(call vafilt,$(CHANGELOG_VARS),Version)
 
+LAST_CHANGE = $(shell dpkg-parsechangelog -S Date)
+
+BUILD_DATE := $(shell LC_ALL=C date -u +'"%H:%M:%S"' -d "$(LAST_CHANGE)")
+BUILD_TIME := $(shell LC_ALL=C date -u +'"%b %e %Y"' -d "$(LAST_CHANGE)")
+export BUILD_DATE BUILD_TIME
+BUILD_TIME_CCPFLAGS := -DDATE="$$$$BUILD_DATE" -DTIME="$$$$BUILD_TIME"
+
+SPHINXOPTS := -D today="$(shell LC_ALL=C date -u +"%B %d, %Y" -d "$(LAST_CHANGE)")"
+SPHINXOPTS += -D html_last_updated_fmt="$(shell LC_ALL=C date -u +"%B %d, %Y" -d "$(LAST_CHANGE)")"
+export SPHINXOPTS
+
 on_buildd := $(shell [ -f /CurrentlyBuilding -o "$$LOGNAME" = buildd -o "$$USER" = buildd ] && echo yes)
 
 ifneq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
@@ -337,7 +348,7 @@
 	mkdir -p $(buildd_shared)
 	cd $(buildd_shared) && \
 	  CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" CFLAGS="$(OPT_CFLAGS)" \
-	  CPPFLAGS="$(DPKG_CPPFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
+	  CPPFLAGS='$(DPKG_CPPFLAGS) $(BUILD_TIME_CCPFLAGS)' LDFLAGS="$(DPKG_LDFLAGS)" \
 	    $(config_site) \
 	    ../configure \
 		--enable-shared \
@@ -355,7 +366,7 @@
 	mkdir -p $(buildd_static)
 	cd $(buildd_static) && \
 	  CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" CFLAGS="$(OPT_CFLAGS)" \
-	  CPPFLAGS="$(DPKG_CPPFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
+	  CPPFLAGS='$(DPKG_CPPFLAGS) $(BUILD_TIME_CCPFLAGS)' LDFLAGS="$(DPKG_LDFLAGS)" \
 	    $(config_site) \
 	    ../configure \
 		$(common_configure_args)
@@ -368,7 +379,7 @@
 	mkdir -p $(buildd_debug)
 	cd $(buildd_debug) && \
 	  CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" CFLAGS="$(DEBUG_CFLAGS)" \
-	  CPPFLAGS="$(DPKG_CPPFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
+	  CPPFLAGS='$(DPKG_CPPFLAGS) $(BUILD_TIME_CCPFLAGS)' LDFLAGS="$(DPKG_LDFLAGS)" \
 	    $(config_site) \
 	    ../configure \
 		$(common_configure_args) \
@@ -382,7 +393,7 @@
 	mkdir -p $(buildd_shdebug)
 	cd $(buildd_shdebug) && \
 	  CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" CFLAGS="$(DEBUG_CFLAGS)" \
-	  CPPFLAGS="$(DPKG_CPPFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
+	  CPPFLAGS='$(DPKG_CPPFLAGS) $(BUILD_TIME_CCPFLAGS)' LDFLAGS="$(DPKG_LDFLAGS)" \
 	    $(config_site) \
 	    ../configure \
 		$(common_configure_args) \
@@ -1277,7 +1288,7 @@
 	cd $(buildd_static) && ./python ../debian/pyhtml2devhelp.py \
 		../$(d_doc)/usr/share/doc/$(p_base)/html index.html $(VER) \
 		> ../$(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp
-	gzip -9v $(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp
+	gzip -9nv $(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp
 	dh_link -p$(p_doc) \
 		/usr/share/doc/$(p_base)/html /usr/share/devhelp/books/$(PVER)

Attachment: signature.asc
Description: 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