From c33838a60097af9eb3e5b994f1b765cebea8df60 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Wed, 9 Oct 2024 15:36:15 +0200 Subject: [PATCH] [nrf toup] Include EXTRAVERSION in Matter software version string When a Matter application provides the VERSION file, the Matter software version string is set to 4-number string, such as "2.7.99+0" and the EXTRAVERSION field, which is typically used to denote the branch or tag name, such as "dev" or "rc1", is ignored. If the EXTRAVERSION field is non-empty, set the Matter software version string to a string such as "2.7.99-dev+0". --- config/zephyr/ota-image.cmake | 2 +- config/zephyr/ota-image_sysbuild.cmake | 8 +++++++- src/platform/nrfconnect/CHIPDevicePlatformConfig.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/zephyr/ota-image.cmake b/config/zephyr/ota-image.cmake index f254b97ea5..0d0108aa75 100644 --- a/config/zephyr/ota-image.cmake +++ b/config/zephyr/ota-image.cmake @@ -40,7 +40,7 @@ function(chip_ota_image TARGET_NAME) "--version" ${APPVERSION} "--version-str" - ${APP_VERSION_TWEAK_STRING} + ${APP_VERSION_EXTENDED_STRING} "--digest-algorithm" "sha256" ) diff --git a/config/zephyr/ota-image_sysbuild.cmake b/config/zephyr/ota-image_sysbuild.cmake index 2bd78ea6ee..88968ba15e 100644 --- a/config/zephyr/ota-image_sysbuild.cmake +++ b/config/zephyr/ota-image_sysbuild.cmake @@ -45,8 +45,14 @@ function(chip_ota_image TARGET_NAME) set(app_version_patchlevel ${CMAKE_MATCH_1}) string(REGEX MATCH "VERSION_TWEAK = ([0-9]*)" _ ${ver}) set(app_version_tweak ${CMAKE_MATCH_1}) + string(REGEX MATCH "EXTRAVERSION = ([a-z0-9]*)" _ ${ver}) + set(app_version_extra ${CMAKE_MATCH_1}) - set(APP_VERSION_STRING "${app_version_major}.${app_version_minor}.${app_version_patchlevel}+${app_version_tweak}") + if(app_version_extra) + set(APP_VERSION_STRING "${app_version_major}.${app_version_minor}.${app_version_patchlevel}-${app_version_extra}+${app_version_tweak}") + else() + set(APP_VERSION_STRING "${app_version_major}.${app_version_minor}.${app_version_patchlevel}+${app_version_tweak}") + endif() math(EXPR APPVERSION "(${app_version_major} << 24) | (${app_version_minor} << 16) | (${app_version_patchlevel} << 8) | ${app_version_tweak}" OUTPUT_FORMAT HEXADECIMAL) set(OTA_ARGS diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index b43e64131d..c306f4c6a0 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -46,7 +46,7 @@ #ifdef CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING #define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING #else -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING APP_VERSION_TWEAK_STRING +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING APP_VERSION_EXTENDED_STRING #endif #define CHIP_DEVICE_CONFIG_TEST_MANUFACTURING_DATE CONFIG_CHIP_DEVICE_MANUFACTURING_DATE