From 2a68e9d42577e660f441804091b366dabeea8137 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Wed, 6 Feb 2019 16:46:42 +1100 Subject: Support VERSION file for releasing and deployment - Shorten the GIT hash. --- wscript | 55 ++++++++++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 35 deletions(-) (limited to 'wscript') 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,43 +59,18 @@ 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. # -- cgit v1.2.3