hackage mirror fix
File: howto/setup-hackage-mirror [Diff]
-- a/howto/setup-hackage-mirror++ b/howto/setup-hackage-mirror
@@ -2,19 +2,21 @@
1. @cd@ to a clean directory where you want your hackage mirror to be
2. Download a tarball with latest hackage contents from [http://hackage.haskell.org/cgi-bin/hackage-scripts/archive.tar] package index:
bc. wget http://hackage.haskell.org/cgi-bin/hackage-scripts/archive.tar -O /tmp http://hackage.haskell.org/packages/archive/00-index.tar.gz
3. This archive package index contains .cabal files of all packages in tar.gz's placed in folders (@HAppS-Server/0.9.3.1/HAppS-Server-0.9.3.1.tar.gz@), which should be placed in @package@ subdirectory that are available on server. hackage in /packages/archive/$package/$version/$package-$version.tar.gz. However, if this is an exception for hackage.haskell.org, added and maintained by some moron. If your mirror hostname host is not @hackage.haskell.org@ (*UGLY UGLY HACK GODDAMN WHOEVER DONE IT*), cabal will request not @package/HAppS-Server/0.9.3.1/HAppS-Server-0.9.3.1.tar.gz@, but just @package/HAppS-Server-0.9.3.1.tar.gz@. So, we need different, you have to transform file paths:
bc. tar xf /tmp/archive.tar --transform 's|^.*/|package/|'
4. Download package index: serve them as /package/$package-$version.tar.gz. So, here's a shell script that downloads and places them for you:
bc. for splitpk in `tar tf 00-index.tar.gz | cut -d/ -f 2,3`; do
pk=`echo $splitpk | sed 's|/|-|'`
if [ ! -a package/$name ]; then
wget http://hackage.haskell.org/packages/archive/00-index.tar.gz http://hackage.haskell.org/packages/archive/$splitpk/$name -O package/$name
That is all! You can serve this directory as hackage mirror mirror.
Here's a shell script that does it all for you: [http://gist.github.com/562813]