From 06700865e1324fc33ae864a5114900cfc7dce6f5 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Mon, 16 Apr 2018 02:10:04 +0200 Subject: Allow build date to be overridden for reproducible documentation See https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. --- lv2/lv2plug.in/ns/lv2core/meta.ttl | 7 +++++++ lv2specgen/lv2specgen.py | 7 +++++-- wscript | 4 +++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lv2/lv2plug.in/ns/lv2core/meta.ttl b/lv2/lv2plug.in/ns/lv2core/meta.ttl index 0b655fd..f4d692c 100644 --- a/lv2/lv2plug.in/ns/lv2core/meta.ttl +++ b/lv2/lv2plug.in/ns/lv2core/meta.ttl @@ -32,6 +32,7 @@ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH R doap:developer , ; doap:helper meta:larsl , + meta:bmwiedemann , meta:gabrbedd , meta:daste , meta:kfoltman , @@ -202,3 +203,9 @@ meta:harry a foaf:Person ; foaf:name "Harry van Haaren" ; foaf:mbox . + +meta:bmwiedemann + a foaf:Person ; + foaf:name "Bernhard M. Wiedemann" ; + foaf:mbox . + diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index 11647f2..38594fb 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -46,6 +46,7 @@ import optparse import os import re import sys +import time import xml.sax.saxutils import xml.dom import xml.dom.minidom @@ -1374,8 +1375,10 @@ def specgen(specloc, indir, style_uri, docdir, tags, opts, instances=False, root else: template = template.replace('@COMMENT@', '') - template = template.replace('@DATE@', datetime.datetime.utcnow().strftime('%F')) - template = template.replace('@TIME@', datetime.datetime.utcnow().strftime('%F %H:%M UTC')) + now = int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) + build_date = datetime.datetime.utcfromtimestamp(now) + template = template.replace('@DATE@', build_date.strftime('%F')) + template = template.replace('@TIME@', build_date.strftime('%F %H:%M UTC')) # Write index row if index_path is not None: diff --git a/wscript b/wscript index 7236286..1e3c8af 100644 --- a/wscript +++ b/wscript @@ -184,7 +184,9 @@ def build_index(task): if date is None: import datetime - date = datetime.datetime.now().isoformat() + import time + now = int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) + date = datetime.datetime.utcfromtimestamp(now).strftime('%F') subst_file(task.inputs[0].abspath(), task.outputs[0].abspath(), { '@ROWS@': ''.join(rows), -- cgit v1.2.1