I had some time to take another stab at this, make the shell script standalone (easier testing), and break the changes down much further. Much of it recycles bits and pieces which Vadim and Carl-Daniel wrote (Including the workaround from the blog post) and chops it into more digestible pieces.

I think this approach will be more maintainable and testable in the future than the huge series of shell commands in-lined in the Makefile. This also gives us the flexibility to punt disruptive changes until after the 0.9.3 release, rather than making all the changes at once.

The first patch only adds the script to util/ and is completely benign. The second patch non-disruptively changes the Makefile to utilize the script for SVNVERSION. The third patch disruptively changes the "flashrom --version" output to add the extra information. I expect we'll spend a while longer discussing the third one :-)

Here are the results after applying all three patches:
dhendrix@thegates:flashrom$ ./util/getrevision.sh -h
Usage:
        ./util/getrevision.sh <option>

Options
    -h or --help
        Display this message.
    -u or --upstream
        upstream flashrom revision
    -l or --local
        local revision (if different from upstream)
    -t or --timestamp
        timestamp of most recent modification
    -U or --url
        url associated with local copy of flashrom

Test setup #1: SVN repo with no local modifications
Since this is an SVN repo in this case, there is no local revision to take into account.
dhendrix@thegates:flashrom-head$ ./util/getrevision.sh -u -l -t -U
1155

2010-09-07 18:14:53 UTC
svn://coreboot.org/flashrom/trunk

dhendrix@thegates:flashrom-head$ sudo ./flashrom --version
flashrom v0.9.2-r1155 from svn://coreboot.org/flashrom/trunk, no local revision, timestamp 2010-09-07 15:03:38 +,  on Linux 2.6.32-14-generic (x86_64), built with libpci 3.0.0, GCC 4.4.3, little endian
flashrom is free software, get the source code at http://www.flashrom.org

Test setup #2: SVN repo with local modifications
Since this is an SVN repo in this case, there is no local revision to take into account. However, I have changed files in this case, so the timestamp has been modified.

dhendrix@thegates:flashrom-gitfriendly$ ./util/getrevision.sh -u -l -t -U
1155

2010-09-07 14:48:24 +
svn://coreboot.org/flashrom/trunk

flashrom v0.9.2-r1155 from svn://coreboot.org/flashrom/trunk, no local revision, timestamp 2010-09-07 15:03:39 +,  on Linux 2.6.32-14-generic (x86_64), built with libpci 3.0.0, GCC 4.4.3, little endian
flashrom is free software, get the source code at http://www.flashrom.org

Test setup #3: Git repo with no local modifications
Since this is a git repo, we will use the hash (668198a) as the local revision.

dhendrix@thegates:flashrom-git-nomods$ ./util/getrevision.sh -u -l -t -U
1130
668198a
Sep 07 2010 04:34:27 UTC
http://src.chromium.org/git/flashrom.git

dhendrix@thegates:flashrom$ sudo ./flashrom --version
flashrom v0.9.2-r1130 from http://src.chromium.org/git/flashrom.git, local revision 668198a, timestamp Sep 07 2010 15:21:00 +,  on Linux 2.6.32-14-generic (x86_64), built with libpci 3.0.0, GCC 4.4.3, little endian
flashrom is free software, get the source code at http://www.flashrom.org

Test setup #4: Git repo with modifications
dhendrix@thegates:flashrom$ ./util/getrevision.sh -u -l -t -U
1130
b388227
Sep 07 2010 21:53:31 UTC
ssh://git@gitrw.chromium.org/flashrom

dhendrix@thegates:flashrom$ sudo ./flashrom --version
flashrom v0.9.2-r1130 from ssh://git@gitrw.chromium.org/flashrom, local revision b388227, timestamp Sep 07 2010 15:22:38 +,  on Linux 2.6.32-14-generic (x86_64), built with libpci 3.0.0, GCC 4.4.3, little endian
flashrom is free software, get the source code at http://www.flashrom.org

Signed-Off-By: David Hendricks <dhendrix@google.com>

--
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.