
On Fri, Jul 1, 2011 at 5:37 PM, Gwern Branwen
Looking at it, the index tarball contains the .cabal files for all versions known to Hackage, which isn't necessarily the interesting set of cabal files - I'm usually more interested in just the cabal files of the latest version of every package. No doubt there's a scripting solution (loop over the untarred directory of packages, and take the lexically last cabal file?), but it was easier to just exploit cabal fetch's behavior of fetching only the latest version and work with those tarballs.
The version using just the index tarball is kind of ugly; the filtering and extracting doesn't seem terribly easy, so the best script I could come up with was: cd ~/.cabal/packages/hackage.haskell.org && for DIR in */; do (for CABAL in `tar --wildcards "$DIR" -tf 00-index.tar|head -1`; do (tar -Oxf 00-index.tar $CABAL | runhaskell ~/deps.hs); done); done (Parentheses aren't necessary but make it more readable.) -- gwern http://www.gwern.net