aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/documentation/tfm_cmake_defaults.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/tools/documentation/tfm_cmake_defaults.py b/tools/documentation/tfm_cmake_defaults.py
index a5761c2c0e..5fb7b86fbf 100644
--- a/tools/documentation/tfm_cmake_defaults.py
+++ b/tools/documentation/tfm_cmake_defaults.py
@@ -163,15 +163,34 @@ else:
# Version will be retrieved in that order Git -> Cmake -> Boilerplate
try:
+ vrex = re.compile(r'TF-Mv(?P<VER_MAJ>\d{1,2}).(?P<VER_MIN>\d{1,2}).?'
+ r'(?P<VER_HOT>\d{0,2})(?P<RC>\-RC\d)?-'
+ r'(?P<PATCH_NO>\d+)-(?P<GIT_HASH>[a-g0-9]+)')
tfm_def_tfm_ver_full = check_output(["git",
"describe",
- "--tags"]).decode('UTF-8').strip()
- proj, ver, commit_no, git_hash = tfm_def_tfm_ver_full.split("-")
+ "--tags",
+ "--long"]).decode('UTF-8').strip()
+
+ _v = vrex.search(tfm_def_tfm_ver_full)
+ proj = "TF-M"
+ version = [ _v.group("VER_MAJ"),
+ _v.group("VER_MIN"),
+ _v.group("VER_HOT"),
+ _v.group("RC")]
+ commit_no = _v.group("PATCH_NO")
+ git_hash = _v.group("GIT_HASH")
+
+ # Sanitize the verison and remove empty entries
+ version = [i.replace("-","") for i in version if i]
+ tfm_def_tfm_ver_full = ".".join(version)
+ tfm_def_tfm_ver_shrt = ".".join(version[:2])
if (int(commit_no) > 0):
- tfm_def_tfm_ver_shrt = tfm_def_tfm_ver_full
- else:
- tfm_def_tfm_ver_shrt = proj + ver
+ tfm_def_tfm_ver_full = "%s+ ( #%s )" % (tfm_def_tfm_ver_full, git_hash)
+ tfm_def_tfm_ver_shrt = "%s+ ( #%s )" % (tfm_def_tfm_ver_shrt, git_hash)
+
+ tfm_def_tfm_ver_shrt = tfm_def_tfm_ver_full
+
except Exception as E:
try: