[LinuxBIOS] [PATCH] superiotool: Make --version actually work correctly

Robinson Tryon bishop.robinson at gmail.com
Sat Oct 6 17:42:15 CEST 2007

On 10/6/07, Ulf Jordan <jordan at chalmers.se> wrote:
> On Sat, 6 Oct 2007, Robinson Tryon wrote:
> > On 10/5/07, Ward Vandewege <ward at gnu.org> wrote:
> >> On Sat, Oct 06, 2007 at 12:30:06AM +0200, Uwe Hermann wrote:
> >>>> etc.) or at least ask some svn experts whether there is an easier and
> >>>> cleaner way to include a revision number?
> >>>
> >>> Yeah, that would surely be great. Do you know any method or whom to ask?
> >>> I browsed the svn code and manuals but didn't find anything better
> >>> than $Rev$.
> >>
> >> Can't we do this with a commit hook that would update the version number
> >> (which is in 1 place only) automatically to the SVN revision number?
> >
> > I was going to suggest that the buildscript pull the current revision
> > # out of SVN, but the idea of a commit hook sounds like it could be
> > cleaner.  Would the hook apply whenever any file is committed to the
> > repository, or just to files in the superiotool directory?
> NACK. svn commit hooks should not change the contents of the commit, at
> least not according to the svn book (client side caching problems might
> occur).
> I've attached a patch that during build time extracts the svn revision
> from $Rev$ comments in each source file, and keeps the extracted value up
> to date using make.
> Direct application of the patch might give one failure on superiotool.h
> (it has the expanded $Rev$ in your working directory), and compilation
> failure on superiotool.c, since the new $Rev$'s haven't yet been expanded
> (these two issues should not appear when receiving the patch through 'svn
> update'). For testing I expanded the $Rev$ by hand to the corresponding
> svn revisions, and then it worked like a charme:

What about pulling the version directly out of SVN at build time?  Like this:

svn info | sed -n 's/.*Revision: \([0-9]*\)/\1/ p'

As long as the Makefile lives at the top level of the project, this
value should always reflect the latest commit in the current checkout.

More information about the coreboot mailing list