Create a 1.0 release branch, and rework the way version numbers are done everywhere.

This commit is contained in:
David Sansome 2011-12-02 14:47:25 +00:00
parent a622cc7958
commit c0ac798a71
10 changed files with 199 additions and 50 deletions

View File

@ -6,14 +6,14 @@ set(RPM_ARCH x86_64 CACHE STRING "Architecture of the rpm file")
add_custom_target(rpm
COMMAND ${CMAKE_SOURCE_DIR}/dist/maketarball.sh
COMMAND ${CMAKE_COMMAND} -E copy clementine-${CLEMENTINE_VERSION_RPM}.tar.gz ${RPMBUILD_DIR}/SOURCES/
COMMAND ${CMAKE_COMMAND} -E copy clementine-${CLEMENTINE_VERSION_RPM_V}.tar.gz ${RPMBUILD_DIR}/SOURCES/
COMMAND rpmbuild -bs ${CMAKE_SOURCE_DIR}/dist/clementine.spec
COMMAND ${MOCK_COMMAND}
--verbose
--root=${MOCK_CHROOT}
--resultdir=${CMAKE_BINARY_DIR}/mock_result/
${RPMBUILD_DIR}/SRPMS/clementine-${CLEMENTINE_VERSION_RPM}-1.${RPM_DISTRO}.src.rpm
${RPMBUILD_DIR}/SRPMS/clementine-${CLEMENTINE_VERSION_RPM_V}-${CLEMENTINE_VERSION_RPM_R}.${RPM_DISTRO}.src.rpm
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/mock_result/clementine-${CLEMENTINE_VERSION_RPM}-1.${RPM_DISTRO}.${RPM_ARCH}.rpm
${CMAKE_BINARY_DIR}/clementine-${CLEMENTINE_VERSION_RPM}-1.${RPM_DISTRO}.${RPM_ARCH}.rpm
${CMAKE_BINARY_DIR}/mock_result/clementine-${CLEMENTINE_VERSION_RPM_V}-${CLEMENTINE_VERSION_RPM_R}.${RPM_DISTRO}.${RPM_ARCH}.rpm
${CMAKE_BINARY_DIR}/clementine-${CLEMENTINE_VERSION_RPM_V}-${CLEMENTINE_VERSION_RPM_R}.${RPM_DISTRO}.${RPM_ARCH}.rpm
)

View File

