[Buildroot] [PATCH 19/34] reproducibility/python: make python reproducible

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Sat May 7 20:29:26 UTC 2016


Hello,

On Sat, 30 Apr 2016 09:49:15 +0200, Gilles Chanteperdrix wrote:
> python build is not reproducible for two reasons:
> - the libpython library embeds the build timestamps, fix this by
>   overriding the __DATE__ and __TIME__ macro using SOURCE_DATE_EPOCH;
> - _sysconfigdata.py and config/Makefile on target includes references
>   through INSTALL and MKDIR_P variables to host tools, fix this by
>   overriding these variables values with the corresponding paths on
>   buildroot rootfs.

For this second part, are you really aiming at having reproducible
builds with different build directories ? As you say in your cover
letter, that's an even more complicated problem.

> +ifeq ($(BR2_REPRODUCIBLE),y)
> +PYTHON_SOURCE_DATE = `TZ=UTC LANG=C LC_ALL=C date -d @$(SOURCE_DATE_EPOCH) '+%b %_d %Y'`
> +PYTHON_SOURCE_TIME = `TZ=UTC LANG=C LC_ALL=C date -d @$(SOURCE_DATE_EPOCH) '+%T'`
> +
> +PYTHON_CONF_OPTS += \
> +	CFLAGS="$(TARGET_CFLAGS) -Wno-builtin-macro-redefined -include $(PYTHON_DIR)/.br_date_override.h"
> +
> +define PYTHON_OVERRIDE_DATE_HOOK
> +	echo "#define buildroot_stringify(x) #x" > $(PYTHON_DIR)/.br_date_override.h
> +	echo "#define __DATE__ buildroot_stringify($(PYTHON_SOURCE_DATE))" >> $(PYTHON_DIR)/.br_date_override.h
> +	echo "#define __TIME__ buildroot_stringify($(PYTHON_SOURCE_TIME))" >> $(PYTHON_DIR)/.br_date_override.h
> +endef
> +
> +PYTHON_POST_PATCH_HOOKS += PYTHON_OVERRIDE_DATE_HOOK
> +endif

This really needs to be factored out somewhere. Maybe our compiler
wrapper should take of this. Arnout?

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


More information about the buildroot mailing list