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
diff --git a/docs/contributing/release_process.rst b/docs/contributing/release_process.rst
index b47913c..8b6d196 100644
--- a/docs/contributing/release_process.rst
+++ b/docs/contributing/release_process.rst
@@ -25,6 +25,18 @@
Although this document specifies the release cadence, this does not preclude
an adhoc release for specific project requirements.
+Release Version Scheme
+----------------------
+
+Trusted Firmware-M uses a semantic versioning scheme. A version number is
+compiled as a dot separated set of numbers:
+
+**TF-Mv<MAJOR>.<MINOR>.<HOTFIX>**
+
+- <MAJOR>: Major release version for significant feature and API changes.
+- <MINOR>: Minor release version for incremental features and API changes.
+- <HOTFIX>: Used only for backporting **critical bug fix/security patches**.
+
--------------
*Copyright (c) 2020, Arm Limited. All rights reserved.*
diff --git a/docs/introduction/readme.rst b/docs/introduction/readme.rst
index b5ddecc..b53c12c 100644
--- a/docs/introduction/readme.rst
+++ b/docs/introduction/readme.rst
@@ -188,6 +188,10 @@
| v1.1 | 2020-07-15 | 1.1 release | 1f960947 |
+-------------+--------------+--------------------+-------------------+
+Please refer to
+:ref:`docs/contributing/release_process:Release Version Scheme` for interpreting
+version numbers.
+
.. _Cortex-M33: https://developer.arm.com/ip-products/processors/cortex-m/cortex-m33
.. _Cortex-M23: https://developer.arm.com/ip-products/processors/cortex-m/cortex-m23
.. _Cortex-M55: https://developer.arm.com/ip-products/processors/cortex-m/cortex-m55
diff --git a/secure_fw/spm/include/tfm_version.h b/secure_fw/spm/include/tfm_version.h
index 9924146..25354e9 100644
--- a/secure_fw/spm/include/tfm_version.h
+++ b/secure_fw/spm/include/tfm_version.h
@@ -13,12 +13,13 @@
*/
#define VERSION_MAJOR 1
#define VERSION_MINOR 1
+#define VERSION_HOTFIX 0
#define VERSION_STRING ""
#define VERSTR(x) #x
-#define VERCON(major, minor) VERSTR(major)"."VERSTR(minor)
+#define VERCON(major, minor, hotfix) VERSTR(major)"."VERSTR(minor)"."VERSTR(hotfix)
-#define VERSION_FULLSTR VERCON(VERSION_MAJOR, VERSION_MINOR)""VERSION_STRING
+#define VERSION_FULLSTR VERCON(VERSION_MAJOR, VERSION_MINOR, VERSION_HOTFIX)""VERSION_STRING
diff --git a/tools/documentation/tfm_cmake_defaults.py b/tools/documentation/tfm_cmake_defaults.py
index a5761c2..5fb7b86 100644
--- a/tools/documentation/tfm_cmake_defaults.py
+++ b/tools/documentation/tfm_cmake_defaults.py
@@ -163,15 +163,34 @@
# 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: