summaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2019-02-06 16:46:42 +1100
committerChris Johns <chrisj@rtems.org>2019-02-06 17:01:48 +1100
commit2a68e9d42577e660f441804091b366dabeea8137 (patch)
treeefc2f7598426c3fda6fb06f9e4874f6435f66a94 /wscript
parent21c4a44451dcc8a5b5935ad50e2d663c56098a39 (diff)
downloadrtems-docs-2a68e9d42577e660f441804091b366dabeea8137.tar.bz2
Support VERSION file for releasing and deployment
- Shorten the GIT hash.
Diffstat (limited to 'wscript')
-rw-r--r--wscript55
1 files changed, 20 insertions, 35 deletions
diff --git a/wscript b/wscript
index e66a3f7..e86988d 100644
--- a/wscript
+++ b/wscript
@@ -2,13 +2,23 @@
# RTEMS Project Documentation
#
-from sys import path
-from os.path import abspath
-path.append(abspath('common'))
+import sys
+import os.path
+
+sys.path.append(os.path.abspath('common'))
import waflib
import waf as docs_waf
+import version
+
+#
+# Branch version
+#
+rtems_major_version = '5'
+#
+# The documents to build.
+#
build_all = ['user',
'c-user',
'bsp-howto',
@@ -49,44 +59,19 @@ 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
+ # Get the version.
#
- 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
+ ver_version, ver_date = version.get(ctx, rtems_major_version)
+ ctx.env.DATE = ver_date
+ ctx.env.RELEASE = ver_version + ' (' + ver_date + ')'
+ ctx.env.VERSION = ver_version
+ ctx.to_log('Build: %s%s' % (ctx.env.RELEASE, os.linesep))
#
+ #
# Generate any PlantUML images if enabled.
#
ctx.recurse('images')