Source: python2.7 Version: 2.7.10-1 Severity: wishlist Tags: patch User: [email protected] Usertags: timestamps
Hi!
While working on the “reproducible builds” effort [1], we have noticed
that python2.7 could not be built reproducibly.
The attached patch fixes several timestamps related issues:
* A C header is generated defining the `DATE` and `TIME` macros using
the time of the latest debian/changelog entry. The header is further
given through `-imacros` in CPPFLAGS.
* 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.
How DATE and TIME is set is slightly different from how it's done in
#786959 and #786965 for python 3.{5,4} as the configure script had
different quoting rules.
Unfortunately, this only makes python2.7 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.
Having `nobench` in `DEB_BUILD_OPTIONS` is also required, as otherwise
`pybench.log` will contain uname output and time measurements depending
on the system work load. I'm not sure what's best for this last issue.
[1]: https://wiki.debian.org/ReproducibleBuilds
--
Lunar .''`.
[email protected] : :Ⓐ : # apt-get install anarchism
`. `'`
`-
diff -u python2.7-2.7.10/debian/changelog python2.7-2.7.10/debian/changelog --- python2.7-2.7.10/debian/changelog +++ python2.7-2.7.10/debian/changelog @@ -1,3 +1,13 @@ +python2.7 (2.7.10-1.0~reproducible1) UNRELEASED; urgency=low + + * Make the build reproducible: + - Create a datetime.h header with DATE and TIME macros set 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 <[email protected]> Wed, 27 May 2015 11:19:39 +0200 + python2.7 (2.7.10-1) unstable; urgency=medium * Python 2.7.10 release. diff -u python2.7-2.7.10/debian/rules python2.7-2.7.10/debian/rules --- python2.7-2.7.10/debian/rules +++ python2.7-2.7.10/debian/rules @@ -25,6 +25,16 @@ PKGSOURCE := $(word 1, $(changelog_values)) PKGVERSION := $(word 2, $(changelog_values)) +LAST_CHANGE = $(shell dpkg-parsechangelog -S Date) + +BUILD_DATE := $(shell LC_ALL=C date -u +'"%b %e %Y"' -d "$(LAST_CHANGE)") +BUILD_TIME := $(shell LC_ALL=C date -u +'"%H:%M:%S"' -d "$(LAST_CHANGE)") +BUILD_TIME_CCPFLAGS := -imacros $(shell pwd)/datetime.h + +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))) @@ -324,7 +334,8 @@ mkdir -p $(buildd_shared) cd $(buildd_shared) && \ CC="$(CC)" AR="$(AR)" RANLIB="$(RANLIB)" \ - CFLAGS="$(OPT_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \ + CFLAGS="$(OPT_CFLAGS)" CPPFLAGS="$(BUILD_TIME_CCPFLAGS)" \ + LDFLAGS="$(DPKG_LDFLAGS)" \ $(config_site) \ ../configure \ --enable-shared \ @@ -339,7 +350,8 @@ mkdir -p $(buildd_static) cd $(buildd_static) && \ CC="$(CC)" AR="$(AR)" RANLIB="$(RANLIB)" \ - CFLAGS="$(OPT_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \ + CFLAGS="$(OPT_CFLAGS)" CPPFLAGS="$(BUILD_TIME_CCPFLAGS)" \ + LDFLAGS="$(DPKG_LDFLAGS)" \ $(config_site) \ ../configure \ $(common_configure_args) @@ -353,7 +365,8 @@ mkdir -p $(buildd_debug) cd $(buildd_debug) && \ CC="$(CC)" AR="$(AR)" RANLIB="$(RANLIB)" \ - CFLAGS="$(DEBUG_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \ + CFLAGS="$(DEBUG_CFLAGS)" CPPFLAGS="$(BUILD_TIME_CCPFLAGS)" \ + LDFLAGS="$(DPKG_LDFLAGS)" \ $(config_site) \ ../configure \ $(common_configure_args) \ @@ -368,7 +381,8 @@ mkdir -p $(buildd_shdebug) cd $(buildd_shdebug) && \ CC="$(CC)" AR="$(AR)" RANLIB="$(RANLIB)" \ - CFLAGS="$(DEBUG_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \ + CFLAGS="$(DEBUG_CFLAGS)" CPPFLAGS="$(BUILD_TIME_CCPFLAGS)" \ + LDFLAGS="$(DPKG_LDFLAGS)" \ $(config_site) \ ../configure \ $(common_configure_args) \ @@ -661,6 +675,9 @@ clean: control-file dh_testdir dh_testroot + + rm -f datetime.h + $(MAKE) -f debian/rules unpatch rm -rf stamps .pc rm -f debian/test_results @@ -1232,7 +1249,7 @@ $(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) @@ -1383,6 +1400,10 @@ touch Python/graminit.c ln -sf site-packages Lib/dist-packages + : # create deterministic header for date and time + echo '#define DATE $(BUILD_DATE)' > datetime.h + echo '#define TIME $(BUILD_TIME)' >> datetime.h + reverse-patches: unpatch unpatch: QUILT_PATCHES=$(patchdir) quilt pop -a -R || test $$? = 2
signature.asc
Description: Digital signature

