packaging: use valid debian version number format

Before this commit, we had debian version numbers like this:

    <MostRecentTag>-<CommitsSinceThen>-g<GitHash>

    In pre-releases (such as "2.5.0-pre1"), the "-" was replaced with "~",
    so it would sort as younger than the actual release (such as "2.5.0").

    An example version number is: 2.5.0~pre1-537-g3748da4

After this commit, we will have debian version numbers like this:

    <MostRecentTag>+<CommitsSinceThen>.g<GitHash>

    Again with the "-" replaced with "~".

    An example version number is: 2.5.0~pre1+538.g08d3fe2

Rationale:

We have a "native" debian package: a piece of software that's distributed
with its own debian packaging setup.

Debian version numbers are governed by the Debian Policy Manual.  Section
5.6.12 of version 3.8.4.0 (and other sections of earlier versions, going
back to the very beginning I think) specify that native debian packages
may not contain the "-" (dash) character in their version numbers.

The dash character is normally used to separate the upstream version
number from the debian packaging version number, and as a native package
we have no such division.

Details here:
<http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version>
This commit is contained in:
Sebastian Kuzminsky 2011-08-08 16:20:48 -06:00
parent 3748da4c50
commit 7e8dbfd6f0

View file

@ -26,7 +26,7 @@ GIT_TAG=`echo $GIT_VERSION | sed -r 's/^(.*)-[^-]+-[^-]+$/\1/'`
DEB_VERSION=`git show HEAD:debian/changelog | head -1 | sed 's/.*(\(.*\)).*/\1/'`
NEW_DEB_VERSION="${GIT_VERSION/-pre/~pre}"
NEW_DEB_VERSION=$(echo $GIT_VERSION | sed -r 's/-pre/~pre/; s/-/+/; s/-/./g')
NEW_DEB_VERSION="1:${NEW_DEB_VERSION/v/}"
if [ "$NEW_DEB_VERSION" = "$DEB_VERSION" ]; then