@ -1,37 +1,119 @@
# Change this file when releasing a new version.
# Version numbers.
set(CLEMENTINE_VERSION_MAJOR 0)
set(CLEMENTINE_VERSION_MINOR 7)
set(CLEMENTINE_VERSION_PATCH 1)
#set(CLEMENTINE_VERSION_PRERELEASE rc1)
set(CLEMENTINE_VERSION_MAJOR 1)
set(CLEMENTINE_VERSION_MINOR 0)
set(CLEMENTINE_VERSION_PATCH 0)
set(CLEMENTINE_VERSION_PRERELEASE rc1)
# This should be set to OFF in a tag
set(INCLUDE_GIT_REVISION ON)
# This should be set to OFF in a release branch
set(INCLUDE_GIT_REVISION OFF)
# The format for version numbers is:
# Display: $major.$minor[.$patch] [$prerelease] [r$svn]
# Deb: $major.$minor[.$patch][~$prerelease][.r$svn]
# Rpm: $major.$minor[.$patch][$prerelease][.r$svn]
# And the rpm version is used for mac and windows
# Rules about version number comparison on different platforms:
# Debian:
# Two stages are repeated until there are no more characters to compare:
# one block of consecutive digits (\d+) is compared numerically, then one
# block of consecutive NON-digits (\D+) is compared lexigraphically,
# with the exception that ~ sorts before everything else.
#
# The "upstream version" and "debian revision" are separated by the last
# dash in the version number.
#
# Algorithm is in "man deb-version", test comparisons with
# dpkg --compare-versions.
#
# These are in sorted order:
# 1.0~rc1
# 1.0~rc2
# 1.0
# 1.0-1-g044287b
# 1.0-506-g044287b
# 1.0.1
# 1.0.2
# 1.0.a
#
# Rpm:
# The string is split on non-alphanumeric characters. Numeric sections are
# compared numerically and non-numeric sections are compared lexigraphically.
# If one sections is numeric and the other sections is non-numeric, the
# numeric sections is always NEWER.
#
# The "version" and "release" fields are compared with the same algorithm -
# if the versions are equal the releases are compared to determine which
# package is newer.
#
# Algorithm is described in:
# http://fedoraproject.org/wiki/Packaging:NamingGuidelines#Package_Versioning
# Test comparisons with:
# import rpm
# rpm.labelCompare((epoch, version, release), (epoch, version, release))
#
# These are in sorted order:
# 1.0-0.rc1
# 1.0-0.rc2
# 1.0-1
# 1.0-2.506-g044287b
# 1.0.1-1
# 1.0.2-1
#
# Sparkle (mac) and QtSparkle (windows):
# The strings are split into sections of characters that are all of the same
# "type" - where a "type" is period, digit, or other. Sections are then
# compared against each other - digits are compared numerically and other
# are compared lexigraphically. When two sections are of different types,
# the numeric section is always NEWER.
#
# If the common parts of both strings are equal, but one string has more
# sections, the type of the first extra section is used to determine which
# version is newer.
# If the extra section is a string, the shorter result is NEWER, otherwise
# the shorter section is OLDER. That means that 1.0 is NEWER than 1.0rc1,
# but 1.0 is OLDER than 1.0.1.
#
# See compareversions.cpp in QtSparkle.
# Version numbers in Clementine:
# Deb:
# With git: $tagname-$commitcount-g$sha1
# Without git: $major.$minor.$patch[~$prerelease]
#
# Rpm: Version Release
# Prerelease: $major.$minor.$patch 0.$prerelease
# Without git: $major.$minor.$patch 1
# With git: $tagname 2.$commitcount.g$sha1
#
# QtSparkle (Windows):
# With git: $tagname-$commitcount-g$sha1
# Without git: $major.$minor.$patch[$prerelease]
#
# Mac info.plist: CFBundleVersion
# Prerelease: $major.$minor.$patch.0
# Without git: $major.$minor.$patch.1
# With git: $tagname.2.$commitcount
set(CLEMENTINE_VERSION_DISPLAY "${CLEMENTINE_VERSION_MAJOR}.${CLEMENTINE_VERSION_MINOR}")
set(CLEMENTINE_VERSION_DEB "${CLEMENTINE_VERSION_MAJOR}.${CLEMENTINE_VERSION_MINOR}")
set(CLEMENTINE_VERSION_RPM "${CLEMENTINE_VERSION_MAJOR}.${CLEMENTINE_VERSION_MINOR}")
set(majorminorpatch "${CLEMENTINE_VERSION_MAJOR}.${CLEMENTINE_VERSION_MINOR}.${CLEMENTINE_VERSION_PATCH}")
# Add patch
if(CLEMENTINE_VERSION_PATCH)
set(CLEMENTINE_VERSION_DISPLAY "${CLEMENTINE_VERSION_DISPLAY}.${CLEMENTINE_VERSION_PATCH}")
set(CLEMENTINE_VERSION_DEB "${CLEMENTINE_VERSION_DEB}.${CLEMENTINE_VERSION_PATCH}")
set(CLEMENTINE_VERSION_RPM "${CLEMENTINE_VERSION_RPM}.${CLEMENTINE_VERSION_PATCH}")
endif(CLEMENTINE_VERSION_PATCH)
set(CLEMENTINE_VERSION_DISPLAY "${majorminorpatch}")
set(CLEMENTINE_VERSION_DEB "${majorminorpatch}")
set(CLEMENTINE_VERSION_RPM_V "${majorminorpatch}")
set(CLEMENTINE_VERSION_RPM_R "1")
set(CLEMENTINE_VERSION_SPARKLE "${majorminorpatch}")
set(CLEMENTINE_VERSION_PLIST "${majorminorpatch}")
if(${CLEMENTINE_VERSION_PATCH} EQUAL "0")
set(CLEMENTINE_VERSION_DISPLAY "${CLEMENTINE_VERSION_MAJOR}.${CLEMENTINE_VERSION_MINOR}")
endif(${CLEMENTINE_VERSION_PATCH} EQUAL "0")
# Add prerelease
if(CLEMENTINE_VERSION_PRERELEASE)
set(CLEMENTINE_VERSION_DISPLAY "${CLEMENTINE_VERSION_DISPLAY} ${CLEMENTINE_VERSION_PRERELEASE}")
set(CLEMENTINE_VERSION_DEB "${CLEMENTINE_VERSION_DEB}~${CLEMENTINE_VERSION_PRERELEASE}")
set(CLEMENTINE_VERSION_RPM "${CLEMENTINE_VERSION_RPM}${CLEMENTINE_VERSION_PRERELEASE}")
set(CLEMENTINE_VERSION_DEB "${CLEMENTINE_VERSION_DEB}~${CLEMENTINE_VERSION_PRERELEASE}")
set(CLEMENTINE_VERSION_RPM_R "0.${CLEMENTINE_VERSION_PRERELEASE}")
set(CLEMENTINE_VERSION_SPARKLE "${CLEMENTINE_VERSION_SPARKLE}${CLEMENTINE_VERSION_PRERELEASE}")
set(CLEMENTINE_VERSION_PLIST "${CLEMENTINE_VERSION_PLIST}.0")
else(CLEMENTINE_VERSION_PRERELEASE)
set(CLEMENTINE_VERSION_PLIST "${CLEMENTINE_VERSION_PLIST}.1")
endif(CLEMENTINE_VERSION_PRERELEASE)
# Add git revision
@ -46,16 +128,36 @@ else(FORCE_GIT_REVISION)
OUTPUT_VARIABLE GIT_REV
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(${GIT_INFO_RESULT} EQUAL 0)
set(GIT_REVISION ${GIT_REV})
string(REGEX REPLACE "^(.+)-([0-9]+)-(g[a-f0-9]+)$" "\\1;\\2;\\3"
GIT_PARTS ${GIT_REV})
if(NOT GIT_PARTS)
message(FATAL_ERROR "Failed to parse git revision string '${GIT_REV}'")
endif(NOT GIT_PARTS)
list(GET GIT_PARTS 0 GIT_TAGNAME)
list(GET GIT_PARTS 1 GIT_COMMITCOUNT)
list(GET GIT_PARTS 2 GIT_SHA1)
set(HAS_GET_REVISION ON)
endif(${GIT_INFO_RESULT} EQUAL 0)
endif(NOT GIT_EXECUTABLE-NOTFOUND)
endif(FORCE_GIT_REVISION)
if(INCLUDE_GIT_REVISION AND GIT_REVISION)
set(CLEMENTINE_VERSION_DISPLAY "${GIT_REVISION}")
set(CLEMENTINE_VERSION_DEB "${GIT_REVISION}")
if(INCLUDE_GIT_REVISION AND HAS_GET_REVISION)
set(CLEMENTINE_VERSION_DISPLAY "${GIT_REV}")
set(CLEMENTINE_VERSION_DEB "${GIT_REV}")
set(CLEMENTINE_VERSION_RPM_V "${GIT_TAGNAME}")
set(CLEMENTINE_VERSION_RPM_R "2.${GIT_COMMITCOUNT}.${GIT_SHA1}")
set(CLEMENTINE_VERSION_SPARKLE "${GIT_REV}")
set(CLEMENTINE_VERSION_PLIST "${GIT_TAGNAME}.2.${GIT_COMMITCOUNT}")
endif(INCLUDE_GIT_REVISION AND HAS_GET_REVISION)
# RPM doesn't like dashes in version numbers
string(REPLACE "-" "." CLEMENTINE_VERSION_RPM "${GIT_REVISION}")
endif(INCLUDE_GIT_REVISION AND GIT_REVISION)
if(0)
message(STATUS "Display: ${CLEMENTINE_VERSION_DISPLAY}")
message(STATUS "Deb: ${CLEMENTINE_VERSION_DEB}")
message(STATUS "Rpm: ${CLEMENTINE_VERSION_RPM_V}-${CLEMENTINE_VERSION_RPM_R}")
message(STATUS "Sparkle: ${CLEMENTINE_VERSION_SPARKLE}")
message(STATUS "Plist: ${CLEMENTINE_VERSION_PLIST}")
endif(0)

