Skip to content

Commit 0b6da57

Browse files
committed
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.
1 parent 2b48832 commit 0b6da57

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

tools/onlvi.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1+
import subprocess
2+
13
class OnlVersionImplementation(object):
24

35
PRODUCTS = [
46
{
57
"id" : "ONL",
6-
"version": "2.0.0"
7-
}
8-
]
9-
8+
# "version": "20YY-MM"
9+
}
10+
]
11+
12+
def __init__(self):
13+
if 'version' in self.PRODUCTS[0]:
14+
# Release builds have a specific version.
15+
self.release = True
16+
else:
17+
# The current branch is used as the release version.
18+
self.release = False
19+
cmd = ('git', 'rev-parse', '--abbrev-ref', 'HEAD')
20+
branch = subprocess.check_output(cmd).strip()
21+
self.PRODUCTS[0]['version'] = branch
1022

1123
def V_OS_NAME(self, data):
1224
return "Open Network Linux OS"
@@ -55,3 +67,9 @@ def V_FNAME_RELEASE_ID(self, data):
5567

5668
def V_SYSTEM_COMPATIBILITY_VERSION(self, data):
5769
return "2"
70+
71+
def V_ISSUE(self, data):
72+
if self.release:
73+
return "%s %s" % (self.V_OS_NAME(data), self.V_VERSION_ID(data))
74+
else:
75+
return self.V_VERSION_STRING(data)

0 commit comments

Comments
 (0)