Skip to content

Commit

Permalink
Make the documentation reproducible when rebuilt (#652)
Browse files Browse the repository at this point in the history
The Reproducible Builds project aims to arrange for rebuilding the same
source code in a sufficiently similar environment to produce the same
installable packages every time, as a way to discourage supply-chain
attacks by making it possible to verify that a particular installable
package was built from the claimed source code.

Previously, if meson-python was built twice, at least a year apart,
then its documentation would contain different copyright dates. The
SOURCE_DATE_EPOCH environment variable is used here to avoid that
difference: the intention is that environments that want to produce
reproducible packages will set SOURCE_DATE_EPOCH to some suitable fixed
date (perhaps the date of the most recent git commit) which is held
constant across rebuilds.

See the specification for SOURCE_DATE_EPOCH for more details:
https://reproducible-builds.org/docs/source-date-epoch/

[smcv: Added commit message]

Co-authored-by: Chris Lamb <lamby@debian.org>
  • Loading branch information
smcv and lamby committed Aug 2, 2024
1 parent 9df4ffd commit a933796
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@

import datetime
import os
import time
import sys
sys.path.insert(0, os.path.abspath('..'))
import mesonpy

build_date = datetime.datetime.fromtimestamp(
int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),
tz=datetime.timezone.utc,
)


# -- Project information -----------------------------------------------------

project = 'meson-python'
copyright = f'2021\N{EN DASH}{datetime.date.today().year} The meson-python developers'
copyright = f'2021\N{EN DASH}{build_date.year} The meson-python developers'

# The short X.Y version
version = mesonpy.__version__
Expand Down

0 comments on commit a933796

Please sign in to comment.