4
dist/Info.plist.in vendored
View File

@ -21,9 +21,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${CLEMENTINE_VERSION_RPM}</string>
<string>${CLEMENTINE_VERSION_DISPLAY}</string>
<key>CFBundleVersion</key>
<string>${SVN_REVISION}</string>
<string>${CLEMENTINE_VERSION_PLIST}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>

View File

@ -1,6 +1,6 @@
Name: clementine
Version: @CLEMENTINE_VERSION_RPM@
Release: 1.@RPM_DISTRO@
Version: @CLEMENTINE_VERSION_RPM_V@
Release: @CLEMENTINE_VERSION_RPM_R@.@RPM_DISTRO@
Summary: A music player and library organiser
Group: Applications/Multimedia
@ -83,5 +83,5 @@ make clean
%{_datadir}/clementine/projectm-presets
%changelog
* @RPM_DATE@ David Sansome <me@davidsansome.com> - @CLEMENTINE_VERSION_RPM@
* @RPM_DATE@ David Sansome <me@davidsansome.com> - @CLEMENTINE_VERSION_RPM_V@
- Version @CLEMENTINE_VERSION_DISPLAY@

View File

@ -1,8 +1,7 @@
#!/bin/bash
name=clementine
version="@CLEMENTINE_VERSION_RPM@"
deb_version="@CLEMENTINE_VERSION_DEB@"
version="@CLEMENTINE_VERSION_DEB@"
deb_dist="@DEB_DIST@"
root=$(cd "${0%/*}/.." && echo $PWD/${0##*/})
root=`dirname "$root"`
@ -17,6 +16,6 @@ tar -czf $name-$version.tar.gz "$root" \
--exclude "$root/debian" \
--exclude "$root/dist/*.tar.gz"
echo "Also creating ${name}_${deb_version}~${deb_dist}.orig.tar.gz..."
cp "$name-$version.tar.gz" "${name}_${deb_version}~${deb_dist}.orig.tar.gz"
echo "Also creating ${name}_${version}~${deb_dist}.orig.tar.gz..."
cp "$name-$version.tar.gz" "${name}_${version}~${deb_dist}.orig.tar.gz"

48
dist/versionnumbers.py vendored Normal file
View File

@ -0,0 +1,48 @@
import rpm
import subprocess
deb_versions = [
"1.0",
"1.0.1",
"1.0.2",
"1.0.a",
"1.0~rc1",
"1.0~rc2",
"1.0-506-g044287b",
"1.0-1-g044287b",
]
rpm_versions = [
("1.0", "1"),
("1.0.1", "1"),
("1.0.2", "1"),
("1.0", "0.rc1"),
("1.0", "0.rc2"),
("1.0", "2.506-g044287b"),
]
def compare_deb(left, right):
if subprocess.call(["dpkg", "--compare-versions", left, "lt", right]) == 0:
return -1
if subprocess.call(["dpkg", "--compare-versions", left, "eq", right]) == 0:
return 0
if subprocess.call(["dpkg", "--compare-versions", left, "gt", right]) == 0:
return 1
raise Exception("Couldn't compare versions %s %s" % (left, right))
def compare_rpm(left, right):
return rpm.labelCompare(("1", left[0], left[1]), ("1", right[0], right[1]))
def sort_and_print(l, cmp):
for v in sorted(l, cmp=cmp):
if isinstance(v, tuple):
print "%s-%s" % v
else:
print v
print
sort_and_print(deb_versions, compare_deb)
sort_and_print(rpm_versions, compare_rpm)

View File

@ -48,7 +48,7 @@ SetCompressor /SOLID lzma
!insertmacro MUI_LANGUAGE "English"
Name "${PRODUCT_NAME}"
OutFile "${PRODUCT_NAME}Setup-@CLEMENTINE_VERSION_RPM@.exe"
OutFile "${PRODUCT_NAME}Setup-@CLEMENTINE_VERSION_SPARKLE@.exe"
InstallDir "${PRODUCT_INSTALL_DIR}"
ShowInstDetails show
ShowUnInstDetails show

View File

@ -1175,17 +1175,17 @@ if (APPLE)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/clementine-${CLEMENTINE_VERSION_RPM}.dmg
${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/clementine-${CLEMENTINE_VERSION_RPM}.dmg
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../dist/create-dmg.sh ${PROJECT_BINARY_DIR}/clementine.app
OUTPUT ${PROJECT_BINARY_DIR}/clementine-${CLEMENTINE_VERSION_SPARKLE}.dmg
${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/clementine-${CLEMENTINE_VERSION_SPARKLE}.dmg
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../dist/create-dmg.sh ${PROJECT_BINARY_SPARKLE}/clementine.app
COMMAND ${CMAKE_COMMAND} -E rename
${PROJECT_BINARY_DIR}/clementine.dmg
${PROJECT_BINARY_DIR}/clementine-${CLEMENTINE_VERSION_RPM}.dmg
${PROJECT_BINARY_DIR}/clementine-${CLEMENTINE_VERSION_SPARKLE}.dmg
DEPENDS clementine
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
add_custom_target(dmg
DEPENDS ${PROJECT_BINARY_DIR}/clementine-${CLEMENTINE_VERSION_RPM}.dmg)
DEPENDS ${PROJECT_BINARY_DIR}/clementine-${CLEMENTINE_VERSION_SPARKLE}.dmg)
else (APPLE)
install(TARGETS clementine
RUNTIME DESTINATION bin

View File

@ -613,7 +613,7 @@ MainWindow::MainWindow(
qtsparkle::Updater* updater = new qtsparkle::Updater(
QUrl("https://clementine-data.appspot.com/sparkle-windows"), this);
updater->SetNetworkAccessManager(new NetworkAccessManager(this));
updater->SetVersion(CLEMENTINE_VERSION);
updater->SetVersion(CLEMENTINE_VERSION_SPARKLE);
connect(check_updates, SIGNAL(triggered()), updater, SLOT(CheckNow()));
#endif

View File

@ -18,6 +18,6 @@
#define VERSION_H_IN
#define CLEMENTINE_VERSION_DISPLAY "${CLEMENTINE_VERSION_DISPLAY}"
#define CLEMENTINE_VERSION "${CLEMENTINE_VERSION_DEB}"
#define CLEMENTINE_VERSION_SPARKLE "${CLEMENTINE_VERSION_SPARKLE}"
#endif // VERSION_H_IN