From 441ba17b53acc837337aac687cb83ffb5669d1be Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 26 Nov 2023 00:19:59 +0100 Subject: [PATCH] Changed automatic version numbering with "git describe" to split the third part into mini version (leading numbers) and extra version (string after the numbers) --- retroshare.pri | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/retroshare.pri b/retroshare.pri index 19dd5434f..7858f67f6 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -456,13 +456,26 @@ defined in command line") RS_MINOR_VERSION = $$member(RS_GIT_DESCRIBE_SPLIT, 1) RS_GIT_DESCRIBE_SPLIT = $$member(RS_GIT_DESCRIBE_SPLIT, 2) - RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT, -) + RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT, ) - RS_MINI_VERSION = $$member(RS_GIT_DESCRIBE_SPLIT, 0) - - RS_GIT_DESCRIBE_SPLIT = $$member(RS_GIT_DESCRIBE_SPLIT, 1, -1) - - RS_EXTRA_VERSION = $$join(RS_GIT_DESCRIBE_SPLIT,-,-) + # Split string into mini version (leading numbers) and extra version (string after the numbers) + RS_MINI_VERSION = + RS_EXTRA_VERSION = + for(CHAR, RS_GIT_DESCRIBE_SPLIT) { + isEqual(CHAR, 0) | greaterThan(CHAR, 0):lessThan(CHAR, 9) | isEqual(CHAR, 9) { + # Number + isEmpty(RS_EXTRA_VERSION) { + # Add leading numbers to mini version + RS_MINI_VERSION = $${RS_MINI_VERSION}$${CHAR} + } else { + # Add to extra version + RS_EXTRA_VERSION = $${RS_EXTRA_VERSION}$${CHAR} + } + } else { + # Add to extra version + RS_EXTRA_VERSION = $${RS_EXTRA_VERSION}$${CHAR} + } + } message("RetroShare version\ $${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION}\