guix: warn and abort when SOURCE_DATE_EPOCH is set

Current behaviour will by-default use SOURCE_DATE_EPOCH from the
environment without warning. This breaks the default reproducibility
from a guix build.

Warn when and exit when this variable is set, and
FORCE_SOURCE_DATE_EPOCH is unset.

Github-Pull: #32678
Rebased-From: 5c4a0f8009
This commit is contained in:
will
2025-06-04 12:24:08 +01:00
committed by fanquake
parent d19a8e0c06
commit c77e250a98

View File

@@ -69,6 +69,24 @@ fi
mkdir -p "$VERSION_BASE"
################
# SOURCE_DATE_EPOCH should not unintentionally be set
################
if [ -n "$SOURCE_DATE_EPOCH" ] && [ -z "$FORCE_SOURCE_DATE_EPOCH" ]; then
cat << EOF
ERR: Environment variable SOURCE_DATE_EPOCH is set which may break reproducibility.
Aborting...
Hint: You may want to:
1. Unset this variable: \`unset SOURCE_DATE_EPOCH\` before rebuilding
2. Set the 'FORCE_SOURCE_DATE_EPOCH' environment variable if you insist on
using your own epoch
EOF
exit 1
fi
################
# Build directories should not exist
################