* [ptxdist] [PATCH v2 1/4] config/setup: make reproducible builds configurable @ 2018-12-12 14:52 Baeuerle, Florian 2018-12-12 14:52 ` [ptxdist] [PATCH v2 2/4] barebox: depend on HOST_LZOP Baeuerle, Florian ` (3 more replies) 0 siblings, 4 replies; 13+ messages in thread From: Baeuerle, Florian @ 2018-12-12 14:52 UTC (permalink / raw) To: ptxdist Some of ptxdist's packages use SOURCE_DATE_EPOCH to make the build results predictable. Make this behaviour more configurable via a newly introduced ptxdist setup options. By default, this will set SOURCE_DATE_EPOCH to the year and month of the used OSELAS Toolchain version. If the used toolchain is not an OSELAS-Toolchain, the PTXdist version is used as a fallback. Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> --- config/setup/Kconfig | 47 ++++++++++++++++++++++++++ config/setup/ptxdistrc.default | 5 +++ scripts/lib/ptxd_lib_reproducible.sh | 49 +++++++++++++++++++++++++++- 3 files changed, 100 insertions(+), 1 deletion(-) diff --git a/config/setup/Kconfig b/config/setup/Kconfig index 990da03a1..10adb970d 100644 --- a/config/setup/Kconfig +++ b/config/setup/Kconfig @@ -264,6 +264,53 @@ config SETUP_DISABLE_LOCAL_CHECK may fail under certain circumstances. Disable this check at your own risk. +config SETUP_DISABLE_REPRODUCIBLE + bool + prompt "disable reproducible builds" + help + By default ptxdist will build some packages in a + reproducible way by injecting fake timestamps, user and + host name into the build. + +if !SETUP_DISABLE_REPRODUCIBLE + +choice + prompt "Fake timestamps source" + default SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN + + config SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN + bool + prompt "toolchain version" + + config SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST + bool + prompt "ptxdist version" + + config SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM + bool + prompt "custom timestamp" + +endchoice + +config SETUP_REPRODUCIBLE_TIMESTAMP + string + default "toolchain" if SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN + default "ptxdist" if SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST + default "custom" if SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM + +if SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM + +config SETUP_REPRODUCIBLE_TIMESTAMP_STRING + string + prompt "Fake timestamp" + default "2018-11-01 UTC" + help + Supply a custom fake timestamp to be injected to the build. + The timestamp is passed to 'date --date'. + +endif +endif + config SETUP_ENV_WHITELIST string "environment variable whitelist (space separated)" help diff --git a/config/setup/ptxdistrc.default b/config/setup/ptxdistrc.default index 397b78eb7..8aa7dcc9a 100644 --- a/config/setup/ptxdistrc.default +++ b/config/setup/ptxdistrc.default @@ -61,6 +61,11 @@ PTXCONF_SETUP_JAVA_SDK="/usr/lib/jvm/default-java" # Developer Options # # PTXCONF_SETUP_DISABLE_LOCAL_CHECK is not set +# PTXCONF_SETUP_DISABLE_REPRODUCIBLE is not set +PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN=y +# PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST is not set +# PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM is not set +PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP="toolchain" PTXCONF_SETUP_ENV_WHITELIST="" # PTXCONF_SETUP_COMMON_CACHE is not set # PTXCONF_SETUP_GEN_DEP_TREE is not set diff --git a/scripts/lib/ptxd_lib_reproducible.sh b/scripts/lib/ptxd_lib_reproducible.sh index e2e664ba8..98c528ac2 100644 --- a/scripts/lib/ptxd_lib_reproducible.sh +++ b/scripts/lib/ptxd_lib_reproducible.sh @@ -8,8 +8,55 @@ # see the README file. # +ptxd_timestamp_ptxdist() { + ptxd_reply="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC" +} + +ptxd_timestamp_toolchain() { + local oselas_ptxconfig="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")" + + if [ -e "${oselas_ptxconfig}" ]; then + local oselas_version="$(source "${oselas_ptxconfig}" && echo ${PTXCONF_CONFIGFILE_VERSION})" + local orig_IFS="${IFS}" + local IFS="." + set -- ${oselas_version} + IFS="${orig_IFS}" + ptxd_reply="${1}-${2}-01 UTC" + else + echo "${PTXDIST_LOG_PROMPT}warning: cannot deduce timestamp from toolchain, falling back to PTXdist version for reproducible timestamp" + ptxd_timestamp_ptxdist + fi +} + +ptxd_timestamp_custom() { + local ts="${PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_STRING}" + + if ! date --date "${ts}" > /dev/null 2>&1; then + echo "${PTXDIST_LOG_PROMPT}warning: '${ts}' is not a valid timestamp, falling back to toolchain for reproducible timestamp" + ptxd_timestamp_toolchain + else + ptxd_reply="${ts}" + fi +} + ptxd_lib_reproducible() { - SOURCE_DATE_EPOCH="$(echo $(date --date="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC" "+%s"))" + if [ "${PTXCONF_SETUP_DISABLE_REPRODUCIBLE}" = "y" ]; then + ptxd_timestamp_ptxdist + else + case "${PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP}" in + "custom") + ptxd_timestamp_custom + ;; + "ptxdist") + ptxd_timestamp_ptxdist + ;; + *) + ptxd_timestamp_toolchain + ;; + esac + fi + + SOURCE_DATE_EPOCH="$(echo $(date --date="${ptxd_reply}" "+%s"))" export SOURCE_DATE_EPOCH PTXDIST_BUILD_TIMESTAMP="$(echo $(date --utc --date @${SOURCE_DATE_EPOCH} +%Y-%m-%dT%H:%M+0000))" -- 2.19.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* [ptxdist] [PATCH v2 2/4] barebox: depend on HOST_LZOP 2018-12-12 14:52 [ptxdist] [PATCH v2 1/4] config/setup: make reproducible builds configurable Baeuerle, Florian @ 2018-12-12 14:52 ` Baeuerle, Florian 2018-12-13 11:16 ` Michael Olbrich 2018-12-12 14:52 ` [ptxdist] [PATCH v2 3/4] barebox: add support for reproducible build Baeuerle, Florian ` (2 subsequent siblings) 3 siblings, 1 reply; 13+ messages in thread From: Baeuerle, Florian @ 2018-12-12 14:52 UTC (permalink / raw) To: ptxdist The version shipped by ptxdist allows us to override the modification time in the lzop headers. Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> --- platforms/barebox.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platforms/barebox.in b/platforms/barebox.in index 645366e93..46ab32a07 100644 --- a/platforms/barebox.in +++ b/platforms/barebox.in @@ -12,7 +12,7 @@ menuconfig BAREBOX select HOST_LIBUSB if BAREBOX_NEEDS_HOST_LIBUSB select HOST_OPENSSL if BAREBOX_NEEDS_HOST_OPENSSL select HOST_IMX_CST if BAREBOX_NEEDS_HOST_IMX_CST - select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP + select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP || !SETUP_DISABLE_REPRODUCIBLE prompt "barebox " bool help -- 2.19.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ptxdist] [PATCH v2 2/4] barebox: depend on HOST_LZOP 2018-12-12 14:52 ` [ptxdist] [PATCH v2 2/4] barebox: depend on HOST_LZOP Baeuerle, Florian @ 2018-12-13 11:16 ` Michael Olbrich 2018-12-13 13:02 ` Baeuerle, Florian 0 siblings, 1 reply; 13+ messages in thread From: Michael Olbrich @ 2018-12-13 11:16 UTC (permalink / raw) To: ptxdist On Wed, Dec 12, 2018 at 02:52:54PM +0000, Baeuerle, Florian wrote: > The version shipped by ptxdist allows us to override the modification > time in the lzop headers. > > Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> > --- > platforms/barebox.in | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/platforms/barebox.in b/platforms/barebox.in > index 645366e93..46ab32a07 100644 > --- a/platforms/barebox.in > +++ b/platforms/barebox.in > @@ -12,7 +12,7 @@ menuconfig BAREBOX > select HOST_LIBUSB if BAREBOX_NEEDS_HOST_LIBUSB > select HOST_OPENSSL if BAREBOX_NEEDS_HOST_OPENSSL > select HOST_IMX_CST if BAREBOX_NEEDS_HOST_IMX_CST > - select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP > + select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP || !SETUP_DISABLE_REPRODUCIBLE This does not work. You will need to enable BAREBOX_NEEDS_HOST_LZOP manually if lzop is used by barebox. Michael > prompt "barebox " > bool > help > -- > 2.19.2 > > _______________________________________________ > ptxdist mailing list > ptxdist@pengutronix.de -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ptxdist] [PATCH v2 2/4] barebox: depend on HOST_LZOP 2018-12-13 11:16 ` Michael Olbrich @ 2018-12-13 13:02 ` Baeuerle, Florian 2018-12-13 13:34 ` Michael Olbrich 0 siblings, 1 reply; 13+ messages in thread From: Baeuerle, Florian @ 2018-12-13 13:02 UTC (permalink / raw) To: ptxdist Am Donnerstag, den 13.12.2018, 12:16 +0100 schrieb Michael Olbrich: > On Wed, Dec 12, 2018 at 02:52:54PM +0000, Baeuerle, Florian wrote: > > The version shipped by ptxdist allows us to override the modification > > time in the lzop headers. > > > > Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> > > --- > > platforms/barebox.in | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/platforms/barebox.in b/platforms/barebox.in > > index 645366e93..46ab32a07 100644 > > --- a/platforms/barebox.in > > +++ b/platforms/barebox.in > > @@ -12,7 +12,7 @@ menuconfig BAREBOX > > select HOST_LIBUSB if BAREBOX_NEEDS_HOST_LIBUSB > > select HOST_OPENSSL if BAREBOX_NEEDS_HOST_OPENSSL > > select HOST_IMX_CST if BAREBOX_NEEDS_HOST_IMX_CST > > - select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP > > + select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP || > > !SETUP_DISABLE_REPRODUCIBLE > > This does not work. You will need to enable BAREBOX_NEEDS_HOST_LZOP > manually if lzop is used by barebox. Oops, you're right – in the platformconfig menu all SETUP_ symbols seem to be undefined. Anyway, it's probably a bad idea to depend on regenerating a platformconfig when the user en/disables user properties. Can I just make barebox unconditionally depend on HOST_LZOP? Other suggestions? - Florian > > Michael > > > prompt "barebox " > > bool > > help > > -- > > 2.19.2 > > > > _______________________________________________ > > ptxdist mailing list > > ptxdist@pengutronix.de _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ptxdist] [PATCH v2 2/4] barebox: depend on HOST_LZOP 2018-12-13 13:02 ` Baeuerle, Florian @ 2018-12-13 13:34 ` Michael Olbrich 2018-12-14 11:54 ` Baeuerle, Florian 0 siblings, 1 reply; 13+ messages in thread From: Michael Olbrich @ 2018-12-13 13:34 UTC (permalink / raw) To: ptxdist On Thu, Dec 13, 2018 at 01:02:50PM +0000, Baeuerle, Florian wrote: > Am Donnerstag, den 13.12.2018, 12:16 +0100 schrieb Michael Olbrich: > > On Wed, Dec 12, 2018 at 02:52:54PM +0000, Baeuerle, Florian wrote: > > > The version shipped by ptxdist allows us to override the modification > > > time in the lzop headers. > > > > > > Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> > > > --- > > > platforms/barebox.in | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/platforms/barebox.in b/platforms/barebox.in > > > index 645366e93..46ab32a07 100644 > > > --- a/platforms/barebox.in > > > +++ b/platforms/barebox.in > > > @@ -12,7 +12,7 @@ menuconfig BAREBOX > > > select HOST_LIBUSB if BAREBOX_NEEDS_HOST_LIBUSB > > > select HOST_OPENSSL if BAREBOX_NEEDS_HOST_OPENSSL > > > select HOST_IMX_CST if BAREBOX_NEEDS_HOST_IMX_CST > > > - select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP > > > + select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP || > > > !SETUP_DISABLE_REPRODUCIBLE > > > > This does not work. You will need to enable BAREBOX_NEEDS_HOST_LZOP > > manually if lzop is used by barebox. > > Oops, you're right – in the platformconfig menu all SETUP_ symbols seem to be > undefined. Anyway, it's probably a bad idea to depend on regenerating a > platformconfig when the user en/disables user properties. > > Can I just make barebox unconditionally depend on HOST_LZOP? > > Other suggestions? Why not leave it as is? lzop is not always used in barebox. You should enable BAREBOX_NEEDS_HOST_LZOP if lzop compression is used in barebox. That's the use-case for this option. Michael -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ptxdist] [PATCH v2 2/4] barebox: depend on HOST_LZOP 2018-12-13 13:34 ` Michael Olbrich @ 2018-12-14 11:54 ` Baeuerle, Florian 0 siblings, 0 replies; 13+ messages in thread From: Baeuerle, Florian @ 2018-12-14 11:54 UTC (permalink / raw) To: ptxdist Am Donnerstag, den 13.12.2018, 14:34 +0100 schrieb Michael Olbrich: > On Thu, Dec 13, 2018 at 01:02:50PM +0000, Baeuerle, Florian wrote: > > Am Donnerstag, den 13.12.2018, 12:16 +0100 schrieb Michael Olbrich: > > > On Wed, Dec 12, 2018 at 02:52:54PM +0000, Baeuerle, Florian wrote: > > > > The version shipped by ptxdist allows us to override the modification > > > > time in the lzop headers. > > > > > > > > Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> > > > > --- > > > > platforms/barebox.in | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/platforms/barebox.in b/platforms/barebox.in > > > > index 645366e93..46ab32a07 100644 > > > > --- a/platforms/barebox.in > > > > +++ b/platforms/barebox.in > > > > @@ -12,7 +12,7 @@ menuconfig BAREBOX > > > > select HOST_LIBUSB if BAREBOX_NEEDS_HOST_LIBUSB > > > > select HOST_OPENSSL if BAREBOX_NEEDS_HOST_OPENSSL > > > > select HOST_IMX_CST if BAREBOX_NEEDS_HOST_IMX_CST > > > > - select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP > > > > + select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP || > > > > !SETUP_DISABLE_REPRODUCIBLE > > > > > > This does not work. You will need to enable BAREBOX_NEEDS_HOST_LZOP > > > manually if lzop is used by barebox. > > > > Oops, you're right – in the platformconfig menu all SETUP_ symbols seem to > > be > > undefined. Anyway, it's probably a bad idea to depend on regenerating a > > platformconfig when the user en/disables user properties. > > > > Can I just make barebox unconditionally depend on HOST_LZOP? > > > > Other suggestions? > > Why not leave it as is? lzop is not always used in barebox. You should > enable BAREBOX_NEEDS_HOST_LZOP if lzop compression is used in barebox. > That's the use-case for this option. > Yes it's an option, but if ptxdist does reproducible by default, then it's a bit misleading that the user has to enable a ptxdist switch if barebox is using lzop to actually get reproducible binaries. Cannot think of any good solution though (other than stating this in the help text maybe?). - Florian _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* [ptxdist] [PATCH v2 3/4] barebox: add support for reproducible build 2018-12-12 14:52 [ptxdist] [PATCH v2 1/4] config/setup: make reproducible builds configurable Baeuerle, Florian 2018-12-12 14:52 ` [ptxdist] [PATCH v2 2/4] barebox: depend on HOST_LZOP Baeuerle, Florian @ 2018-12-12 14:52 ` Baeuerle, Florian 2018-12-12 14:52 ` [ptxdist] [PATCH v2 4/4] barebox_mlo: " Baeuerle, Florian 2018-12-21 10:06 ` [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable Baeuerle, Florian 3 siblings, 0 replies; 13+ messages in thread From: Baeuerle, Florian @ 2018-12-12 14:52 UTC (permalink / raw) To: ptxdist Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> --- rules/barebox.make | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rules/barebox.make b/rules/barebox.make index 4018dd697..4e8ffebf9 100644 --- a/rules/barebox.make +++ b/rules/barebox.make @@ -47,6 +47,15 @@ BAREBOX_WRAPPER_BLACKLIST := \ BAREBOX_CONF_OPT := $(call barebox-opts, BAREBOX) BAREBOX_MAKE_OPT := $(BAREBOX_CONF_OPT) +ifndef PTXCONF_SETUP_DISABLE_REPRODUCIBLE +BAREBOX_MAKE_ENV := $(BAREBOX_MAKE_ENV) \ + SOURCE_DATE_EPOCH="$(SOURCE_DATE_EPOCH)" \ + KBUILD_BUILD_TIMESTAMP="$(shell date --utc --date @$(SOURCE_DATE_EPOCH))" \ + KBUILD_BUILD_VERSION="0" \ + KBUILD_BUILD_USER="ptxdist" \ + KBUILD_BUILD_HOST="ptxdist" +endif + BAREBOX_TAGS_OPT := TAGS tags cscope ifdef PTXCONF_BAREBOX -- 2.19.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* [ptxdist] [PATCH v2 4/4] barebox_mlo: add support for reproducible build 2018-12-12 14:52 [ptxdist] [PATCH v2 1/4] config/setup: make reproducible builds configurable Baeuerle, Florian 2018-12-12 14:52 ` [ptxdist] [PATCH v2 2/4] barebox: depend on HOST_LZOP Baeuerle, Florian 2018-12-12 14:52 ` [ptxdist] [PATCH v2 3/4] barebox: add support for reproducible build Baeuerle, Florian @ 2018-12-12 14:52 ` Baeuerle, Florian 2018-12-21 10:06 ` [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable Baeuerle, Florian 3 siblings, 0 replies; 13+ messages in thread From: Baeuerle, Florian @ 2018-12-12 14:52 UTC (permalink / raw) To: ptxdist Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> --- rules/barebox_mlo.make | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rules/barebox_mlo.make b/rules/barebox_mlo.make index 368da0e8f..2f1da0ca7 100644 --- a/rules/barebox_mlo.make +++ b/rules/barebox_mlo.make @@ -39,7 +39,6 @@ BAREBOX_MLO_WRAPPER_BLACKLIST := \ TARGET_BUILD_ID BAREBOX_MLO_PATH := PATH=$(CROSS_PATH) -BAREBOX_MLO_CONF_ENV := KCONFIG_NOTIMESTAMP=1 BAREBOX_MLO_CONF_TOOL := kconfig BAREBOX_MLO_CONF_OPT := \ V=$(PTXDIST_VERBOSE) \ @@ -49,6 +48,15 @@ BAREBOX_MLO_CONF_OPT := \ BAREBOX_MLO_MAKE_OPT := $(BAREBOX_MLO_CONF_OPT) +ifndef PTXCONF_SETUP_DISABLE_REPRODUCIBLE +BAREBOX_MLO_MAKE_ENV := $(BAREBOX_MLO_MAKE_ENV) \ + SOURCE_DATE_EPOCH="$(SOURCE_DATE_EPOCH)" \ + KBUILD_BUILD_TIMESTAMP="$(shell date --utc --date @$(SOURCE_DATE_EPOCH))" \ + KBUILD_BUILD_VERSION="0" \ + KBUILD_BUILD_USER="ptxdist" \ + KBUILD_BUILD_HOST="ptxdist" +endif + ifdef PTXCONF_BAREBOX_MLO $(BAREBOX_MLO_CONFIG): @echo -- 2.19.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable 2018-12-12 14:52 [ptxdist] [PATCH v2 1/4] config/setup: make reproducible builds configurable Baeuerle, Florian ` (2 preceding siblings ...) 2018-12-12 14:52 ` [ptxdist] [PATCH v2 4/4] barebox_mlo: " Baeuerle, Florian @ 2018-12-21 10:06 ` Baeuerle, Florian 2018-12-21 10:07 ` [ptxdist] [PATCH v3 2/3] barebox: add support for reproducible build Baeuerle, Florian ` (3 more replies) 3 siblings, 4 replies; 13+ messages in thread From: Baeuerle, Florian @ 2018-12-21 10:06 UTC (permalink / raw) To: ptxdist Some of ptxdist's packages use SOURCE_DATE_EPOCH to make the build results predictable. Make this behaviour more configurable via a newly introduced ptxdist setup options. By default, this will set SOURCE_DATE_EPOCH to the year and month of the used OSELAS Toolchain version. If the used toolchain is not an OSELAS-Toolchain, the PTXdist version is used as a fallback. Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> --- config/setup/Kconfig | 47 ++++++++++++++++++++++++++ config/setup/ptxdistrc.default | 5 +++ scripts/lib/ptxd_lib_reproducible.sh | 49 +++++++++++++++++++++++++++- 3 files changed, 100 insertions(+), 1 deletion(-) diff --git a/config/setup/Kconfig b/config/setup/Kconfig index 990da03a1..10adb970d 100644 --- a/config/setup/Kconfig +++ b/config/setup/Kconfig @@ -264,6 +264,53 @@ config SETUP_DISABLE_LOCAL_CHECK may fail under certain circumstances. Disable this check at your own risk. +config SETUP_DISABLE_REPRODUCIBLE + bool + prompt "disable reproducible builds" + help + By default ptxdist will build some packages in a + reproducible way by injecting fake timestamps, user and + host name into the build. + +if !SETUP_DISABLE_REPRODUCIBLE + +choice + prompt "Fake timestamps source" + default SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN + + config SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN + bool + prompt "toolchain version" + + config SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST + bool + prompt "ptxdist version" + + config SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM + bool + prompt "custom timestamp" + +endchoice + +config SETUP_REPRODUCIBLE_TIMESTAMP + string + default "toolchain" if SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN + default "ptxdist" if SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST + default "custom" if SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM + +if SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM + +config SETUP_REPRODUCIBLE_TIMESTAMP_STRING + string + prompt "Fake timestamp" + default "2018-11-01 UTC" + help + Supply a custom fake timestamp to be injected to the build. + The timestamp is passed to 'date --date'. + +endif +endif + config SETUP_ENV_WHITELIST string "environment variable whitelist (space separated)" help diff --git a/config/setup/ptxdistrc.default b/config/setup/ptxdistrc.default index 397b78eb7..8aa7dcc9a 100644 --- a/config/setup/ptxdistrc.default +++ b/config/setup/ptxdistrc.default @@ -61,6 +61,11 @@ PTXCONF_SETUP_JAVA_SDK="/usr/lib/jvm/default-java" # Developer Options # # PTXCONF_SETUP_DISABLE_LOCAL_CHECK is not set +# PTXCONF_SETUP_DISABLE_REPRODUCIBLE is not set +PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN=y +# PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST is not set +# PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM is not set +PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP="toolchain" PTXCONF_SETUP_ENV_WHITELIST="" # PTXCONF_SETUP_COMMON_CACHE is not set # PTXCONF_SETUP_GEN_DEP_TREE is not set diff --git a/scripts/lib/ptxd_lib_reproducible.sh b/scripts/lib/ptxd_lib_reproducible.sh index e2e664ba8..98c528ac2 100644 --- a/scripts/lib/ptxd_lib_reproducible.sh +++ b/scripts/lib/ptxd_lib_reproducible.sh @@ -8,8 +8,55 @@ # see the README file. # +ptxd_timestamp_ptxdist() { + ptxd_reply="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC" +} + +ptxd_timestamp_toolchain() { + local oselas_ptxconfig="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")" + + if [ -e "${oselas_ptxconfig}" ]; then + local oselas_version="$(source "${oselas_ptxconfig}" && echo ${PTXCONF_CONFIGFILE_VERSION})" + local orig_IFS="${IFS}" + local IFS="." + set -- ${oselas_version} + IFS="${orig_IFS}" + ptxd_reply="${1}-${2}-01 UTC" + else + echo "${PTXDIST_LOG_PROMPT}warning: cannot deduce timestamp from toolchain, falling back to PTXdist version for reproducible timestamp" + ptxd_timestamp_ptxdist + fi +} + +ptxd_timestamp_custom() { + local ts="${PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_STRING}" + + if ! date --date "${ts}" > /dev/null 2>&1; then + echo "${PTXDIST_LOG_PROMPT}warning: '${ts}' is not a valid timestamp, falling back to toolchain for reproducible timestamp" + ptxd_timestamp_toolchain + else + ptxd_reply="${ts}" + fi +} + ptxd_lib_reproducible() { - SOURCE_DATE_EPOCH="$(echo $(date --date="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC" "+%s"))" + if [ "${PTXCONF_SETUP_DISABLE_REPRODUCIBLE}" = "y" ]; then + ptxd_timestamp_ptxdist + else + case "${PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP}" in + "custom") + ptxd_timestamp_custom + ;; + "ptxdist") + ptxd_timestamp_ptxdist + ;; + *) + ptxd_timestamp_toolchain + ;; + esac + fi + + SOURCE_DATE_EPOCH="$(echo $(date --date="${ptxd_reply}" "+%s"))" export SOURCE_DATE_EPOCH PTXDIST_BUILD_TIMESTAMP="$(echo $(date --utc --date @${SOURCE_DATE_EPOCH} +%Y-%m-%dT%H:%M+0000))" -- 2.19.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* [ptxdist] [PATCH v3 2/3] barebox: add support for reproducible build 2018-12-21 10:06 ` [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable Baeuerle, Florian @ 2018-12-21 10:07 ` Baeuerle, Florian 2018-12-21 10:07 ` [ptxdist] [PATCH v3 3/3] barebox_mlo: " Baeuerle, Florian ` (2 subsequent siblings) 3 siblings, 0 replies; 13+ messages in thread From: Baeuerle, Florian @ 2018-12-21 10:07 UTC (permalink / raw) To: ptxdist Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> --- platforms/barebox.in | 3 +++ rules/barebox.make | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/platforms/barebox.in b/platforms/barebox.in index 645366e93..46f3d8ced 100644 --- a/platforms/barebox.in +++ b/platforms/barebox.in @@ -113,4 +113,7 @@ config BAREBOX_NEEDS_HOST_LZOP lzop is used in order to compile lzop for your development host. + This option is required to produce reproducible lzop- + compressed barebox images. + endif diff --git a/rules/barebox.make b/rules/barebox.make index 83a7126cc..080074f64 100644 --- a/rules/barebox.make +++ b/rules/barebox.make @@ -47,6 +47,15 @@ BAREBOX_WRAPPER_BLACKLIST := \ BAREBOX_CONF_OPT := $(call barebox-opts, BAREBOX) BAREBOX_MAKE_OPT := $(BAREBOX_CONF_OPT) +ifndef PTXCONF_SETUP_DISABLE_REPRODUCIBLE +BAREBOX_MAKE_ENV := $(BAREBOX_MAKE_ENV) \ + SOURCE_DATE_EPOCH="$(SOURCE_DATE_EPOCH)" \ + KBUILD_BUILD_TIMESTAMP="$(shell date --utc --date @$(SOURCE_DATE_EPOCH))" \ + KBUILD_BUILD_VERSION="0" \ + KBUILD_BUILD_USER="ptxdist" \ + KBUILD_BUILD_HOST="ptxdist" +endif + BAREBOX_TAGS_OPT := TAGS tags cscope ifdef PTXCONF_BAREBOX -- 2.19.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* [ptxdist] [PATCH v3 3/3] barebox_mlo: add support for reproducible build 2018-12-21 10:06 ` [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable Baeuerle, Florian 2018-12-21 10:07 ` [ptxdist] [PATCH v3 2/3] barebox: add support for reproducible build Baeuerle, Florian @ 2018-12-21 10:07 ` Baeuerle, Florian 2019-02-08 9:33 ` [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable Baeuerle, Florian 2019-02-08 13:48 ` Michael Olbrich 3 siblings, 0 replies; 13+ messages in thread From: Baeuerle, Florian @ 2018-12-21 10:07 UTC (permalink / raw) To: ptxdist Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> --- rules/barebox_mlo.make | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rules/barebox_mlo.make b/rules/barebox_mlo.make index 368da0e8f..2f1da0ca7 100644 --- a/rules/barebox_mlo.make +++ b/rules/barebox_mlo.make @@ -39,7 +39,6 @@ BAREBOX_MLO_WRAPPER_BLACKLIST := \ TARGET_BUILD_ID BAREBOX_MLO_PATH := PATH=$(CROSS_PATH) -BAREBOX_MLO_CONF_ENV := KCONFIG_NOTIMESTAMP=1 BAREBOX_MLO_CONF_TOOL := kconfig BAREBOX_MLO_CONF_OPT := \ V=$(PTXDIST_VERBOSE) \ @@ -49,6 +48,15 @@ BAREBOX_MLO_CONF_OPT := \ BAREBOX_MLO_MAKE_OPT := $(BAREBOX_MLO_CONF_OPT) +ifndef PTXCONF_SETUP_DISABLE_REPRODUCIBLE +BAREBOX_MLO_MAKE_ENV := $(BAREBOX_MLO_MAKE_ENV) \ + SOURCE_DATE_EPOCH="$(SOURCE_DATE_EPOCH)" \ + KBUILD_BUILD_TIMESTAMP="$(shell date --utc --date @$(SOURCE_DATE_EPOCH))" \ + KBUILD_BUILD_VERSION="0" \ + KBUILD_BUILD_USER="ptxdist" \ + KBUILD_BUILD_HOST="ptxdist" +endif + ifdef PTXCONF_BAREBOX_MLO $(BAREBOX_MLO_CONFIG): @echo -- 2.19.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable 2018-12-21 10:06 ` [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable Baeuerle, Florian 2018-12-21 10:07 ` [ptxdist] [PATCH v3 2/3] barebox: add support for reproducible build Baeuerle, Florian 2018-12-21 10:07 ` [ptxdist] [PATCH v3 3/3] barebox_mlo: " Baeuerle, Florian @ 2019-02-08 9:33 ` Baeuerle, Florian 2019-02-08 13:48 ` Michael Olbrich 3 siblings, 0 replies; 13+ messages in thread From: Baeuerle, Florian @ 2019-02-08 9:33 UTC (permalink / raw) To: ptxdist; +Cc: m.olbrich Hi, we now use this for a while and so far it works well for barebox (there's a patch required for barebox to get a reproducible binary independent of the filsystem in use, but that's included since barebox 2019.01.0). I am not ultimately happy with the patch (ptxdist --version prints a warning), especially not with ifndef PTXCONF_SETUP_DISABLE_REPRODUCIBLE in the rules. I'll fix the ptxdist --version warning and maybe add a symbol that negates the above symbol. I'd be happy about every suggestion that increases the likelihood of acceptance of the patch. We really need this for reducing bootloader update frequency with RAUC. - Florian Am Freitag, den 21.12.2018, 10:06 +0000 schrieb Baeuerle, Florian: > Some of ptxdist's packages use SOURCE_DATE_EPOCH to make the build > results predictable. Make this behaviour more configurable via a newly > introduced ptxdist setup options. > > By default, this will set SOURCE_DATE_EPOCH to the year and month of the > used OSELAS Toolchain version. If the used toolchain is not an > OSELAS-Toolchain, the PTXdist version is used as a fallback. > > Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> > --- > config/setup/Kconfig | 47 ++++++++++++++++++++++++++ > config/setup/ptxdistrc.default | 5 +++ > scripts/lib/ptxd_lib_reproducible.sh | 49 +++++++++++++++++++++++++++- > 3 files changed, 100 insertions(+), 1 deletion(-) > > diff --git a/config/setup/Kconfig b/config/setup/Kconfig > index 990da03a1..10adb970d 100644 > --- a/config/setup/Kconfig > +++ b/config/setup/Kconfig > @@ -264,6 +264,53 @@ config SETUP_DISABLE_LOCAL_CHECK > may fail under certain circumstances. > Disable this check at your own risk. > > +config SETUP_DISABLE_REPRODUCIBLE > + bool > + prompt "disable reproducible builds" > + help > + By default ptxdist will build some packages in a > + reproducible way by injecting fake timestamps, user and > + host name into the build. > + > +if !SETUP_DISABLE_REPRODUCIBLE > + > +choice > + prompt "Fake timestamps source" > + default SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN > + > + config SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN > + bool > + prompt "toolchain version" > + > + config SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST > + bool > + prompt "ptxdist version" > + > + config SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM > + bool > + prompt "custom timestamp" > + > +endchoice > + > +config SETUP_REPRODUCIBLE_TIMESTAMP > + string > + default "toolchain" if SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN > + default "ptxdist" if SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST > + default "custom" if SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM > + > +if SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM > + > +config SETUP_REPRODUCIBLE_TIMESTAMP_STRING > + string > + prompt "Fake timestamp" > + default "2018-11-01 UTC" > + help > + Supply a custom fake timestamp to be injected to the build. > + The timestamp is passed to 'date --date'. > + > +endif > +endif > + > config SETUP_ENV_WHITELIST > string "environment variable whitelist (space separated)" > help > diff --git a/config/setup/ptxdistrc.default b/config/setup/ptxdistrc.default > index 397b78eb7..8aa7dcc9a 100644 > --- a/config/setup/ptxdistrc.default > +++ b/config/setup/ptxdistrc.default > @@ -61,6 +61,11 @@ PTXCONF_SETUP_JAVA_SDK="/usr/lib/jvm/default-java" > # Developer Options > # > # PTXCONF_SETUP_DISABLE_LOCAL_CHECK is not set > +# PTXCONF_SETUP_DISABLE_REPRODUCIBLE is not set > +PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN=y > +# PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST is not set > +# PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM is not set > +PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP="toolchain" > PTXCONF_SETUP_ENV_WHITELIST="" > # PTXCONF_SETUP_COMMON_CACHE is not set > # PTXCONF_SETUP_GEN_DEP_TREE is not set > diff --git a/scripts/lib/ptxd_lib_reproducible.sh > b/scripts/lib/ptxd_lib_reproducible.sh > index e2e664ba8..98c528ac2 100644 > --- a/scripts/lib/ptxd_lib_reproducible.sh > +++ b/scripts/lib/ptxd_lib_reproducible.sh > @@ -8,8 +8,55 @@ > # see the README file. > # > > +ptxd_timestamp_ptxdist() { > + ptxd_reply="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC" > +} > + > +ptxd_timestamp_toolchain() { > + local oselas_ptxconfig="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")" > + > + if [ -e "${oselas_ptxconfig}" ]; then > + local oselas_version="$(source "${oselas_ptxconfig}" && echo > ${PTXCONF_CONFIGFILE_VERSION})" > + local orig_IFS="${IFS}" > + local IFS="." > + set -- ${oselas_version} > + IFS="${orig_IFS}" > + ptxd_reply="${1}-${2}-01 UTC" > + else > + echo "${PTXDIST_LOG_PROMPT}warning: cannot deduce timestamp from > toolchain, falling back to PTXdist version for reproducible timestamp" > + ptxd_timestamp_ptxdist > + fi > +} > + > +ptxd_timestamp_custom() { > + local ts="${PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_STRING}" > + > + if ! date --date "${ts}" > /dev/null 2>&1; then > + echo "${PTXDIST_LOG_PROMPT}warning: '${ts}' is not a valid timestamp, > falling back to toolchain for reproducible timestamp" > + ptxd_timestamp_toolchain > + else > + ptxd_reply="${ts}" > + fi > +} > + > ptxd_lib_reproducible() { > - SOURCE_DATE_EPOCH="$(echo $(date --date="${PTXDIST_VERSION_YEAR}- > ${PTXDIST_VERSION_MONTH}-01 UTC" "+%s"))" > + if [ "${PTXCONF_SETUP_DISABLE_REPRODUCIBLE}" = "y" ]; then > + ptxd_timestamp_ptxdist > + else > + case "${PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP}" in > + "custom") > + ptxd_timestamp_custom > + ;; > + "ptxdist") > + ptxd_timestamp_ptxdist > + ;; > + *) > + ptxd_timestamp_toolchain > + ;; > + esac > + fi > + > + SOURCE_DATE_EPOCH="$(echo $(date --date="${ptxd_reply}" "+%s"))" > export SOURCE_DATE_EPOCH > > PTXDIST_BUILD_TIMESTAMP="$(echo $(date --utc --date @${SOURCE_DATE_EPOCH} > +%Y-%m-%dT%H:%M+0000))" > -- > 2.19.2 > > _______________________________________________ > ptxdist mailing list > ptxdist@pengutronix.de _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable 2018-12-21 10:06 ` [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable Baeuerle, Florian ` (2 preceding siblings ...) 2019-02-08 9:33 ` [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable Baeuerle, Florian @ 2019-02-08 13:48 ` Michael Olbrich 3 siblings, 0 replies; 13+ messages in thread From: Michael Olbrich @ 2019-02-08 13:48 UTC (permalink / raw) To: ptxdist On Fri, Dec 21, 2018 at 10:06:59AM +0000, Baeuerle, Florian wrote: > Some of ptxdist's packages use SOURCE_DATE_EPOCH to make the build > results predictable. Make this behaviour more configurable via a newly > introduced ptxdist setup options. > > By default, this will set SOURCE_DATE_EPOCH to the year and month of the > used OSELAS Toolchain version. If the used toolchain is not an > OSELAS-Toolchain, the PTXdist version is used as a fallback. > > Signed-off-by: Florian Bäuerle <florian.baeuerle@allegion.com> Sorry for the late reply. This got lost on my side. > --- > config/setup/Kconfig | 47 ++++++++++++++++++++++++++ > config/setup/ptxdistrc.default | 5 +++ > scripts/lib/ptxd_lib_reproducible.sh | 49 +++++++++++++++++++++++++++- > 3 files changed, 100 insertions(+), 1 deletion(-) > > diff --git a/config/setup/Kconfig b/config/setup/Kconfig > index 990da03a1..10adb970d 100644 > --- a/config/setup/Kconfig > +++ b/config/setup/Kconfig > @@ -264,6 +264,53 @@ config SETUP_DISABLE_LOCAL_CHECK > may fail under certain circumstances. > Disable this check at your own risk. > > +config SETUP_DISABLE_REPRODUCIBLE > + bool > + prompt "disable reproducible builds" > + help > + By default ptxdist will build some packages in a > + reproducible way by injecting fake timestamps, user and > + host name into the build. > + The switch to disable this should be in setup ... > +if !SETUP_DISABLE_REPRODUCIBLE > + > +choice > + prompt "Fake timestamps source" > + default SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN > + > + config SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN > + bool > + prompt "toolchain version" > + > + config SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST > + bool > + prompt "ptxdist version" > + > + config SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM > + bool > + prompt "custom timestamp" > + > +endchoice ... but the choice should be part of the pxconfig. I would accept a option to disable this here too, but I don't think that's necessary. In my opinion disabling reproducible builds is strictly a development feature. > + > +config SETUP_REPRODUCIBLE_TIMESTAMP > + string > + default "toolchain" if SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN > + default "ptxdist" if SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST > + default "custom" if SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM > + > +if SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM > + > +config SETUP_REPRODUCIBLE_TIMESTAMP_STRING > + string > + prompt "Fake timestamp" > + default "2018-11-01 UTC" I don't think we should provide a default. This should be an explicit choice. But maybe put this as an example in the help text. > + help > + Supply a custom fake timestamp to be injected to the build. > + The timestamp is passed to 'date --date'. > + > +endif > +endif > + > config SETUP_ENV_WHITELIST > string "environment variable whitelist (space separated)" > help > diff --git a/config/setup/ptxdistrc.default b/config/setup/ptxdistrc.default > index 397b78eb7..8aa7dcc9a 100644 > --- a/config/setup/ptxdistrc.default > +++ b/config/setup/ptxdistrc.default > @@ -61,6 +61,11 @@ PTXCONF_SETUP_JAVA_SDK="/usr/lib/jvm/default-java" > # Developer Options > # > # PTXCONF_SETUP_DISABLE_LOCAL_CHECK is not set > +# PTXCONF_SETUP_DISABLE_REPRODUCIBLE is not set > +PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_TOOLCHAIN=y > +# PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_PTXDIST is not set > +# PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_CUSTOM is not set > +PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP="toolchain" > PTXCONF_SETUP_ENV_WHITELIST="" > # PTXCONF_SETUP_COMMON_CACHE is not set > # PTXCONF_SETUP_GEN_DEP_TREE is not set > diff --git a/scripts/lib/ptxd_lib_reproducible.sh b/scripts/lib/ptxd_lib_reproducible.sh > index e2e664ba8..98c528ac2 100644 > --- a/scripts/lib/ptxd_lib_reproducible.sh > +++ b/scripts/lib/ptxd_lib_reproducible.sh > @@ -8,8 +8,55 @@ > # see the README file. > # > > +ptxd_timestamp_ptxdist() { > + ptxd_reply="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC" > +} > + > +ptxd_timestamp_toolchain() { > + local oselas_ptxconfig="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")" > + > + if [ -e "${oselas_ptxconfig}" ]; then > + local oselas_version="$(source "${oselas_ptxconfig}" && echo ${PTXCONF_CONFIGFILE_VERSION})" local oselas_version="$(ptxd_get_kconfig "${oselas_ptxconfig}" PTXCONF_CONFIGFILE_VERSION)" > + local orig_IFS="${IFS}" > + local IFS="." > + set -- ${oselas_version} > + IFS="${orig_IFS}" > + ptxd_reply="${1}-${2}-01 UTC" > + else > + echo "${PTXDIST_LOG_PROMPT}warning: cannot deduce timestamp from toolchain, falling back to PTXdist version for reproducible timestamp" > + ptxd_timestamp_ptxdist No. Just fail here. With the options in the ptxconfig that should be ok. > + fi > +} > + > +ptxd_timestamp_custom() { > + local ts="${PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP_STRING}" With the change I requested above, you'll need to use ptxd_get_ptxconf here (and for the other PTXCONF_* variables from ptxconfig. > + > + if ! date --date "${ts}" > /dev/null 2>&1; then > + echo "${PTXDIST_LOG_PROMPT}warning: '${ts}' is not a valid timestamp, falling back to toolchain for reproducible timestamp" > + ptxd_timestamp_toolchain > + else > + ptxd_reply="${ts}" > + fi > +} > + > ptxd_lib_reproducible() { > - SOURCE_DATE_EPOCH="$(echo $(date --date="${PTXDIST_VERSION_YEAR}-${PTXDIST_VERSION_MONTH}-01 UTC" "+%s"))" > + if [ "${PTXCONF_SETUP_DISABLE_REPRODUCIBLE}" = "y" ]; then > + ptxd_timestamp_ptxdist I don't think that this is correct. Maybe: ptxd_reply="$(date "+@%s")" > + else ptxd_timestamp_$(ptxd_get_ptxconf PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP) should work as expected. Michael > + case "${PTXCONF_SETUP_REPRODUCIBLE_TIMESTAMP}" in > + "custom") > + ptxd_timestamp_custom > + ;; > + "ptxdist") > + ptxd_timestamp_ptxdist > + ;; > + *) > + ptxd_timestamp_toolchain > + ;; > + esac > + fi > + > + SOURCE_DATE_EPOCH="$(echo $(date --date="${ptxd_reply}" "+%s"))" > export SOURCE_DATE_EPOCH > > PTXDIST_BUILD_TIMESTAMP="$(echo $(date --utc --date @${SOURCE_DATE_EPOCH} +%Y-%m-%dT%H:%M+0000))" > -- > 2.19.2 > > _______________________________________________ > ptxdist mailing list > ptxdist@pengutronix.de -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-02-08 13:48 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-12-12 14:52 [ptxdist] [PATCH v2 1/4] config/setup: make reproducible builds configurable Baeuerle, Florian 2018-12-12 14:52 ` [ptxdist] [PATCH v2 2/4] barebox: depend on HOST_LZOP Baeuerle, Florian 2018-12-13 11:16 ` Michael Olbrich 2018-12-13 13:02 ` Baeuerle, Florian 2018-12-13 13:34 ` Michael Olbrich 2018-12-14 11:54 ` Baeuerle, Florian 2018-12-12 14:52 ` [ptxdist] [PATCH v2 3/4] barebox: add support for reproducible build Baeuerle, Florian 2018-12-12 14:52 ` [ptxdist] [PATCH v2 4/4] barebox_mlo: " Baeuerle, Florian 2018-12-21 10:06 ` [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable Baeuerle, Florian 2018-12-21 10:07 ` [ptxdist] [PATCH v3 2/3] barebox: add support for reproducible build Baeuerle, Florian 2018-12-21 10:07 ` [ptxdist] [PATCH v3 3/3] barebox_mlo: " Baeuerle, Florian 2019-02-08 9:33 ` [ptxdist] [PATCH v3 1/3] config/setup: make reproducible builds configurable Baeuerle, Florian 2019-02-08 13:48 ` Michael Olbrich
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox