New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to override build date #640
Conversation
configure.ac
Outdated
| CONFIG_TIME=`date +"%F %T %z"` | ||
| DATE_FMT="%F %T %z" | ||
| SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" | ||
| CONFIG_TIME=$(date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u "+$DATE_FMT") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does @$SOURCE_DATE_EPOCH mean here?
And too many bashisms, please write as
if test -n "$SOURCE_DATE_EPOCH"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @ is not shell magic, but a literal @ (at) sign as documented in the GNU date man page
EXAMPLES
Convert seconds since the epoch (1970-01-01 UTC) to a date
$ date --date='@2147483647'```
in order 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. Also use UTC to be independent of timezone. This date call is designed to work with all variants of 'date'
| CONFIG_TIME=`date +"%F %T %z"` | ||
| DATE_FMT="%F %T %z" | ||
| test -n "$SOURCE_DATE_EPOCH" || SOURCE_DATE_EPOCH=`date +%s` | ||
| CONFIG_TIME=`date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u "+$DATE_FMT"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what you do with -r here?
Your doc does not say this can be a file,
or what is the intention?
Can we just have
CONFIG_TIME=`date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT"`
and nothing else in this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
date -d would only work with GNU date. BSD date (e.g. MacOSX) takes such integer dates with the -r option instead. And solaris date has neither - that is covered by the third case.
|
OK, thanks! |
in order 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.
Also use UTC to be independent of timezone.
This date call is designed to work with all variants of 'date'
Without this patch, the dosemu package in openSUSE would differ for every build.