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] 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)