Skip to content

Commit

Permalink
Merge PR #5401: Backport "BUILD: Remove concept of an RELEASE_ID"
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzmbrzl authored Jan 2, 2022
2 parents 38fec41 + d4757d7 commit 8505df9
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 94 deletions.
6 changes: 2 additions & 4 deletions .ci/azure-pipelines/build_linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@
#

if [[ -n "$MUMBLE_BUILD_NUMBER_TOKEN" ]]; then
VERSION=$(python "scripts/mumble-version.py" --format version)
VERSION=$(python "scripts/mumble-version.py")
BUILD_NUMBER=$(curl "https://mumble.info/get-build-number?commit=${BUILD_SOURCEVERSION}&version=${VERSION}&token=${MUMBLE_BUILD_NUMBER_TOKEN}")
else
BUILD_NUMBER=0
fi

RELEASE_ID=$(python "scripts/mumble-version.py")

cd $BUILD_BINARIESDIRECTORY

cmake -G Ninja -DCMAKE_INSTALL_PREFIX=appdir/usr -DCMAKE_UNITY_BUILD=ON \
-DCMAKE_BUILD_TYPE=Release -DRELEASE_ID=$RELEASE_ID -DBUILD_NUMBER=$BUILD_NUMBER \
-DCMAKE_BUILD_TYPE=Release -DBUILD_NUMBER=$BUILD_NUMBER \
-Dtests=ON -Dsymbols=ON -Dgrpc=ON \
-Ddisplay-install-paths=ON $BUILD_SOURCESDIRECTORY

Expand Down
6 changes: 2 additions & 4 deletions .ci/azure-pipelines/build_macos.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,16 @@
#

if [[ -n "$MUMBLE_BUILD_NUMBER_TOKEN" ]]; then
VERSION=$(python "scripts/mumble-version.py" --format version)
VERSION=$(python "scripts/mumble-version.py")
BUILD_NUMBER=$(curl "https://mumble.info/get-build-number?commit=${BUILD_SOURCEVERSION}&version=${VERSION}&token=${MUMBLE_BUILD_NUMBER_TOKEN}")
else
BUILD_NUMBER=0
fi

RELEASE_ID=$(python "scripts/mumble-version.py")

cd $BUILD_BINARIESDIRECTORY

cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=$MUMBLE_ENVIRONMENT_TOOLCHAIN -DIce_HOME="$MUMBLE_ENVIRONMENT_PATH/installed/x64-osx" \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_UNITY_BUILD=ON -DRELEASE_ID=$RELEASE_ID -DBUILD_NUMBER=$BUILD_NUMBER \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_UNITY_BUILD=ON -DBUILD_NUMBER=$BUILD_NUMBER \
-Dtests=ON -Dstatic=ON -Dsymbols=ON -Dgrpc=ON \
-Ddisplay-install-paths=ON $BUILD_SOURCESDIRECTORY

Expand Down
4 changes: 2 additions & 2 deletions .ci/azure-pipelines/release_macos.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# repository is downloaded.
#

RELEASE_ID=$(python "scripts/mumble-version.py")
VERSION=$(python "scripts/mumble-version.py")

cd $BUILD_BINARIESDIRECTORY

$BUILD_SOURCESDIRECTORY/macx/scripts/osxdist.py --version=$RELEASE_ID --source-dir=$BUILD_SOURCESDIRECTORY --binary-dir=.
$BUILD_SOURCESDIRECTORY/macx/scripts/osxdist.py --version=$VERSION --source-dir=$BUILD_SOURCESDIRECTORY --binary-dir=.

mv *.dmg $BUILD_ARTIFACTSTAGINGDIRECTORY
6 changes: 2 additions & 4 deletions .ci/build_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

:: The method we use to store a command's output into a variable:
:: https://stackoverflow.com/a/6362922
for /f "tokens=* USEBACKQ" %%g in (`python "scripts\mumble-version.py" --format version`) do (set "VERSION=%%g")
for /f "tokens=* USEBACKQ" %%g in (`python "scripts\mumble-version.py"`) do (set "VERSION=%%g")

:: For some really stupid reason we can't have this statement and the one where we set the VERSION variable in the same if body as
:: in that case the variable substitution of that variable in the expression below fails (is replaced with empty string)
Expand All @@ -36,8 +36,6 @@ if defined MUMBLE_BUILD_NUMBER_TOKEN (
set BUILD_NUMBER=0
)

for /f "tokens=* USEBACKQ" %%g in (`python "scripts\mumble-version.py"`) do (set "RELEASE_ID=%%g")

:: Create build directory if it doesn't exist.
if not exist "%MUMBLE_BUILD_DIRECTORY%" mkdir "%MUMBLE_BUILD_DIRECTORY%

Expand All @@ -50,7 +48,7 @@ set PATH=%PATH%;C:\WixSharp
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="%MUMBLE_ENVIRONMENT_TOOLCHAIN%" -DVCPKG_TARGET_TRIPLET=%MUMBLE_ENVIRONMENT_TRIPLET% ^
-DIce_HOME="%MUMBLE_ENVIRONMENT_PATH%\installed\%MUMBLE_ENVIRONMENT_TRIPLET%" ^
-DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe ^
-DCMAKE_BUILD_TYPE=Release -DCMAKE_UNITY_BUILD=ON -DRELEASE_ID=%RELEASE_ID% -DBUILD_NUMBER=%BUILD_NUMBER% ^
-DCMAKE_BUILD_TYPE=Release -DCMAKE_UNITY_BUILD=ON -DBUILD_NUMBER=%BUILD_NUMBER% ^
-Dpackaging=ON -Dtests=ON -Dstatic=ON -Dsymbols=ON -Dgrpc=ON -Dasio=ON -Dg15=ON ^
-Ddisplay-install-paths=ON %MUMBLE_SOURCE_REPOSITORY%

Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20.0")
endif()

