[Dev-luatex] Reproducible builds using luatex

Alexis Bienvenüe pado at passoire.fr
Mon May 2 14:27:36 CEST 2016


Working on the “reproducible builds” effort [1], we have noted that a
lot of software packages use pdftex/xetex/luatex to build some documents
to be included in the binary package. These builds enclose timestamps in
the documents, preventing reproducible build. The SOURCE_DATE_EPOCH
specification defines an environment variable that is set during
software package building and can be used to replace time() calls (or
equivalent) for build timestamps.

I would like to promote the SOURCE_DATE_EPOCH support for luatex, which
would need two patches in the engine code:

1) one to set timestamps in the PDF file built by luatex from
SOURCE_DATE_EPOCH with UTC timezone if this environment variable is set.

2) one to set `\today' (and related commands, through \year, \month,
\day primitives) from SOURCE_DATE_EPOCH if it is set. A lot of
documentation files are built with the use of \today. Using build date
for it is not as relevant as the "source code date", that is given by
SOURCE_DATE_EPOCH during the build. Moreover, this prevents reproducible
build. Changing this date before compilation needs efforts for all
software packages, and this can't be done easily after compilation in
the PDF file. So adding SOURCE_DATE_EPOCH support to luatex would be
very efficient.

When SOURCE_DATE_EPOCH is not set, luatex should obviously work in the
exact same way as without the patches.

Please find attached a starting point for these two features. The code I
propose implements them, but can be enhanced to make more checks on the
SOURCE_DATE_EPOCH value (if you think this is needed), as done in the
present pdftex engine code (that already implements the first part) [3],
or as described in [4].

See also a little script test-luatex.sh that illustrates the required
result: when SOURCE_DATE_EPOCH is not set, one should get

  TODAY=April 30, 2016
  LOG: This is LuaTeX, Version 0.95.0 (TeX Live 2016)  (format=lualatex
2016.4.30)  30 APR 2016 10:52
  /ModDate (D:20160430105258-11'00')
  /CreationDate (D:20160430105258-11'00')
  /Creator (TeX)

and when SOURCE_DATE_EPOCH is set to 31536000 (epoch for 1971-01-01),
one should get

  TODAY=January 1, 1971
  LOG: This is LuaTeX, Version 0.95.0 (TeX Live 2016)  (format=lualatex
2016.4.30)  1 JAN 1971 00:00
  /ModDate (D:19710101000000Z)
  /CreationDate (D:19710101000000Z)
  /Creator (TeX)

Thanks in advance for considering including these features in luatex.

Alexis Bienvenüe.

 [1]: https://wiki.debian.org/ReproducibleBuilds
 [2]: https://reproducible-builds.org/specs/source-date-epoch/
 [4]: https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal#Examples
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SOURCE_DATE_EPOCH_luatex.diff
Type: text/x-patch
Size: 2248 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/dev-luatex/attachments/20160502/fe0467b3/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-luatex.sh
Type: application/x-shellscript
Size: 550 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/dev-luatex/attachments/20160502/fe0467b3/attachment-0001.bin>

More information about the dev-luatex mailing list