Bug 20444 – Make __DATE__ in dlang reproducible using SOURCE_DATE_EPOCH

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-12-12T09:34:57Z
Last change time
2020-04-17T00:02:56Z
Keywords
pull
Assigned to
No Owner
Creator
jelle
Blocks
20445

Comments

Comment #0 by jelle — 2019-12-12T09:34:57Z
The reproducible builds project is working on achieving bit for bit identical builds on for example two different systems. To prove that the same source can be used on two different machines to create an identical build. Timestamps lead to unreproducibility by use of __DATE__ or __TIME__, other compilers such as GCC support SOURCE_DATE_EPOCH which makes the build reproducible by using that epoch timestamp value as value for the __DATE__. It would be nice to see the D compiler also support SOURCE_DATE_EPOCH so that __DATE__ and __TIME__ does not need to be removed from source code to make builds reproducible. More about reproducible builds can be found here: https://reproducible-builds.org/ and about SOURCE_DATE_EPOCH https://reproducible-builds.org/docs/source-date-epoch/ GCC references: https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html https://wiki.debian.org/ReproducibleBuilds/TimestampsFromCPPMacros
Comment #1 by dlang-bot — 2020-04-14T10:40:38Z
@Geod24 created dlang/dmd pull request #11035 "Fix issue 20444 - Support `SOURCE_DATE_EPOCH` for reproducible builds" fixing this issue: - Refactor: Move time/date/timestamp handling to target As mentioned in issue 20444, some compilers (e.g. GCC) support SOURCE_DATE_EPOCH. Moving the handling to target will allow them to hook their driver logic directly, instead of having to edit lexer. - Fix issue 20444 - Support `SOURCE_DATE_EPOCH` for reproducible builds Adds support for the de-facto standard `SOURCE_DATE_EPOCH` variable, for lexer tokens `__DATE__`, `__TIME__`, `__TIMESTAMP__`. https://github.com/dlang/dmd/pull/11035
Comment #2 by dlang-bot — 2020-04-17T00:02:56Z
dlang/dmd pull request #11035 "Fix issue 20444 - Support `SOURCE_DATE_EPOCH` for reproducible builds" was merged into master: - bfb538a1cb5c5991955696db6584fb90bfe783ef by Geod24: Fix issue 20444 - Support `SOURCE_DATE_EPOCH` for reproducible builds Adds support for the de-facto standard `SOURCE_DATE_EPOCH` variable, for lexer tokens `__DATE__`, `__TIME__`, `__TIMESTAMP__`. https://github.com/dlang/dmd/pull/11035