aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard M. Wiedemann <bwiedemann@suse.de>2018-04-16 02:10:04 +0200
committerDavid Robillard <d@drobilla.net>2018-04-21 13:55:58 +0200
commit06700865e1324fc33ae864a5114900cfc7dce6f5 (patch)
tree8b51682546f26449d7d9ade34f5abb18c6bbf575
parent728196c9d55100b63b74b2f118bd80d451636a6c (diff)
downloadlv2-06700865e1324fc33ae864a5114900cfc7dce6f5.tar.xz
Allow build date to be overridden for reproducible documentation
See https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable.
-rw-r--r--lv2/lv2plug.in/ns/lv2core/meta.ttl7
-rwxr-xr-xlv2specgen/lv2specgen.py7
-rw-r--r--wscript4
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 <http://drobilla.net/drobilla#me> ,
<http://plugin.org.uk/swh.xrdf#me> ;
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 <harryhaaren@gmail.com> .
+
+meta:bmwiedemann
+ a foaf:Person ;
+ foaf:name "Bernhard M. Wiedemann" ;
+ foaf:mbox <bwiedemann@suse.de> .
+
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),