summaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-01-04 11:02:45 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-01-09 09:23:58 +0100
commit3202e319a19297e3d61d6fe1db87b5ba5a940d28 (patch)
tree6d29dd89e4f666973d1acb44c684b37319005947 /wscript
parentc1d296ae96a96c8532f78bf16f78e7be349329b6 (diff)
downloadrtems-docs-3202e319a19297e3d61d6fe1db87b5ba5a940d28.tar.bz2
Replace build date with Git hash and commit date
The usage of a build date prevents reproducible builds.
Diffstat (limited to 'wscript')
-rw-r--r--wscript39
1 files changed, 36 insertions, 3 deletions
diff --git a/wscript b/wscript
index 82d5eaa..1488d3a 100644
--- a/wscript
+++ b/wscript
@@ -9,8 +9,6 @@ path.append(abspath('common'))
import waflib
import waf as docs_waf
-version = '5.0.0 (master)'
-
build_all = ['user',
'rsb',
'c-user',
@@ -31,7 +29,6 @@ def options(opt):
docs_waf.cmd_options(opt)
def configure(conf):
- conf.env.VERSION = version
for b in building:
conf.recurse(b)
conf.env['BUILD_FROM_TOP'] = 'yes'
@@ -53,8 +50,44 @@ def coverpage_js(ctx):
with open(ctx.outputs[0].abspath(), 'w') as o:
o.write(js.replace('@CATALOGUE', xml))
+def pretty_day(day):
+ if day == 3:
+ s = 'rd'
+ elif day == 11:
+ s = 'th'
+ elif day == 12:
+ s = 'th'
+ elif day == 13:
+ s = 'th'
+ elif day % 10 == 1:
+ s = 'st'
+ elif day % 10 == 2:
+ s = 'nd'
+ else:
+ s = 'th'
+ return str(day) + s
+
def build(ctx):
#
+ # Get date and version from Git
+ #
+ version = '5.0.0'
+ if ctx.exec_command(['git', 'diff-index', '--quiet', 'HEAD']) == 0:
+ modified = ''
+ else:
+ modified = '-modified'
+ try:
+ out = ctx.cmd_and_log(['git', 'log', '-1', '--format=%H,%cd', '--date=format:%e,%B,%Y'])
+ f = out.strip('\n').split(',')
+ version = version + '.' + f[0] + modified
+ date = pretty_day(int(f[1])) + ' ' + f[2] + ' ' + f[3]
+ except waflib.Build.Errors.WafError:
+ date = 'unknown date'
+ ctx.env.DATE = date
+ ctx.env.RELEASE = version + ' (' + date + ')'
+ ctx.env.VERSION = version
+
+ #
# Generate any PlantUML images if enabled.
#
ctx.recurse('images')