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 #228

Merged
merged 1 commit into from Sep 21, 2017

Conversation

Projects
None yet
2 participants
@bmwiedemann
Contributor

bmwiedemann commented Sep 20, 2017

that ends up in man page headers
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.

This date call only works with GNU date.

An alternative approach that also works with BSD date is to use
date -u -r CHANGELOG.md

@junghans

This comment has been minimized.

Show comment
Hide comment
@junghans

junghans Sep 20, 2017

Member

What about version.cc? Is uses __DATE__, that isn't reproducible either.

Member

junghans commented Sep 20, 2017

What about version.cc? Is uses __DATE__, that isn't reproducible either.

@bmwiedemann

This comment has been minimized.

Show comment
Hide comment
@bmwiedemann

bmwiedemann Sep 20, 2017

Contributor

__DATE__ is reproducible, because gcc has patches to use $SOURCE_DATE_EPOCH for that => https://gcc.gnu.org/ml/gcc-patches/2016-11/msg00183.html

Contributor

bmwiedemann commented Sep 20, 2017

__DATE__ is reproducible, because gcc has patches to use $SOURCE_DATE_EPOCH for that => https://gcc.gnu.org/ml/gcc-patches/2016-11/msg00183.html

@junghans

This comment has been minimized.

Show comment
Hide comment
@junghans

junghans Sep 20, 2017

Member

@bmwiedemann: cool.

I honestly think $(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%s)}) is a bit convoluted.

As we are pre-processing help2t2t.in with cmake's configure_file() I would like to catch SOURCE_DATE_EPOCH in cmake, something like:

if (ENV{'SOURCE_DATE_EPOCH}')
  set(VOTCA_DATE ${ENV{'SOURCE_DATE_EPOCH}')
else()
  set(VOTCA_DATE "$(date)")
endif()

and replace $(date) by @VOTCA_DATE in help2t2t.in.

Member

junghans commented Sep 20, 2017

@bmwiedemann: cool.

I honestly think $(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%s)}) is a bit convoluted.

As we are pre-processing help2t2t.in with cmake's configure_file() I would like to catch SOURCE_DATE_EPOCH in cmake, something like:

if (ENV{'SOURCE_DATE_EPOCH}')
  set(VOTCA_DATE ${ENV{'SOURCE_DATE_EPOCH}')
else()
  set(VOTCA_DATE "$(date)")
endif()

and replace $(date) by @VOTCA_DATE in help2t2t.in.

@bmwiedemann

This comment has been minimized.

Show comment
Hide comment
@bmwiedemann

bmwiedemann Sep 21, 2017

Contributor

with cmake 2.8.11 and later, you can just use

 string(TIMESTAMP VOTCA_DATE "%Y-%m-%d %H:%M:%S" UTC)

and latest cmake already has a patch to use SOURCE_DATE_EPOCH for it, which makes it a very nice solution from the reproducible-builds perspective.

Contributor

bmwiedemann commented Sep 21, 2017

with cmake 2.8.11 and later, you can just use

 string(TIMESTAMP VOTCA_DATE "%Y-%m-%d %H:%M:%S" UTC)

and latest cmake already has a patch to use SOURCE_DATE_EPOCH for it, which makes it a very nice solution from the reproducible-builds perspective.

Use cmake TIMESTAMP
which allows to override the build date
(that ends up in man page headers)
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good.
@bmwiedemann

This comment has been minimized.

Show comment
Hide comment
@bmwiedemann

bmwiedemann Sep 21, 2017

Contributor

updated my PR to implement that nicer, less convoluted approach.
Also this is using UTC timezone and ISO date format (the only true way to present date/time)

Contributor

bmwiedemann commented Sep 21, 2017

updated my PR to implement that nicer, less convoluted approach.
Also this is using UTC timezone and ISO date format (the only true way to present date/time)

@junghans

Nice!

@junghans junghans merged commit afe0807 into votca:master Sep 21, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment