aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMinos Galanakis <minos.galanakis@arm.com>2020-11-16 20:15:48 +0000
committerAnton Komlev <Anton.Komlev@arm.com>2020-11-23 12:02:28 +0000
commit3568beaf59425bd3a5382f8c17c59654087b8aa7 (patch)
treec5a6e5ac10d2b98db5853434ba440991eb6d7273 /tools
parentba3d41c5aac3c7aef9808d457233f48ee1a5a717 (diff)
downloadtrusted-firmware-m-3568beaf59425bd3a5382f8c17c59654087b8aa7.tar.gz
Build: Semantic versioning support
This patch modifies the project's versioning schema to support semantic versioning. The new schema going forward is: <Major>.<Minor>.Hotfix> The patch updates: • The TF-M version macros * Previous releases' documentation * The version detection logic for documentation to support old and new schema Signed-off-by: Minos Galanakis <minos.galanakis@arm.com> Change-Id: I6baa0cab849d656c8d756d4a70c10c258ef3001c
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 a5761c2c0..5fb7b86fb 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: