From c22097f67237f77b2ee473f3b31a3b940b7d651a Mon Sep 17 00:00:00 2001 From: xyzroe Date: Tue, 28 May 2024 00:46:35 +0200 Subject: [PATCH] 20240528 - Try to fix #24 and https://t.me/XZG_FW/17/804 - Fix wrong version apply cause of time difference - Add version file update if tag need suffix --- tools/build/version_update.py | 11 +++++------ tools/commit.sh | 6 +++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/build/version_update.py b/tools/build/version_update.py index e43a432..dc38091 100644 --- a/tools/build/version_update.py +++ b/tools/build/version_update.py @@ -45,14 +45,13 @@ def write_version_to_file(file_path, version): if not os.path.exists(PROJECT_DIR + os.sep + "include"): os.mkdir(PROJECT_DIR + os.sep + "include") VERSION_HEADER = "include" + os.sep + VERSION_HEADER - + current_version = read_version_from_file(VERSION_HEADER) -if current_version: - if current_version.startswith(current_date): - new_version = current_version - else: - new_version = current_date +if current_version is None: + new_version = current_date +elif current_version.startswith(current_date) or current_version > current_date: + new_version = current_version else: new_version = current_date diff --git a/tools/commit.sh b/tools/commit.sh index ba340a6..1c08057 100755 --- a/tools/commit.sh +++ b/tools/commit.sh @@ -51,7 +51,11 @@ while git rev-parse "$tag" >/dev/null 2>&1; do tag="${base}.${suffix}" done -echo $tag +sed -i.bak "s/#define VERSION \"${version}\"/#define VERSION \"${tag}\"/" "$VERSION_HEADER" + +rm "${VERSION_HEADER}.bak" + +echo "Updated version to $tag in $VERSION_HEADER" # Checking for commit message file if [ -f "$COMMIT_MESSAGE_FILE" ]; then