mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 17:08:08 +02:00
merge: branch 'ih/fix-api-version'
Bump version just after release, fix NM_API_VERSION on stable branches https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2337
This commit is contained in:
commit
871da67916
4 changed files with 67 additions and 48 deletions
|
|
@ -27,7 +27,7 @@
|
||||||
# * Run in a "clean" environment, i.e. no unusual environment variables set, on a recent
|
# * Run in a "clean" environment, i.e. no unusual environment variables set, on a recent
|
||||||
# Fedora, with suitable dependencies installed.
|
# 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.
|
# 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
|
# 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.
|
# and possibly configure `git config --get user.signingkey` for the proper key.
|
||||||
|
|
@ -155,8 +155,6 @@ set_version_number() {
|
||||||
|
|
||||||
check_news() {
|
check_news() {
|
||||||
local mode="$1"
|
local mode="$1"
|
||||||
shift
|
|
||||||
local ver_arr=("$@")
|
|
||||||
|
|
||||||
case "$mode" in
|
case "$mode" in
|
||||||
major|minor)
|
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\"\`"
|
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
|
fi
|
||||||
|
|
||||||
if ! check_news "$RELEASE_MODE" "@{VERSION_ARR[@]}" ; then
|
if ! check_news "$RELEASE_MODE"; then
|
||||||
if [ "$CHECK_NEWS" == 1 ]; then
|
if [ "$CHECK_NEWS" == 1 ]; then
|
||||||
die "NEWS file needs update to mention stable release (skip check with --no-check-news)"
|
die "NEWS file needs update to mention stable release (skip check with --no-check-news)"
|
||||||
fi
|
fi
|
||||||
|
|
@ -409,31 +407,36 @@ if [ $CHECK_GITLAB = 1 ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PUSH_REFS=()
|
# Work on a temporary branch
|
||||||
BUILD_VERSION=
|
|
||||||
|
|
||||||
CLEANUP_CHECKOUT_BRANCH="$CUR_BRANCH"
|
CLEANUP_CHECKOUT_BRANCH="$CUR_BRANCH"
|
||||||
|
|
||||||
git checkout -B "$TMP_BRANCH"
|
git checkout -B "$TMP_BRANCH"
|
||||||
CLEANUP_REFS+=("refs/heads/$TMP_BRANCH")
|
CLEANUP_REFS+=("refs/heads/$TMP_BRANCH")
|
||||||
|
|
||||||
case "$RELEASE_MODE" in
|
case "$RELEASE_MODE" in
|
||||||
minor)
|
minor)
|
||||||
BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$(("${VERSION_ARR[2]}" + 1))"
|
# Version is already correct in meson.build
|
||||||
|
BUILD_VERSION="$VERSION_STR"
|
||||||
|
NEXT_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$((${VERSION_ARR[2]} + 1))"
|
||||||
;;
|
;;
|
||||||
devel)
|
devel)
|
||||||
BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$(("${VERSION_ARR[2]}" + 1))"
|
# Version is already correct in meson.build
|
||||||
BUILD_VERSION_DESCR="$BUILD_VERSION (development)"
|
BUILD_VERSION="$VERSION_STR"
|
||||||
BUILD_VERSION="${BUILD_VERSION}-dev"
|
NEXT_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$((${VERSION_ARR[2]} + 1))-dev"
|
||||||
;;
|
|
||||||
rc1)
|
|
||||||
BUILD_VERSION="${VERSION_ARR[0]}.$(("${VERSION_ARR[1]}" + 1))-rc1"
|
|
||||||
;;
|
;;
|
||||||
rc)
|
rc)
|
||||||
BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}-rc$(( $RC_VERSION + 1 ))"
|
# 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"
|
||||||
|
NEXT_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 1))-rc2"
|
||||||
;;
|
;;
|
||||||
major)
|
major)
|
||||||
|
# Current version is wrong (rc version), need to set major version
|
||||||
BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.0"
|
BUILD_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.0"
|
||||||
|
NEXT_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.1"
|
||||||
;;
|
;;
|
||||||
major-post)
|
major-post)
|
||||||
# We create a merge commit with the content of current "main", with two
|
# We create a merge commit with the content of current "main", with two
|
||||||
|
|
@ -448,9 +451,9 @@ case "$RELEASE_MODE" in
|
||||||
git commit --amend -m tmp -a || die "failed to commit major version bump"
|
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!"
|
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))"
|
# Version is already correct in meson.build
|
||||||
BUILD_VERSION_DESCR="$BUILD_VERSION (development)"
|
BUILD_VERSION="$VERSION_STR"
|
||||||
BUILD_VERSION="${BUILD_VERSION}-dev"
|
NEXT_VERSION="${VERSION_ARR[0]}.${VERSION_ARR[1]}.$((${VERSION_ARR[2]} + 1))-dev"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
die "Release mode $RELEASE_MODE not yet implemented"
|
die "Release mode $RELEASE_MODE not yet implemented"
|
||||||
|
|
@ -458,50 +461,64 @@ case "$RELEASE_MODE" in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
build_version() {
|
build_version() {
|
||||||
|
local CURR_VERSION="$(get_version)"
|
||||||
local BUILD_VERSION="$1"
|
local BUILD_VERSION="$1"
|
||||||
local BUILD_VERSION_DESCR="$2"
|
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 TAR_FILE="NetworkManager-$BUILD_VERSION.tar.xz"
|
||||||
local SUM_FILE="$TAR_FILE.sha256sum"
|
local SUM_FILE="$TAR_FILE.sha256sum"
|
||||||
|
|
||||||
set_version_number "$BUILD_VERSION"
|
# The current version is usually already correct, except for rc1 and major. Bump version in those cases.
|
||||||
git commit -m "release: bump version to $BUILD_VERSION_DESCR" -a || die "failed to commit release"
|
if [[ "$BUILD_VERSION" != "$CURR_VERSION" ]]; then
|
||||||
git tag -s -a -m "Release $BUILD_VERSION_DESCR" "$BUILD_VERSION" HEAD || die "failed to tag release"
|
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")
|
PUSH_REFS+=("$BUILD_VERSION")
|
||||||
CLEANUP_REFS+=("refs/tags/$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"
|
./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/$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"
|
cp "./build/meson-dist/$SUM_FILE" /tmp/ || die "failed to copy $SUM_FILE to /tmp"
|
||||||
git clean -fdx
|
git clean -fdx
|
||||||
|
|
||||||
|
# Store the release version for later use
|
||||||
RELEASE_VERSIONS+=("$BUILD_VERSION")
|
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=()
|
RELEASE_VERSIONS=()
|
||||||
if [ -n "$BUILD_VERSION" ]; then
|
build_version "$BUILD_VERSION" "$NEXT_VERSION"
|
||||||
build_version "$BUILD_VERSION" "${BUILD_VERSION_DESCR:-$BUILD_VERSION}"
|
|
||||||
fi
|
|
||||||
git checkout -B "$CUR_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH"
|
|
||||||
|
|
||||||
PUSH_REFS+=( "$CUR_BRANCH" )
|
|
||||||
|
|
||||||
if [ "$RELEASE_MODE" = rc1 ]; then
|
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" )
|
PUSH_REFS+=( "$RELEASE_BRANCH" )
|
||||||
CLEANUP_REFS+=( "refs/heads/$RELEASE_BRANCH" )
|
CLEANUP_REFS+=( "refs/heads/$RELEASE_BRANCH" )
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
BUILD_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 2)).0"
|
# Second release for rc1: create new dev version on main
|
||||||
BUILD_VERSION_DESCR="$BUILD_VERSION (development)"
|
BUILD_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 2)).0-dev"
|
||||||
BUILD_VERSION="${BUILD_VERSION}-dev"
|
NEXT_VERSION="${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 2)).1-dev"
|
||||||
build_version "$BUILD_VERSION" "$BUILD_VERSION_DESCR"
|
build_version "$BUILD_VERSION" "$NEXT_VERSION"
|
||||||
|
|
||||||
git checkout -B "$CUR_BRANCH" "$TMP_BRANCH" || die "cannot checkout $CUR_BRANCH"
|
|
||||||
fi
|
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
|
if [[ $GITLAB_TOKEN == "" ]]; then
|
||||||
[[ -r ~/.config/nm-release-token ]] || die "cannot read ~/.config/nm-release-token"
|
[[ -r ~/.config/nm-release-token ]] || die "cannot read ~/.config/nm-release-token"
|
||||||
GITLAB_TOKEN=$(< ~/.config/nm-release-token)
|
GITLAB_TOKEN=$(< ~/.config/nm-release-token)
|
||||||
|
|
@ -514,8 +531,10 @@ if [ -z "$GITLAB_USER_ID" ] || [ "$GITLAB_USER_ID" = "null" ]; then
|
||||||
die "failed to authenticate to gitlab.freedesktop.org with the private token"
|
die "failed to authenticate to gitlab.freedesktop.org with the private token"
|
||||||
fi
|
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"
|
do_command git push "$ORIGIN" "${PUSH_REFS[@]}" || die "failed to to push branches ${PUSH_REFS[@]} to $ORIGIN"
|
||||||
|
|
||||||
|
# Create the releases
|
||||||
CREATE_RELEASE_FAIL=0
|
CREATE_RELEASE_FAIL=0
|
||||||
for BUILD_VERSION in "${RELEASE_VERSIONS[@]}"; do
|
for BUILD_VERSION in "${RELEASE_VERSIONS[@]}"; do
|
||||||
TAR_FILE="NetworkManager-$BUILD_VERSION.tar.xz"
|
TAR_FILE="NetworkManager-$BUILD_VERSION.tar.xz"
|
||||||
|
|
@ -571,7 +590,7 @@ for BUILD_VERSION in "${RELEASE_VERSIONS[@]}"; do
|
||||||
END
|
END
|
||||||
)" || FAIL=1
|
)" || FAIL=1
|
||||||
|
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $FAIL = 1 ]]; then
|
||||||
fail_msg "failed to create NetworkManager $BUILD_VERSION release"
|
fail_msg "failed to create NetworkManager $BUILD_VERSION release"
|
||||||
CREATE_RELEASE_FAIL=1
|
CREATE_RELEASE_FAIL=1
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ project(
|
||||||
# NOTE: When incrementing version also add corresponding
|
# NOTE: When incrementing version also add corresponding
|
||||||
# NM_VERSION_x_y_z macros in
|
# NM_VERSION_x_y_z macros in
|
||||||
# "src/libnm-core-public/nm-version-macros.h.in"
|
# "src/libnm-core-public/nm-version-macros.h.in"
|
||||||
version: '1.57.1-dev',
|
version: '1.57.2-dev',
|
||||||
license: 'GPL2+',
|
license: 'GPL2+',
|
||||||
default_options: [
|
default_options: [
|
||||||
'buildtype=debugoptimized',
|
'buildtype=debugoptimized',
|
||||||
|
|
|
||||||
|
|
@ -83,15 +83,15 @@
|
||||||
|
|
||||||
/* For releases, NM_API_VERSION is equal to NM_VERSION.
|
/* For releases, NM_API_VERSION is equal to NM_VERSION.
|
||||||
*
|
*
|
||||||
* For development builds, NM_API_VERSION is the next
|
* For development and RC builds, NM_API_VERSION is the next
|
||||||
* stable API after NM_VERSION. When you run a development
|
* stable API after NM_VERSION. When you run a devel or RC
|
||||||
* version, you are already using the future API, even if
|
* version, you are already using the future API, even if
|
||||||
* it is not yet released. Hence, the currently used API
|
* it is not yet released. Hence, the currently used API
|
||||||
* version is the future one. */
|
* version is the future one. */
|
||||||
#define NM_API_VERSION \
|
#define NM_API_VERSION \
|
||||||
(((NM_MINOR_VERSION % 2) == 1) \
|
(((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 + 1, 0) \
|
||||||
: NM_ENCODE_VERSION(NM_MAJOR_VERSION, NM_MINOR_VERSION, NM_MICRO_VERSION + 1))
|
: NM_VERSION)
|
||||||
|
|
||||||
/* deprecated. */
|
/* deprecated. */
|
||||||
#define NM_VERSION_CUR_STABLE NM_API_VERSION
|
#define NM_VERSION_CUR_STABLE NM_API_VERSION
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,16 @@
|
||||||
|
|
||||||
/* Deprecation / Availability macros */
|
/* 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)
|
#if !defined(NM_VERSION_MAX_ALLOWED) || (NM_VERSION_MAX_ALLOWED == 0)
|
||||||
#undef NM_VERSION_MAX_ALLOWED
|
#undef NM_VERSION_MAX_ALLOWED
|
||||||
#define NM_VERSION_MAX_ALLOWED (NM_API_VERSION)
|
#define NM_VERSION_MAX_ALLOWED (NM_API_VERSION)
|
||||||
#endif
|
#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 */
|
/* sanity checks */
|
||||||
#if NM_VERSION_MIN_REQUIRED > NM_API_VERSION
|
#if NM_VERSION_MIN_REQUIRED > NM_API_VERSION
|
||||||
#error "NM_VERSION_MIN_REQUIRED must be <= NM_API_VERSION"
|
#error "NM_VERSION_MIN_REQUIRED must be <= NM_API_VERSION"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue