[PATCH] version: Do not print sublevel if it is zero

8 views
Skip to first unread message

Fabio Estevam

unread,
Aug 27, 2025, 11:42:15 PMAug 27
to swup...@googlegroups.com, o...@braunwarth.dev, Michael.G...@iris-sensing.com, stefan...@swupdate.org, Fabio Estevam
Prior to commit d275fec4bb2d ("tree-wide: refactor versioning passing")
the sublevel information was not printed when it did not exist.

To keep the same behavior add a check for the sublevel and only print it
if it is non-zero.

Before:

$ swupdate --version
SWUpdate v2025.05.0-1c04eb9f2ff0

After:

$ swupdate --version
SWUpdate v2025.05-1c04eb9f2ff0

Fixes: d275fec4bb2d ("tree-wide: refactor versioning passing")
Signed-off-by: Fabio Estevam <fest...@gmail.com>
---
include/globals.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/globals.h b/include/globals.h
index 2ab5643ad2e4..271f160b7af3 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -10,8 +10,14 @@
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

+#if defined(VERSION_SUBLEVEL) && VERSION_SUBLEVEL > 0
+#define SUBLEVEL_STR "." STR(VERSION_SUBLEVEL)
+#else
+#define SUBLEVEL_STR ""
+#endif
+
#define BANNER "SWUpdate v" \
- STR(VERSION)"."STR(VERSION_PATCHLEVEL)"."STR(VERSION_SUBLEVEL) STR(VERSION_EXTRAVERSION)
+ STR(VERSION) "." STR(VERSION_PATCHLEVEL) SUBLEVEL_STR STR(VERSION_EXTRAVERSION)

#define SWUPDATE_GENERAL_STRING_SIZE 256
#define SWUPDATE_UPDATE_DESCRIPTION_STRING_SIZE 512
--
2.34.1

Reply all
Reply to author
Forward
0 new messages