From 7359f1a67ef1eeb8511a44019fd723102380c2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sun, 13 Jun 2010 12:23:57 +0200 Subject: Fix Debian versioning to be strictly increasing. diff --git a/BuildTools/DebianizeVersion.py b/BuildTools/DebianizeVersion.py new file mode 100755 index 0000000..dc5474f --- /dev/null +++ b/BuildTools/DebianizeVersion.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +import sys + +assert(len(sys.argv) == 2) + +version = sys.argv[1] +version = version.replace("beta", "~beta") +version = version.replace("rc", "~rc") +version = version.replace("-dev", "+dev") + +print version diff --git a/BuildTools/TestVersioningScheme.sh b/BuildTools/TestVersioningScheme.sh new file mode 100755 index 0000000..8fcc96a --- /dev/null +++ b/BuildTools/TestVersioningScheme.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +function test_versions() { + versions=$@ + previous_version= + for version in $versions; do + if [ "$previous_version" ]; then + debian_version=`./DebianizeVersion.py $version` + debian_previous_version=`./DebianizeVersion.py $previous_version` + dpkg --compare-versions $debian_version gt $debian_previous_version + result=$? + if [ "$result" != "0" ]; then + echo "TEST FAILED: $debian_version > $debian_previous_version" + fi + fi + previous_version=$version + done +} + +DEVELOPMENT_VERSIONS=" + swift-1.0beta1 + swift-1.0beta1-dev3 + swift-1.0beta2 + swift-1.0rc1 + swift-1.0 + swift-1.0-dev2 + swift-1.0-dev4 + swift-2.0" +test_versions $DEVELOPMENT_VERSIONS + +BETA_VERSIONS=" + swift-1.0beta1 + swift-1.0beta2 + swift-1.0rc1 + swift-1.0 + swift-1.1rc1 + swift-1.1 + swift-2.0" +test_versions $BETA_VERSIONS + +RELEASE_VERSIONS=" + swift-1.0 + swift-1.1 + swift-2.0" +test_versions $RELEASE_VERSIONS diff --git a/BuildTools/UpdateDebianChangelog.py b/BuildTools/UpdateDebianChangelog.py index 6615ab1..c4e32b7 100755 --- a/BuildTools/UpdateDebianChangelog.py +++ b/BuildTools/UpdateDebianChangelog.py @@ -12,7 +12,7 @@ changelog.close() project = "" last_version = "" -m = re.match("(\w+) \((.*)\)", last_version_line) +m = re.match("(\w+) \((.*)-\d+\)", last_version_line) if m : project = m.group(1) last_version = m.group(2) @@ -22,7 +22,7 @@ if last_version != version : changelog_data = changelog.read() changelog.close() changelog = open(sys.argv[1], "w") - changelog.write(project + " (" + version + ")" + " unstable; urgency=low\n\n") + changelog.write(project + " (" + version + "-1)" + " unstable; urgency=low\n\n") changelog.write(" * Upstream development snapshot\n\n") changelog.write(" -- Remko Tron\xc3\xa7on " + email.utils.formatdate() + "\n") changelog.write("\n") diff --git a/Swift/Packaging/Debian/debian/changelog b/Swift/Packaging/Debian/debian/changelog index 86ee38d..ef172f0 100644 --- a/Swift/Packaging/Debian/debian/changelog +++ b/Swift/Packaging/Debian/debian/changelog @@ -1,10 +1,10 @@ -swift (1.0beta2-1) unstable; urgency=low +swift (1.0~beta2-1) unstable; urgency=low * Upstream release -- Remko Tronçon Sat, 26 Sep 2009 11:08:32 +0200 -swift (1.0beta1-1) unstable; urgency=low +swift (1.0~beta1-1) unstable; urgency=low * Upstream release diff --git a/Swift/Packaging/Debian/package.sh b/Swift/Packaging/Debian/package.sh index 9c9dae1..e6f401f 100755 --- a/Swift/Packaging/Debian/package.sh +++ b/Swift/Packaging/Debian/package.sh @@ -2,9 +2,10 @@ export PYTHONPATH=../../../BuildTools/SCons VERSION=`../../../BuildTools/GetBuildVersion.py swift` -DIRNAME=swift-$VERSION +DEBIAN_VERSION=`../../../BuildTools/DebianizeVersion.py $VERSION` +DIRNAME=swift-$DEBIAN_VERSION -if [ -z "$VERSION" ]; then +if [ -z "$DEBIAN_VERSION" ]; then echo "Unable to determine version" exit -1 fi @@ -16,7 +17,7 @@ echo "Checking out a fresh copy ..." rm -rf $DIRNAME git clone ../../../.git $DIRNAME ln -s Swift/Packaging/Debian/debian $DIRNAME/debian -../../../BuildTools/UpdateDebianChangelog.py $DIRNAME/debian/changelog $VERSION +../../../BuildTools/UpdateDebianChangelog.py $DIRNAME/debian/changelog $DEBIAN_VERSION echo "Building ..." cd $DIRNAME -- cgit v0.10.2-6-g49f6