From 8b49f734cb06b4862007c10695d19f7e2eebd758 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Thu, 10 Dec 2015 12:26:49 +1100 Subject: Use the git hash for the revision in the version string. --- wscript | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'wscript') diff --git a/wscript b/wscript index 654845d..d519f06 100644 --- a/wscript +++ b/wscript @@ -36,7 +36,9 @@ subdirs = ['rtemstoolkit', 'tools/gdb/python'] def get_version(ctx): - release = '4.12.not_released' + version = '4.12' + revision = 'not_released' + release = '%s.%s' % (version, revision) if os.path.exists('VERSION'): try: with open('VERSION') as v: @@ -44,6 +46,16 @@ def get_version(ctx): v.close() except: ctx.fatal('cannot access the VERSION file') + else: + from rtemstoolkit import git + repo = git.repo('.') + if repo.valid(): + head = repo.head() + if repo.dirty(): + modified = '_modified' + else: + modified = '' + release = '%s.%s%s)' % (version, head[0:12], modified) last_dot = release.rfind('.') if last_dot == -1: ctx.fatal('invalid VERSION file') @@ -83,6 +95,8 @@ def configure(ctx): except: pass ctx.env.RTEMS_VERSION, ctx.env.RTEMS_RELEASE = get_version(ctx) + ctx.start_msg('Version') + ctx.end_msg('%s (%s)' % (ctx.env.RTEMS_RELEASE, ctx.env.RTEMS_VERSION)) ctx.env.C_OPTS = ctx.options.c_opts.split(',') check_options(ctx, ctx.options.host) recurse(ctx) -- cgit v1.2.3