From d56cd26aeabe452e5b72f68a2b3a4fa876c3c7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 23 Dec 2025 11:57:14 +0100 Subject: [PATCH 1/7] release.sh: add comments --- contrib/fedora/rpm/release.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/contrib/fedora/rpm/release.sh b/contrib/fedora/rpm/release.sh index ce98e22e35..74ab4347cc 100755 --- a/contrib/fedora/rpm/release.sh +++ b/contrib/fedora/rpm/release.sh @@ -409,11 +409,8 @@ if [ $CHECK_GITLAB = 1 ]; then fi fi -PUSH_REFS=() -BUILD_VERSION= - +# Work on a temporary branch CLEANUP_CHECKOUT_BRANCH="$CUR_BRANCH" - git checkout -B "$TMP_BRANCH" CLEANUP_REFS+=("refs/heads/$TMP_BRANCH") @@ -463,6 +460,7 @@ build_version() { local TAR_FILE="NetworkManager-$BUILD_VERSION.tar.xz" local SUM_FILE="$TAR_FILE.sha256sum" + # Bump version and tag the release set_version_number "$BUILD_VERSION" git commit -m "release: bump version to $BUILD_VERSION_DESCR" -a || die "failed to commit release" git tag -s -a -m "Release $BUILD_VERSION_DESCR" "$BUILD_VERSION" HEAD || die "failed to tag release" @@ -470,35 +468,43 @@ build_version() { PUSH_REFS+=("$BUILD_VERSION") CLEANUP_REFS+=("refs/tags/$BUILD_VERSION") - git checkout "$BUILD_VERSION" || die "failed to checkout $BUILD_VERSION" + # Build to get the tarball for the release ./contrib/fedora/rpm/build_clean.sh -r || die "build release failed" cp "./build/meson-dist/$TAR_FILE" /tmp/ || die "failed to copy $TAR_FILE to /tmp" cp "./build/meson-dist/$SUM_FILE" /tmp/ || die "failed to copy $SUM_FILE to /tmp" git clean -fdx + # Store the release version for later use RELEASE_VERSIONS+=("$BUILD_VERSION") } +# Build and create tarball. Bump version as needed. +PUSH_REFS=() RELEASE_VERSIONS=() if [ -n "$BUILD_VERSION" ]; then build_version "$BUILD_VERSION" "${BUILD_VERSION_DESCR:-$BUILD_VERSION}" fi -git checkout -B "$CUR_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH" +# Work was done on the temporary branch, advance the real branch +git checkout -B "$CUR_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH" PUSH_REFS+=( "$CUR_BRANCH" ) if [ "$RELEASE_MODE" = rc1 ]; then - git branch "$RELEASE_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH" + # Create the release branch (nm-1-xx) + git branch "$RELEASE_BRANCH" "$TMP_BRANCH" || die "cannot checkout $RELEASE_BRANCH" PUSH_REFS+=( "$RELEASE_BRANCH" ) CLEANUP_REFS+=( "refs/heads/$RELEASE_BRANCH" ) + # Work on the temporary branch again git checkout "$TMP_BRANCH" + # Second release for rc1: create new dev version on main BUILD_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 2)).0" BUILD_VERSION_DESCR="$BUILD_VERSION (development)" BUILD_VERSION="${BUILD_VERSION}-dev" build_version "$BUILD_VERSION" "$BUILD_VERSION_DESCR" + # Work was done on the temporary branch, advance the real branch git checkout -B "$CUR_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH" fi @@ -514,8 +520,10 @@ if [ -z "$GITLAB_USER_ID" ] || [ "$GITLAB_USER_ID" = "null" ]; then die "failed to authenticate to gitlab.freedesktop.org with the private token" fi +# Push the modified branches and tags to the origin repository do_command git push "$ORIGIN" "${PUSH_REFS[@]}" || die "failed to to push branches ${PUSH_REFS[@]} to $ORIGIN" +# Create the releases CREATE_RELEASE_FAIL=0 for BUILD_VERSION in "${RELEASE_VERSIONS[@]}"; do TAR_FILE="NetworkManager-$BUILD_VERSION.tar.xz" From 3a3a8ea59d6cf5e3df0976c1d6591bf77e7230fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 23 Dec 2025 12:13:19 +0100 Subject: [PATCH 2/7] release.sh: assume that the version is already the right one Don't bump the version before tagging the release. Instead, assume that it's already correctly set. This is in preparation for the next commit where we will bump the version after the release, not before. But don't assume that in the case of rc1 and major releases. For rc1 we switch from devel releases to RC releases, and in major we switch from RC releases to stable releases. For example, when we are going to release 1.58-rc1, the current version will be 1.57.X-dev, so we need to bump to 1.58-rc1. When we're going to release 1.58.0, the current version will be 1.58-rcX, so we need to bump to 1.58.0. --- contrib/fedora/rpm/release.sh | 44 +++++++++++++++-------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/contrib/fedora/rpm/release.sh b/contrib/fedora/rpm/release.sh index 74ab4347cc..ad673dd918 100755 --- a/contrib/fedora/rpm/release.sh +++ b/contrib/fedora/rpm/release.sh @@ -415,21 +415,16 @@ git checkout -B "$TMP_BRANCH" CLEANUP_REFS+=("refs/heads/$TMP_BRANCH") case "$RELEASE_MODE" in - minor) - BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$(("${VERSION_ARR[2]}" + 1))" - ;; - devel) - BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$(("${VERSION_ARR[2]}" + 1))" - BUILD_VERSION_DESCR="$BUILD_VERSION (development)" - BUILD_VERSION="${BUILD_VERSION}-dev" + minor|devel|rc) + # Version is already correct in meson.build + BUILD_VERSION="$VERSION_STR" ;; rc1) + # Current version is wrong (dev version), need to set rc1 version BUILD_VERSION="${VERSION_ARR[0]}.$(("${VERSION_ARR[1]}" + 1))-rc1" ;; - rc) - BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}-rc$(( $RC_VERSION + 1 ))" - ;; major) + # Current version is wrong (rc version), need to set major version BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.0" ;; major-post) @@ -445,9 +440,8 @@ case "$RELEASE_MODE" in git commit --amend -m tmp -a || die "failed to commit major version bump" test x = "x$(git diff main HEAD)" || die "there is a diff after merge!" - BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$(("${VERSION_ARR[2]}" + 1))" - BUILD_VERSION_DESCR="$BUILD_VERSION (development)" - BUILD_VERSION="${BUILD_VERSION}-dev" + # Version is already correct in meson.build + BUILD_VERSION="$VERSION_STR" ;; *) die "Release mode $RELEASE_MODE not yet implemented" @@ -455,16 +449,20 @@ case "$RELEASE_MODE" in esac build_version() { + local CURR_VERSION="$(get_version)" local BUILD_VERSION="$1" - local BUILD_VERSION_DESCR="$2" + local BUILD_VERSION_DESCR="${BUILD_VERSION/-dev/ (development)}" local TAR_FILE="NetworkManager-$BUILD_VERSION.tar.xz" local SUM_FILE="$TAR_FILE.sha256sum" - # Bump version and tag the release - set_version_number "$BUILD_VERSION" - git commit -m "release: bump version to $BUILD_VERSION_DESCR" -a || die "failed to commit release" - git tag -s -a -m "Release $BUILD_VERSION_DESCR" "$BUILD_VERSION" HEAD || die "failed to tag release" + # The current version is usually already correct, except for rc1 and major. Bump version in those cases. + if [[ "$BUILD_VERSION" != "$CURR_VERSION" ]]; then + set_version_number "$BUILD_VERSION" + git commit -m "release: bump version to $BUILD_VERSION_DESCR" -a || die "failed to commit release" + fi + # Tag the release + git tag -s -a -m "Release $BUILD_VERSION_DESCR" "$BUILD_VERSION" HEAD || die "failed to tag release" PUSH_REFS+=("$BUILD_VERSION") CLEANUP_REFS+=("refs/tags/$BUILD_VERSION") @@ -481,9 +479,7 @@ build_version() { # Build and create tarball. Bump version as needed. PUSH_REFS=() RELEASE_VERSIONS=() -if [ -n "$BUILD_VERSION" ]; then - build_version "$BUILD_VERSION" "${BUILD_VERSION_DESCR:-$BUILD_VERSION}" -fi +build_version "$BUILD_VERSION" # Work was done on the temporary branch, advance the real branch git checkout -B "$CUR_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH" @@ -499,10 +495,8 @@ if [ "$RELEASE_MODE" = rc1 ]; then git checkout "$TMP_BRANCH" # Second release for rc1: create new dev version on main - BUILD_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 2)).0" - BUILD_VERSION_DESCR="$BUILD_VERSION (development)" - BUILD_VERSION="${BUILD_VERSION}-dev" - build_version "$BUILD_VERSION" "$BUILD_VERSION_DESCR" + BUILD_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 2)).0-dev" + build_version "$BUILD_VERSION" # Work was done on the temporary branch, advance the real branch git checkout -B "$CUR_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH" From 5666407f156fcd7b328dff6838038ee6993e9f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 23 Dec 2025 12:49:11 +0100 Subject: [PATCH 3/7] release.sh: bump version after release After tagging a release, create a commit bumping to the next version. This effectively ends the change in the logic initiated in the previous commit, from "bump version, then release" to "release, then bump version". The purpose of this is to have the right version set in nm_version.h and nm_version_macros.h between two releases. Without this change, when we introduced a new symbol, thus using the NM_AVAILABLE_IN_1_XX annotations, we got compilation warnings until we did the next release (making the CI to be red when configured the compilation to fail on warnings). --- contrib/fedora/rpm/release.sh | 45 +++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/contrib/fedora/rpm/release.sh b/contrib/fedora/rpm/release.sh index ad673dd918..2c21b4d98d 100755 --- a/contrib/fedora/rpm/release.sh +++ b/contrib/fedora/rpm/release.sh @@ -415,17 +415,30 @@ git checkout -B "$TMP_BRANCH" CLEANUP_REFS+=("refs/heads/$TMP_BRANCH") case "$RELEASE_MODE" in - minor|devel|rc) + minor) # Version is already correct in meson.build BUILD_VERSION="$VERSION_STR" + NEXT_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$((${VERSION_ARR[2]} + 1))" + ;; + devel) + # Version is already correct in meson.build + BUILD_VERSION="$VERSION_STR" + NEXT_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$((${VERSION_ARR[2]} + 1))-dev" + ;; + rc) + # Version is already correct in meson.build + BUILD_VERSION="$VERSION_STR" + NEXT_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}-rc$((RC_VERSION + 1))" ;; rc1) # Current version is wrong (dev version), need to set rc1 version - BUILD_VERSION="${VERSION_ARR[0]}.$(("${VERSION_ARR[1]}" + 1))-rc1" + BUILD_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 1))-rc1" + NEXT_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 1))-rc2" ;; major) # Current version is wrong (rc version), need to set major version BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.0" + NEXT_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.1" ;; major-post) # We create a merge commit with the content of current "main", with two @@ -442,6 +455,7 @@ case "$RELEASE_MODE" in # Version is already correct in meson.build BUILD_VERSION="$VERSION_STR" + NEXT_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$((${VERSION_ARR[2]} + 1))-dev" ;; *) die "Release mode $RELEASE_MODE not yet implemented" @@ -451,7 +465,9 @@ esac build_version() { local CURR_VERSION="$(get_version)" local BUILD_VERSION="$1" + local NEXT_VERSION="$2" local BUILD_VERSION_DESCR="${BUILD_VERSION/-dev/ (development)}" + local NEXT_VERSION_DESCR="${NEXT_VERSION/-dev/ (development)}" local TAR_FILE="NetworkManager-$BUILD_VERSION.tar.xz" local SUM_FILE="$TAR_FILE.sha256sum" @@ -474,16 +490,17 @@ build_version() { # Store the release version for later use RELEASE_VERSIONS+=("$BUILD_VERSION") + + # Bump to next version, so that build between now and the next release has the next version already. + # Otherwise the macros in nm_version.h don't work correctly. + set_version_number "$NEXT_VERSION" + git commit -m "release: bump version to $NEXT_VERSION_DESCR" -a || die "failed to commit version bump" } # Build and create tarball. Bump version as needed. PUSH_REFS=() RELEASE_VERSIONS=() -build_version "$BUILD_VERSION" - -# Work was done on the temporary branch, advance the real branch -git checkout -B "$CUR_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH" -PUSH_REFS+=( "$CUR_BRANCH" ) +build_version "$BUILD_VERSION" "$NEXT_VERSION" if [ "$RELEASE_MODE" = rc1 ]; then # Create the release branch (nm-1-xx) @@ -491,17 +508,19 @@ if [ "$RELEASE_MODE" = rc1 ]; then PUSH_REFS+=( "$RELEASE_BRANCH" ) CLEANUP_REFS+=( "refs/heads/$RELEASE_BRANCH" ) - # Work on the temporary branch again - git checkout "$TMP_BRANCH" + # Go back to the commit of the rc1 release, nm-1-xx is one commit further now. + git checkout -B "$TMP_BRANCH" "$BUILD_VERSION" || die "cannot checkout $TMP_BRANCH" # Second release for rc1: create new dev version on main BUILD_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 2)).0-dev" - build_version "$BUILD_VERSION" - - # Work was done on the temporary branch, advance the real branch - git checkout -B "$CUR_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH" + NEXT_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 2)).1-dev" + build_version "$BUILD_VERSION" "$NEXT_VERSION" fi +# Work was done on the temporary branch, advance the real branch +git checkout -B "$CUR_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH" +PUSH_REFS+=( "$CUR_BRANCH" ) + if [[ $GITLAB_TOKEN == "" ]]; then [[ -r ~/.config/nm-release-token ]] || die "cannot read ~/.config/nm-release-token" GITLAB_TOKEN=$(< ~/.config/nm-release-token) From 9a3462af99dfaefdfcee63426ed142fda290c462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Wed, 24 Dec 2025 10:32:16 +0100 Subject: [PATCH 4/7] release.sh: fix a few small bugs and typos Fix typo freedestkop -> freedesktop. Removed unused argument of check_news (additionally, it was incorrectly using @ instead of $). Fixed incorrect use of `$? = 0` that was always successful. --- contrib/fedora/rpm/release.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/contrib/fedora/rpm/release.sh b/contrib/fedora/rpm/release.sh index 2c21b4d98d..6caf1100cb 100755 --- a/contrib/fedora/rpm/release.sh +++ b/contrib/fedora/rpm/release.sh @@ -27,7 +27,7 @@ # * Run in a "clean" environment, i.e. no unusual environment variables set, on a recent # Fedora, with suitable dependencies installed. # -# * First, ensure that you have a valid Gitlab's private token for gitlab.freedestkop.org +# * First, ensure that you have a valid Gitlab's private token for gitlab.freedesktop.org # stored in ~/.config/nm-release-token, or pass one with --gitlab-token argument. # Also, ensure you have a GPG key that you want to use for signing. Also, have gpg-agent running # and possibly configure `git config --get user.signingkey` for the proper key. @@ -155,8 +155,6 @@ set_version_number() { check_news() { local mode="$1" - shift - local ver_arr=("$@") case "$mode" in major|minor) @@ -361,7 +359,7 @@ if [ "$ALLOW_LOCAL_BRANCHES" != 1 ]; then cmp <(git show "$ORIGIN/main:contrib/fedora/rpm/release.sh") "$BASH_SOURCE_ABSOLUTE" || die "$BASH_SOURCE is not identical to \`git show \"$ORIGIN/main:contrib/fedora/rpm/release.sh\"\`" fi -if ! check_news "$RELEASE_MODE" "@{VERSION_ARR[@]}" ; then +if ! check_news "$RELEASE_MODE"; then if [ "$CHECK_NEWS" == 1 ]; then die "NEWS file needs update to mention stable release (skip check with --no-check-news)" fi @@ -592,7 +590,7 @@ for BUILD_VERSION in "${RELEASE_VERSIONS[@]}"; do END )" || FAIL=1 - if [[ $? != 0 ]]; then + if [[ $FAIL = 1 ]]; then fail_msg "failed to create NetworkManager $BUILD_VERSION release" CREATE_RELEASE_FAIL=1 continue From c0fe80ff87373bfb76de26613a0f69a15c43214d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 23 Dec 2025 15:55:16 +0100 Subject: [PATCH 5/7] release: (manually) bump version to 1.57.2-dev After the previous commits, release.sh bumps the version after tagging the release, and not before. Therefore, it expects that the version is already the next one when doing the release. Manually bump the version this time so release.sh sees the right value the next time it's executed after these changes. --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 913d7431be..39fb1aed9a 100644 --- a/meson.build +++ b/meson.build @@ -5,7 +5,7 @@ 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-dev', + version: '1.57.2-dev', license: 'GPL2+', default_options: [ 'buildtype=debugoptimized', From 36275bc51caae466af1952666df2b5d37a2db718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 23 Dec 2025 16:05:03 +0100 Subject: [PATCH 6/7] nm-version.h: use the right value of NM_API_VERSION After the changes in release.sh in previous commits, during development the value of NM_VERSION will always be the next version, not the latest released one. As a consequence, we don't need to set MICRO+1 in NM_API_VERSION, which was a temporary workaround. --- src/libnm-core-public/nm-version-macros.h.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libnm-core-public/nm-version-macros.h.in b/src/libnm-core-public/nm-version-macros.h.in index e4050e692a..c1e0ba540c 100644 --- a/src/libnm-core-public/nm-version-macros.h.in +++ b/src/libnm-core-public/nm-version-macros.h.in @@ -83,15 +83,15 @@ /* For releases, NM_API_VERSION is equal to NM_VERSION. * - * For development builds, NM_API_VERSION is the next - * stable API after NM_VERSION. When you run a development + * For development and RC builds, NM_API_VERSION is the next + * stable API after NM_VERSION. When you run a devel or RC * version, you are already using the future API, even if * it is not yet released. Hence, the currently used API * version is the future one. */ #define NM_API_VERSION \ (((NM_MINOR_VERSION % 2) == 1) \ ? NM_ENCODE_VERSION(NM_MAJOR_VERSION, NM_MINOR_VERSION + 1, 0) \ - : NM_ENCODE_VERSION(NM_MAJOR_VERSION, NM_MINOR_VERSION, NM_MICRO_VERSION + 1)) + : NM_VERSION) /* deprecated. */ #define NM_VERSION_CUR_STABLE NM_API_VERSION From f849163e827290329564377e009e763cb134beaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 23 Dec 2025 16:09:39 +0100 Subject: [PATCH 7/7] nm-version: allow to define NM_VERSION_MAX_ALLOWED alone Previously, if NM_VERSION_MIN_REQUIRED was not defined, it defaulted to NM_VERSION. As a consequence, if NM_VERSION_MAX_ALLOWED was defined we got a compilation error because MAX_ALLOWED < MIN_REQUIRED. MAX_ALLOWED is used to get compilation warnings if you unintentionally use a libnm's symbol introduced in a newer version. MIN_REQUIRED is used to get rid of warnings about symbol deprecations. Libnm users may want to use MAX_ALLOWED alone, because using a too new symbol would fail to compile with older libnm. But they might want to get deprecation warnings as soon as possible, so they want to leave MIN_REQUIRED empty. --- src/libnm-core-public/nm-version.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libnm-core-public/nm-version.h b/src/libnm-core-public/nm-version.h index bc3d70749f..f99851194b 100644 --- a/src/libnm-core-public/nm-version.h +++ b/src/libnm-core-public/nm-version.h @@ -12,16 +12,16 @@ /* Deprecation / Availability macros */ -#if !defined(NM_VERSION_MIN_REQUIRED) || (NM_VERSION_MIN_REQUIRED == 0) -#undef NM_VERSION_MIN_REQUIRED -#define NM_VERSION_MIN_REQUIRED (NM_API_VERSION) -#endif - #if !defined(NM_VERSION_MAX_ALLOWED) || (NM_VERSION_MAX_ALLOWED == 0) #undef NM_VERSION_MAX_ALLOWED #define NM_VERSION_MAX_ALLOWED (NM_API_VERSION) #endif +#if !defined(NM_VERSION_MIN_REQUIRED) || (NM_VERSION_MIN_REQUIRED == 0) +#undef NM_VERSION_MIN_REQUIRED +#define NM_VERSION_MIN_REQUIRED (NM_VERSION_MAX_ALLOWED) +#endif + /* sanity checks */ #if NM_VERSION_MIN_REQUIRED > NM_API_VERSION #error "NM_VERSION_MIN_REQUIRED must be <= NM_API_VERSION"