On 22/05/2011 21:17, David Peixotto wrote:
I wrote a python script that can be used to record and reinstate the commit
state of all the git repositories used by GHC. It parses the output of the
sync-all log command suggested by Simon to create a "fingerprint" which is
just the pairs of (subdirectory, commit) that can be used to identify the
current state of all the repos. Given a fingerprint, it can also restore the
repositories to the fingerprint state by running a checkout of the appropriate
commit in each subdir.

If the sync-all log command is added to the build bot then the script can
parse the build log to get the fingerprint and restore the repo state. It
could also be added as a post-commit hook to create a running history of
fingerprints.

The script is available here:

     
https://github.com/dmpots/ghc/blob/36df2f39af4d132dac4acbc11a271a95e2254e42/utils/fingerprint/fingerprint.py

and if appropriate it can be merged from the fingerprint branch here:

     git://github.com/dmpots/ghc.git fingerprint

I merged in your branch. Thanks! Perhaps it would be a good idea to document the usage of the tool on

http://hackage.haskell.org/trac/ghc/wiki/Building/GettingTheSources

Cheers,
        Simon



Some examples of usage follows.

     $ ./utils/fingerprint/fingerprint.py -h
     Usage: fingerprint (create|restore) [options]

     Options:
       -h, --help            show this help message and exit
       -d DIR, --dir=DIR     write output to directory DIR
       -o FILE, --output=FILE
                             write output to file FILE
       -l FILE, --from-log=FILE
                             reconstruct fingerprint from build log
       -f FILE, --from-fp=FILE
                             reconstruct fingerprint from fingerprint file
       -n, --no-branch       do not create a new branch when restoring 
fingerprint
       -g DIR, --ghc-dir=DIR
                             perform actions in GHC dir

Creating a fingerprint by running `sync-all` in the ghc repo:

     $ ./utils/fingerprint/fingerprint.py create
     .|36df2f39af4d132dac4acbc11a271a95e2254e42
     ghc-tarballs|e7b7b152083f7c3e3559e557a239757d41ac02a6
     libraries/Cabal|2da1e48c6be7ba85f1f8e8e35e7960e45b1eaac8
     <snip>

Creating a fingerprint by parsing a build log that contains the `sync-all` log
output

     $ ./utils/fingerprint/fingerprint.py create -l build.log
     .|9c23f06f3eb925dca063d5102b0ced4a9afe795e
     ghc-tarballs|e7b7b152083f7c3e3559e557a239757d41ac02a6
     libraries/Cabal|2da1e48c6be7ba85f1f8e8e35e7960e45b1eaac8
     <snip>

Creating a fingerprint and save the result as a timestamped file. Could be a
useful post-commit hook.

     $ ./utils/fingerprint/fingerprint.py create -d /tmp
     Writing fingerprint to:  /tmp/2011-05-22_14-57-32.fp

Restore a set of commits from a fingerprint file.

     $ ./utils/fingerprint/fingerprint.py restore -f /tmp/2011-05-22_14-57-32.fp
     == libraries/filepath git checkout 92d211a2752fe8827582ae0d97efd18722ad3d87
     HEAD is now at 92d211a... Update source repo location to be the git repo 
in .cabal file
     <snip>
     Switched to a new branch 'fingerprint_2011-05-22_14-57-32_fp'

Restore a set of commits by parsing a build log that contains the `sync-all`
log output

     $ ./utils/fingerprint/fingerprint.py restore -l build.log
     == libraries/filepath git checkout 92d211a2752fe8827582ae0d97efd18722ad3d87
     HEAD is now at 92d211a... Update source repo location to be the git repo 
in .cabal file
     <snip>
     Switched to a new branch 'fingerprint_build_log'

-David

On May 19, 2011, at 7:05 AM, Erik de Castro Lopo wrote:

Edward Z. Yang wrote:

What might also be pretty useful is a global "checkout a commit from
before this time",

I believe this to be doable. I'm working on a tool for it.

which would also work even in the case of missing
build logs (we should also publish a log of build log hashes, so you
can have some record of known good builds).

Having successful builds record the git hash of all repos would
be a great thing to have in future.

Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc


_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to