Set EXTERNAL_BUILD_TIMESTAMP from SOURCE_DATE_EPOCH

to make the package build reproducible by default without
everyone having to discover the custom variable.

See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

This code assigns the plain integer to keep the code simple.
Otherwise we would have to deal with differences between GNU date
and BSD date or include extra build deps like perl or python.
This commit is contained in:
Bernhard M. Wiedemann 2019-12-06 18:32:46 +01:00
parent 7b8e4c0967
commit 1b0319448c

View file

@ -15,6 +15,9 @@ fi
generation=`expr $generation + 1` generation=`expr $generation + 1`
if test -n "$SOURCE_DATE_EPOCH" -a "$EXTERNAL_BUILD_TIMESTAMP" = '' ; then
EXTERNAL_BUILD_TIMESTAMP=$SOURCE_DATE_EPOCH
fi
if test "$EXTERNAL_BUILD_TIMESTAMP" = ''; then if test "$EXTERNAL_BUILD_TIMESTAMP" = ''; then
creation=`LC_ALL=C date | \ creation=`LC_ALL=C date | \
awk '{if (NF == 6) \ awk '{if (NF == 6) \