diff options
author | 2017-03-22 17:39:10 +0000 | |
---|---|---|
committer | 2017-03-23 09:49:34 +0000 | |
commit | 48631eab923a0a04c27320253dd770a2f545eed7 (patch) | |
tree | 094492ff357767dae301a449407c1736158c8bdb /scripts/bootstrap/bootstrap.sh | |
parent | e3ccf8fe9fc1cb1922a55f923398f8064bf1bd04 (diff) |
Honor SOURCE_DATE_EPOCH in bootstrapping
Currently, a stamped bazel binary contains the actual timestamp at build
time. This means, that building bazel we either include no version
information at all, or the binary contains a not reproducible time
stamp. Both are not acceptable from the point of view of a downstream
maintainer of a bazel package, where the requirement is that the package
be reproducible, but the binary still provide sensible version information.
Fortunately, there is a suggested standard to solve this problem taking
the "current time" from the SOURCE_DATE_EPOCH environment variable, if
set, rather than the actual time.
See https://reproducible-builds.org/specs/source-date-epoch/.
Honor this proposed standard, so that bazel can reasonably be packaged
downstream. See issue #2240.
Note that we only use the environment variable in our bootstrap script;
for bazel itself we communicate that information via an appropriate
option.
--
Change-Id: I55409a117285b9a3446421179c20f4e8c59088f8
Reviewed-on: https://cr.bazel.build/9467
PiperOrigin-RevId: 150896326
MOS_MIGRATED_REVID=150896326
Diffstat (limited to 'scripts/bootstrap/bootstrap.sh')
-rwxr-xr-x | scripts/bootstrap/bootstrap.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/bootstrap/bootstrap.sh b/scripts/bootstrap/bootstrap.sh index a9eea83dff..3832692d38 100755 --- a/scripts/bootstrap/bootstrap.sh +++ b/scripts/bootstrap/bootstrap.sh @@ -22,10 +22,14 @@ : ${BAZELRC:="/dev/null"} : ${EMBED_LABEL:=""} +: ${SOURCE_DATE_EPOCH:=""} EMBED_LABEL_ARG=() if [ -n "${EMBED_LABEL}" ]; then EMBED_LABEL_ARG=(--stamp --embed_label "${EMBED_LABEL}") + if [ -n "${SOURCE_DATE_EPOCH}" ]; then + EMBED_LABEL_ARG+=(--experimental_embed_timestamp_epoch "${SOURCE_DATE_EPOCH}") + fi fi : ${JAVA_VERSION:="1.8"} |