Versioning svn checkouts

Jim Meyering jim at meyering.net
Sat Dec 1 15:57:58 UTC 2007


Bill Nottingham <notting at redhat.com> wrote:
> Petr Machata (pmachata at redhat.com) said:
>> Steve Grubb wrote:
>> > kdepim-enterprise-svn20070926.tar.bz2
>>
>> As a side note, I always wondered why to use date in the release tag of
>> package, whose sources come from non-cvs versioning system.  For svn, in
>> my opinion, it would make more sense to use the tree revision number;
>> for git, similarly, sha1 id of the tree.
>
> Well, git<date> sorts sanely. git<sha1> does not. Comments in the spec
> (or similar) might help with this.

For git-based projects, I like to use something based on the output of
git-describe.  Then you get the best of both worlds: a regular version
string, a sequence number, and an SHA1 prefix.  For example, the latest
version of autoconf does this:

    $ autoconf --version |head -1
    autoconf (GNU Autoconf) 2.61a.312-b524b

That means it's built from the 312th change-set since the 2.61a tag.
The SHA1 of that change-set starts with "b524b".

In the case of autoconf, you can map from the above string back to
its SHA1 by prepending a 'v' (to get the tag name) and inserting a 'g'
after the '-' (because git requires this).  Then use git-rev-parse:

    $ git-rev-parse v2.61a.312-gb524b
    b524b0f996c9c1e9a81a3e3cdcc11517c39adb7c




More information about the fedora-devel-list mailing list