From 5c4a0f8009cef758be9412428515bfed57b0c923 Mon Sep 17 00:00:00 2001 From: will Date: Wed, 4 Jun 2025 12:24:08 +0100 Subject: [PATCH] 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. --- contrib/guix/guix-build | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/contrib/guix/guix-build b/contrib/guix/guix-build index 2ea574fe4b9..715568c1543 100755 --- a/contrib/guix/guix-build +++ b/contrib/guix/guix-build @@ -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 ################