From 0b6da573ab5fc7deef3b451d65d57fcf6cb998cd Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 14 Mar 2018 16:14:12 +0000 Subject: [PATCH] Update default versioning scheme for development and release builds. - Development builds will be marked with the branch and build id. - Release builds will contain the specific release name and a simplified system issue string. --- tools/onlvi.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/onlvi.py b/tools/onlvi.py index 6bee3bbe..e1331c60 100644 --- a/tools/onlvi.py +++ b/tools/onlvi.py @@ -1,12 +1,24 @@ +import subprocess + class OnlVersionImplementation(object): PRODUCTS = [ { "id" : "ONL", - "version": "2.0.0" - } - ] +# "version": "20YY-MM" + } + ] + def __init__(self): + if 'version' in self.PRODUCTS[0]: + # Release builds have a specific version. + self.release = True + else: + # The current branch is used as the release version. + self.release = False + cmd = ('git', 'rev-parse', '--abbrev-ref', 'HEAD') + branch = subprocess.check_output(cmd).strip() + self.PRODUCTS[0]['version'] = branch def V_OS_NAME(self, data): return "Open Network Linux OS" @@ -55,3 +67,9 @@ class OnlVersionImplementation(object): def V_SYSTEM_COMPATIBILITY_VERSION(self, data): return "2" + + def V_ISSUE(self, data): + if self.release: + return "%s %s" % (self.V_OS_NAME(data), self.V_VERSION_ID(data)) + else: + return self.V_VERSION_STRING(data)