[OpenAFS-devel] git+versioning proposal

Russ Allbery rra@stanford.edu
Mon, 15 Mar 2010 21:50:02 -0700


Derrick Brashear <shadow@gmail.com> writes:

> Right now, if you grab source from a nightly or from git directly, it
> claims to be the last committed version. I'd like it to claim to be the
> sha1 of the last commit. this doesn't work perfectly but gives a better
> idea than now.

Rather than using the SHA1 of the last commit, use the output from git
describe, possibly munged.  It looks like:

    openafs-devel-1_5_72-134-g6bfca9c

or, in other words:

    <tag>-<commit-count>-<sha1>

where <tag> is the last tag on the current branch, <commit-count> is the
number of commits made since that tag, and <sha1> is the hash of the top
commit.

This output would look even better if we changed our CVS-hobbled branch
naming scheme for the sort of branch and tag names that git supports, such
as simply "stable" or "stable-1.4" for the stable branch and simple
version numbers like "1.5.72" for the release tags.  Then, in this case,
you'd get:

    1.5.72-134-g6bfca9c

which looks like a rather nice and useful version number.  But of course
you can create that version anyway by munging git describe output to
correct for our broken-for-CVS tag names.

> Problem: tagged versions should be able to be regenerated and have the
> version embedded in a small set of files.

> Proposal: each release will be done on a branch containing just the
> version number changes

There is a hack that one can do with recent Autoconf that will let you run
an external command to determine the version number at the time of running
autoconf, which would make this work for any straight build rather than
requiring special work in the release script and running it to do the
build.  I'm not sure how far back of versions that it will work with;
we're currently hampered by having to support an older Autoconf for RHEL5.
(Yes, I know that RHEL5 wasn't that long ago, but Autoconf development has
been fairly fast lately and the changes since then are quite nice.)

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>