set(BUILD_NUMBER CACHE STRING "The build number of the current build. Will be used in Mumble's version to make sure newer builds upgrade older installations properly.")
set(RELEASE_ID CACHE STRING "The ID of the current release (used for representation in the UI and the updater)")

if ("${BUILD_NUMBER}" STREQUAL "")
if(packaging)
Expand Down Expand Up @@ -79,7 +78,6 @@ target_architecture(MUMBLE_TARGET_ARCH)
string(TOLOWER "${MUMBLE_TARGET_ARCH}" MUMBLE_TARGET_ARCH)

message(STATUS "##################################################")
message(STATUS "Mumble release ID: ${RELEASE_ID}")
message(STATUS "Mumble version: ${PROJECT_VERSION}")
message(STATUS "Architecture: ${MUMBLE_TARGET_ARCH}")
if(NOT IS_MULTI_CONFIG)
Expand Down
73 changes: 2 additions & 71 deletions scripts/mumble-version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,7 @@
# that can be found in the LICENSE file at the root of the
# Mumble source tree or at <https://www.mumble.info/LICENSE>.
#
# This script returns the Mumble version string for a Mumble Git
# repository. The script must be run from within a Mumble Git
# repository.
# This is a replacement for `git describe` to make snapshots
# use the future, untagged version number rather than the previous.
#
# The version is of form 1.3.0~2020-07-02~g4f336a2~snapshot.
# It includes the target release version rather than the previous
# release (as git describe does).
#
# Detailed description:
#
# Once upon a time, Mumble used the output of `git describe` as
# its version string.
#
# If a commit was tagged, it was a "release", and got a simple
# string which was the name of the tag.
#
# If a commit wasn't tagged, it got '1.2.6-234-gf552ag1', which
# consists of the number of commits since the latest tag, and
# the commit hash of the latest commit.
#
# However, the output of `git describe` was found to be confusing
# in practice. This is because the base version of the `git describe`
# output is the latest tag, which is to say: the *previous*
# version of Mumble.
#
# So, a user running a snapshot that would become 1.3.0 would be
# running a version like 1.2.6-234-gf552ag1. This is confusing
# simply by looking at the version numbers, but the way versioning
# works inside the Mumble client made it worse: the client's version
# was referred to as "1.3.0" in several places, but the actual version
# number said 1.2.6-234-gf552ag1.
#
# This script is the replacement for `git describe`. It outputs the
# *actual* base version of the Mumble tree, rather than the latest tag.
# This means that snapshots for Mumble 1.3.0 now have the base version
# '1.3.0'.
#
# It also changes the version string: Instead of using dashes
# as a separator in the version string, it now uses tildes. This allows
# Debian's dpkg version comparer to correctly sort snapshot versions
# before release versions. The new string also includes 'snapshot' in the
# version string to denote to users that the given version is a pre-release
# snapshot.
# Furthermore the version number does use the latest commit's date rather
# than therevision number since the last tag.
# A full new-style version string looks like this:
# 1.3.0~2020-07-02~g4f336a2~snapshot.
# This script reads and prints the current Mumble version

from __future__ import (unicode_literals, print_function, division)

Expand Down Expand Up @@ -100,10 +52,7 @@ def readProjectVersion():

def main():
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--format', choices = ['full', 'version', 'suffix'], default='full', help = 'Output format')
parser.add_argument('-n', '--newline', action = "store_true", help = 'Break line after printing version')
parser.add_argument('-r', '--revision', type = int, default = 1, help = 'Revision (only used for type \'beta\' and \'rc\')')
parser.add_argument('-t', '--type', choices = ['snapshot', 'beta', 'rc', 'stable'], default = 'snapshot', help = 'Release type - determines the suffix')
args = parser.parse_args()

if args.newline:
Expand All @@ -113,27 +62,9 @@ def main():

version = readProjectVersion()

if args.format == 'version':
print(version, end = end)
return

suffix = ''
print(version, end = end)

if args.type == 'rc' or args.type == 'beta':
suffix = '-{0}{1}'.format(args.type, args.revision)
elif args.type == 'snapshot':
# Get the date of the most recent commit
latestCommitDate = cmd(['git', 'log', '-1', '--format=%cd', '--date=short']).strip()

# Get the hash of the most recent commit (shortened)
latestCommitHash = cmd(['git', 'rev-parse', '--short', 'HEAD']).strip()

suffix = '~{0}~g{1}~snapshot'.format(latestCommitDate, latestCommitHash)

if args.format == 'suffix':
print(suffix, end = end)
else:
print(version + suffix, end = end)

if __name__ == '__main__':
main()
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ target_sources(shared
target_compile_definitions(shared
PUBLIC
"MUMBLE_VERSION=${PROJECT_VERSION}"
# Only define this macro if RELEASE_ID is actually set
$<$<NOT:$<STREQUAL:"${RELEASE_ID}","">>:MUMBLE_RELEASE_ID=${RELEASE_ID}>
)

target_compile_definitions(shared
Expand Down
6 changes: 1 addition & 5 deletions src/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
#define MUMXTEXT(X) #X
#define MUMTEXT(X) MUMXTEXT(X)

#ifndef MUMBLE_RELEASE_ID
# define MUMBLE_RELEASE "Compiled by User"
#else
# define MUMBLE_RELEASE MUMTEXT(MUMBLE_RELEASE_ID)
#endif
#define MUMBLE_RELEASE MUMTEXT(MUMBLE_VERSION)

namespace Version {

Expand Down

0 comments on commit 8505df9

Please sign in to comment.