<div>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.</div>


<div><br></div><div>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.</div>


<div><font face="'courier new', monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">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 :-)</font></div>


<div><font face="arial, helvetica, sans-serif"><br></font></div><div>Here are the results after applying all three patches:</div><div><div><font face="'courier new', monospace">dhendrix@thegates:flashrom$ ./util/getrevision.sh -h</font></div>


<div><font face="'courier new', monospace">Usage:</font></div><div><font face="'courier new', monospace">        ./util/getrevision.sh <option></font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">Options</font></div><div><font face="'courier new', monospace">    -h or --help</font></div>
<div><font face="'courier new', monospace">        Display this message.</font></div><div><font face="'courier new', monospace">    -u or --upstream</font></div>
<div><font face="'courier new', monospace">        upstream flashrom revision</font></div><div><font face="'courier new', monospace">    -l or --local</font></div>
<div><font face="'courier new', monospace">        local revision (if different from upstream)</font></div><div><font face="'courier new', monospace">    -t or --timestamp</font></div>
<div><font face="'courier new', monospace">        timestamp of most recent modification</font></div><div><font face="'courier new', monospace">    -U or --url</font></div>
<div><font face="'courier new', monospace">        url associated with local copy of flashrom</font></div></div><div><br></div><div><b>Test setup #1</b>: SVN repo with no local modifications</div>
<div><div><font face="'courier new', monospace"><span style="font-family:arial">Since this is an SVN repo in this case, there is no local revision to take into account.</span></font></div>
<div><font face="'courier new', monospace">dhendrix@thegates:flashrom-head$ ./util/getrevision.sh -u -l -t -U</font></div><div><font face="'courier new', monospace">1155</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">2010-09-07 18:14:53 UTC</font></div><div><font face="'courier new', monospace">svn://<a href="http://coreboot.org/flashrom/trunk" target="_blank">coreboot.org/flashrom/trunk</a></font></div>


</div><div><br></div><div><div><font face="'courier new', monospace">dhendrix@thegates:flashrom-head$ sudo ./flashrom --version</font></div><div><font face="'courier new', monospace">flashrom v0.9.2-r1155 from svn://<a href="http://coreboot.org/flashrom/trunk" target="_blank">coreboot.org/flashrom/trunk</a>, 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</font></div>


<div><font face="'courier new', monospace">flashrom is free software, get the source code at <a href="http://www.flashrom.org" target="_blank">http://www.flashrom.org</a></font></div></div><div><br></div>
<div><b>Test setup #2</b>: SVN repo with local modifications</div><div><div><div><font face="'courier new', monospace"><span style="font-family:arial">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.</span></font></div>


<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">dhendrix@thegates:flashrom-gitfriendly$ ./util/getrevision.sh -u -l -t -U</font></div>
<div><font face="'courier new', monospace">1155</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">2010-09-07 14:48:24 +</font></div>


<div><font face="'courier new', monospace">svn://<a href="http://coreboot.org/flashrom/trunk" target="_blank">coreboot.org/flashrom/trunk</a></font></div></div></div><div><font face="'courier new', monospace"><br>


</font></div><div><font face="'courier new', monospace"><div><div>flashrom v0.9.2-r1155 from svn://<a href="http://coreboot.org/flashrom/trunk" target="_blank">coreboot.org/flashrom/trunk</a>, 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</div>


<div>flashrom is free software, get the source code at <a href="http://www.flashrom.org" target="_blank">http://www.flashrom.org</a></div></div><div><font face="arial"><font face="'courier new', monospace"><br>
</font></font></div></font></div><div><b>Test setup #3</b>: Git repo with no local modifications</div><div><div><font face="'courier new', monospace"><span style="font-family:arial">Since this is a git repo, we will use the hash (668198a) as the local revision.</span></font></div>


<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">dhendrix@thegates:flashrom-git-nomods$ ./util/getrevision.sh -u -l -t -U</font></div>
<div><font face="'courier new', monospace">1130</font></div><div><font face="'courier new', monospace">668198a</font></div><div><font face="'courier new', monospace">Sep 07 2010 04:34:27 UTC</font></div>


<div><font face="'courier new', monospace"><a href="http://src.chromium.org/git/flashrom.git" target="_blank">http://src.chromium.org/git/flashrom.git</a></font></div></div><div><br></div><div><div><font face="'courier new', monospace">dhendrix@thegates:flashrom$ sudo ./flashrom --version</font></div>


<div><font face="'courier new', monospace">flashrom v0.9.2-r1130 from <a href="http://src.chromium.org/git/flashrom.git" target="_blank">http://src.chromium.org/git/flashrom.git</a>, 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</font></div>


<div><font face="'courier new', monospace">flashrom is free software, get the source code at <a href="http://www.flashrom.org" target="_blank">http://www.flashrom.org</a></font></div></div><div><br></div>
<div><b>Test setup #4</b>: Git repo with modifications</div><div><span style="font-family:'courier new', monospace">dhendrix@thegates:flashrom$ ./util/getrevision.sh -u -l -t -U</span></div>
<div><div><font face="'courier new', monospace"><div>1130</div><div>b388227</div><div>Sep 07 2010 21:53:31 UTC</div><div>ssh://<a href="http://git@gitrw.chromium.org/flashrom" target="_blank">git@gitrw.chromium.org/flashrom</a></div>


<div><br></div><div>dhendrix@thegates:flashrom$ sudo ./flashrom --version</div><div><div>flashrom v0.9.2-r1130 from ssh://<a href="http://git@gitrw.chromium.org/flashrom" target="_blank">git@gitrw.chromium.org/flashrom</a>, 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</div>


<div>flashrom is free software, get the source code at <a href="http://www.flashrom.org" target="_blank">http://www.flashrom.org</a></div></div><div><br></div></font></div></div><div><div><div>Signed-Off-By: David Hendricks <<a href="mailto:dhendrix@google.com" target="_blank">dhendrix@google.com</a>></div>


<div><div><div><br>-- <br>David Hendricks (dhendrix)<br>Systems Software Engineer, Google Inc.<br>
</div></div></div></div></div>