Merge "Allow to override build date with SOURCE_DATE_EPOCH"

This commit is contained in:
Zuul 2019-05-03 18:30:15 +00:00 committed by Gerrit Code Review
commit ee131a28b5
3 changed files with 13 additions and 1 deletions

View File

@ -11,14 +11,17 @@
# under the License.
import datetime
import os
import os.path
import subprocess
import time
from sphinx.util import logging
LOG = logging.getLogger(__name__)
_default_last_updated = datetime.datetime.now()
_timeint = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
_default_last_updated = datetime.datetime.utcfromtimestamp(_timeint)
def _get_last_updated_file(src_file):

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Allow to override build date of generated files with SOURCE_DATE_EPOCH
in order to make build results of packages fully reproducible
especially when building from tarballs without a .git directory.

View File

@ -142,6 +142,9 @@ html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# If the SOURCE_DATE_EPOCH env var is set, its value will be used as default
# instead of the build time.
# See https://reproducible-builds.org/specs/source-date-epoch/
# html_last_updated_fmt = '%b %d, %Y'
html_last_updated_fmt = '%Y-%m-%d %H:%M'