Skip to content

Commit

Permalink
Allow to override build date with SOURCE_DATE_EPOCH
Browse files Browse the repository at this point in the history
to make builds reproducible.
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 date call works with different variants of date (GNU, FreeBSD, ...).

This patch was done while working on reproducible builds for openSUSE.
  • Loading branch information
bmwiedemann committed Apr 24, 2024
1 parent 77fd4df commit 9fe9473
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion proj_mgmt/DATE_cmd.sh
Expand Up @@ -13,5 +13,8 @@ if [ $osType = "Darwin" ]; then
fi
fi

$my_cmd "$arg"
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$($my_cmd +%s)}"
$my_cmd -d "@$SOURCE_DATE_EPOCH" "$arg" 2>/dev/null ||
$my_cmd -r "$SOURCE_DATE_EPOCH" "$arg" 2>/dev/null ||
$my_cmd "$arg"

0 comments on commit 9fe9473

Please sign in to comment.