ma-linux@tux.org
[Top] [All Lists]

[Ma-linux] Tracking build numbers with git?

Subject: [Ma-linux] Tracking build numbers with git?
From: Rob Sherwood
Date: Tue, 20 Oct 2009 19:56:45 -0700
Hello,

I'm looking for advice for how to track build numbers using git on my
open source project.  Let me give a little background:

In my past cvs/svn-based projects, I've had a script that, as part of
the Makefile build target, would query the cvs/svn repo for the
current version number (for example, if I was working on version 1.2
of my code and I was on commit # 5678) and push it in to a file
"version.h" so that when I ran `./myproj --version`,  it would return
a number that described exactly the code that was used to build the
binary, e.g., "1.2.5678".  This was a nice and automatic way of
matching binaries to the code they were built from which I find very
useful in a dev environment.

Now, fast forward to the brave new world of git.  Git, by its nature,
doesn't have a single build number.  Different developers can snag
arbitrary patches for their own repositories and build the code in
myriad different ways that can't be expressed with a single, global
number.  For many reasons, this is good, but in terms of having a nice
short (ideally monotonically increasing) description of how the code
is progressing, it's a PITA :-P

That said, I can't imagine I'm the first person who has made this
realization so I'm asking how other people have solved this problem.

Some solutions that have occurred to me (that don't seem that great) are:

1) Keep a file number that I manually update.  I already do this for
actual version numbers via autoconf, but this is untenable for each
and every commit.
2) Have a git hook to auto increment a number for me.   Git hooks have
to be setup per repository instance (a separate PITA) and can easily
get out of sequence when two branches split and then merge again.
3) Use the hash from the current HEAD: not very human readable and
it's hard to compare "is this binary older than this other binary".
But, granted, that is inherent in git, so it may be that this is the
best solution.

Can anyone think of anything better?  I'm sure that someone has solved
this problem.

Thanks in advance!

- Rob
.
_______________________________________________
Ma-linux mailing list
Ma-linux@xxxxxxxxxxxxxxx
http://calypso.tux.org/mailman/listinfo/ma-linux

<Prev in Thread] Current Thread [Next in Thread>