Allow to override build date with SOURCE_DATE_EPOCH
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. Without this patch, building python-debtcollector from a tarball that does not contain a .git dir varied for every build. Change-Id: Iaf8bc1c559f5b149a48c9dd05beb0961365fda7e Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
This commit is contained in:
parent
017c3524ba
commit
7f0b945741
@ -11,14 +11,17 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import time
|
||||||
|
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
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):
|
def _get_last_updated_file(src_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.
|
@ -142,6 +142,9 @@ html_static_path = ['_static']
|
|||||||
|
|
||||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
# using the given strftime format.
|
# 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 = '%b %d, %Y'
|
||||||
html_last_updated_fmt = '%Y-%m-%d %H:%M'
|
html_last_updated_fmt = '%Y-%m-%d %H:%M'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user