Skip to content

Commit 5c4a0f8

Browse files
committed
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.
1 parent 4af72d8 commit 5c4a0f8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

contrib/guix/guix-build

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,24 @@ fi
6969

7070
mkdir -p "$VERSION_BASE"
7171

72+
################
73+
# SOURCE_DATE_EPOCH should not unintentionally be set
74+
################
75+
76+
if [ -n "$SOURCE_DATE_EPOCH" ] && [ -z "$FORCE_SOURCE_DATE_EPOCH" ]; then
77+
cat << EOF
78+
ERR: Environment variable SOURCE_DATE_EPOCH is set which may break reproducibility.
79+
80+
Aborting...
81+
82+
Hint: You may want to:
83+
1. Unset this variable: \`unset SOURCE_DATE_EPOCH\` before rebuilding
84+
2. Set the 'FORCE_SOURCE_DATE_EPOCH' environment variable if you insist on
85+
using your own epoch
86+
EOF
87+
exit 1
88+
fi
89+
7290
################
7391
# Build directories should not exist
7492
################

0 commit comments

Comments
 (0)