From e422b1c3d92052d87358649321732ea80a3a34e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Thu, 18 Dec 2025 10:49:33 +0100 Subject: [PATCH] meson: specify project version with the -dev and -rc suffixes This will create the tarball with names NetworkManager-1.56-rc2.tar.xz or NetworkManager-1.57.1-dev.tar.xz. This way they will match with the name of the Git tag, making easier for users, and specially for tools like Packit, to understand the versioning scheme. The goal is to make that there is only one public versioning scheme, the one with -rc and -dev suffixes. Version numbers with micro>=90 for RC releases is kept only as an internal thing for the C headers. Users of the API can still use it. Bump meson version to 0.56 to use str.substring(). --- meson.build | 39 +++++++++++++++++++++++++++------ src/tests/client/test-client.py | 14 ++++++++++-- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index 0ff7acbcdc..6aafd8b138 100644 --- a/meson.build +++ b/meson.build @@ -5,23 +5,48 @@ project( # NOTE: When incrementing version also add corresponding # NM_VERSION_x_y_z macros in # "src/libnm-core-public/nm-version-macros.h.in" - version: '1.57.1', + version: '1.57.1-dev', license: 'GPL2+', default_options: [ 'buildtype=debugoptimized', 'c_std=gnu11', 'warning_level=2' # value "2" will add "-Wall" and "-Wextra" to the compiler flags ], - meson_version: '>= 0.53.0', + meson_version: '>= 0.56.0', ) nm_name = meson.project_name() - nm_version = meson.project_version() -version_array = nm_version.split('.') -nm_major_version = version_array[0].to_int() -nm_minor_version = version_array[1].to_int() -nm_micro_version = version_array[2].to_int() + +version_and_suffix = nm_version.split('-') +version_array = version_and_suffix[0].split('.') +if version_and_suffix.length() == 2 + version_suffix = version_and_suffix[1] +else + assert(version_and_suffix.length() == 1) + version_suffix = '' +endif + +# In the C API we encode the version in 90+ scheme (1.56-rc1 = 1.55.90, rc2 = .91, etc) +if version_suffix == '' or version_suffix == 'dev' + assert(version_array.length() == 3) + nm_major_version = version_array[0].to_int() + nm_minor_version = version_array[1].to_int() + nm_micro_version = version_array[2].to_int() +elif version_suffix.startswith('rc') + assert(version_array.length() == 2) + nm_major_version = version_array[0].to_int() + nm_minor_version = version_array[1].to_int() - 1 + nm_micro_version = version_suffix.substring(2).to_int() + 89 +else + error('Invalid suffix: ' + version_suffix) +endif + +if nm_minor_version % 2 == 1 and version_suffix == '' + error('Expected a "-dev" or "-rc" suffix') +elif nm_minor_version %2 == 0 and version_suffix != '' + error('Unexpected "' + version_suffix + '" suffix') +endif nm_id_prefix = 'NM' diff --git a/src/tests/client/test-client.py b/src/tests/client/test-client.py index 6220587a9b..6cf1924c2c 100755 --- a/src/tests/client/test-client.py +++ b/src/tests/client/test-client.py @@ -688,7 +688,17 @@ class Util: micro = ver & 0xFF minor = (ver >> 8) & 0xFF major = ver >> 16 - return "%s.%s.%s" % (major, minor, micro) + + # Convert 1.57.1 -> 1.57.1-dev and 1.55.90 -> 1.56-rc1 + if micro >= 90: + minor += 1 + micro = "-rc" + str(micro - 89) + elif minor % 2 == 1: + micro = f".{micro}-dev" + else: + micro = f".{micro}" + + return "%s.%s%s" % (major, minor, micro) ############################################################################### @@ -3264,7 +3274,7 @@ def main(): sys.executable, __file__, "--started-with-dbus-session", - *sys.argv[1:] + *sys.argv[1:], ) except OSError as e: if e.errno != errno.ENOENT: