This commit is contained in:
Michael Snoyman 2012-11-25 08:49:13 +02:00
parent 9d74f661de
commit 5697fdd417
3 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
module Stackage.LoadDatabase where
import qualified Codec.Archive.Tar as Tar
@ -43,8 +44,11 @@ loadPackageDB core deps = do
lbs <- L.readFile tarName
addEntries mempty $ Tar.read lbs
where
addEntries :: PackageDB -> Tar.Entries Tar.FormatError -> IO PackageDB
#if MIN_VERSION_tar(0, 4, 0)
addEntries _ (Tar.Fail e) = throwIO e
#else
addEntries _ (Tar.Fail e) = error e
#endif
addEntries db Tar.Done = return db
addEntries db (Tar.Next e es) = addEntry db e >>= flip addEntries es

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
module Stackage.Tarballs
( makeTarballs
) where
@ -26,7 +27,11 @@ makeTarballs ii = do
createDirectoryIfMissing True $ takeDirectory extraTar
L.writeFile extraTar $ Tar.write extraEntries
where
#if MIN_VERSION_tar(0, 4, 0)
loop _ _ (Tar.Fail err) = throwIO err
#else
loop _ _ (Tar.Fail err) = error err
#endif
loop stable extra Tar.Done = return (stable [], extra [])
loop stable extra (Tar.Next e es) =
loop stable' extra' es

View File

@ -30,7 +30,7 @@ library
build-depends: base >= 4 && < 5
, containers
, Cabal
, tar >= 0.4
, tar >= 0.3
, bytestring
, directory
, filepath