1
0
forked from me/IronOS

Merge pull request #587 from GeminiServer/PR-#3-Version-rule-and-format

PR #3 - Firmware build version with short git hash suffix
This commit is contained in:
Ben V. Brown
2020-03-20 09:44:56 +11:00
committed by GitHub
3 changed files with 32 additions and 2 deletions

View File

@@ -7,6 +7,9 @@ import io
from datetime import datetime
import sys
import fontTables
import re
import subprocess
TRANSLATION_CPP = "Translation.cpp"
try:
@@ -94,7 +97,7 @@ def getConstants():
consants.append(('SymbolVolts', 'V'))
consants.append(('SymbolDC', 'DC'))
consants.append(('SymbolCellCount', 'S'))
consants.append(('SymbolVersionNumber', 'V2.08'))
consants.append(('SymbolVersionNumber', buildVersion))
return consants
@@ -450,6 +453,22 @@ def writeLanguage(languageCode, defs, f):
# ----- Block end
f.write(to_unicode("#endif\n"))
def readVersion():
with open(os.path.relpath(jsonDir +
"/../workspace/TS100/version.h"),"r") as version_file:
try:
for line in version_file:
if re.findall(r'^.*(?<=(#define)).*(?<=(BUILD_VERSION))', line):
line = re.findall(r'\"(.+?)\"',line)
if line:
version = line[0]
try: version += "."+ subprocess.check_output(
["git","describe", "--always"]).strip().decode('ascii').upper()
except OSError: version += " git"
finally:
if version_file:
version_file.close();
return version
def read_opts():
""" Reading input parameters
@@ -496,7 +515,6 @@ def writeTarget(outFile, defs, langCodes):
for langCode in langCodes:
writeLanguage(langCode, defs, f)
if __name__ == "__main__":
try:
jsonDir, outFile = read_opts()
@@ -504,6 +522,10 @@ if __name__ == "__main__":
print("usage: make_translation.py {json dir} {cpp dir}")
sys.exit(1)
try: buildVersion = readVersion()
except: print("error: could not get/extract build version"); sys.exit(1)
print("Build version: " + buildVersion)
print("Making " + outFile + " from " + jsonDir)
langDict = readTranslations(jsonDir)

View File

@@ -78,6 +78,7 @@ echo " Builder for the"
echo " Alternate Open Source Firmware"
echo " for Miniware TS100 or TS80"
echo " by Ralim"
echo " "
echo "*********************************************"
# Calculate available languages

View File

@@ -0,0 +1,7 @@
/**
* Firmware build version - format: xx.yy.zzzzzz
* x: Major - y: Minor - z: git short hash generated automaticaly from git
* i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4'
*/
#define BUILD_VERSION "v2.08"