TACC / Lmod

Lmod: An Environment Module System based on Lua, Reads TCL Modules, Supports a Software Hierarchy
http://lmod.readthedocs.org
Other
499 stars 128 forks source link

Allow to override build date with SOURCE_DATE_EPOCH #702

Closed bmwiedemann closed 2 months ago

bmwiedemann commented 6 months ago

Allow to override build date with SOURCE_DATE_EPOCH 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, ...).

Also use UTC to be independent of timezone.

This patch was done while working on reproducible builds for openSUSE.

rtmclay commented 6 months ago

Thanks for this PR. I am happy to let the build date for Lmod to be set to UTC when the variable SOURCE_DATE_EPOCH defined. Otherwise, I prefer that the build time remain the way it has been.

I have updated the testing branch to have a new proj_mgmt/DATE_cmd.sh. Please try the testing branch to see if it works for you.

bmwiedemann commented 6 months ago

I tested that your version (commit 20779240176ae532a2ff3ada602d9b2ebd07bdee) builds reproducibly.

The line https://github.com/TACC/Lmod/commit/20779240176ae532a2ff3ada602d9b2ebd07bdee#diff-2c6b6228189aa8847f547868c4dcd1795539aca42b27032544b3f00f1a35b74cR18 I don't understand.

If it makes the code simpler / more maintainable we can also omit the UTC (-u) part completely, then callers will just have to ensure a normalized timezone env. We already do that in openSUSE.

Edit: I pushed this change to the PR now.

rtmclay commented 6 months ago

The line you asked about just removes "%:z" and replaces it with "%Z". This means that the date-time has UTC and not +00:00.

I am ready to close this PR