mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-02-08 12:27:27 +01:00
tar 0.3 support without CPP
This commit is contained in:
parent
5697fdd417
commit
8ab54e67ac
@ -1,4 +1,3 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
|
||||||
module Stackage.LoadDatabase where
|
module Stackage.LoadDatabase where
|
||||||
|
|
||||||
import qualified Codec.Archive.Tar as Tar
|
import qualified Codec.Archive.Tar as Tar
|
||||||
@ -44,11 +43,7 @@ loadPackageDB core deps = do
|
|||||||
lbs <- L.readFile tarName
|
lbs <- L.readFile tarName
|
||||||
addEntries mempty $ Tar.read lbs
|
addEntries mempty $ Tar.read lbs
|
||||||
where
|
where
|
||||||
#if MIN_VERSION_tar(0, 4, 0)
|
addEntries _ (Tar.Fail e) = error $ show e
|
||||||
addEntries _ (Tar.Fail e) = throwIO e
|
|
||||||
#else
|
|
||||||
addEntries _ (Tar.Fail e) = error e
|
|
||||||
#endif
|
|
||||||
addEntries db Tar.Done = return db
|
addEntries db Tar.Done = return db
|
||||||
addEntries db (Tar.Next e es) = addEntry db e >>= flip addEntries es
|
addEntries db (Tar.Next e es) = addEntry db e >>= flip addEntries es
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
|
||||||
module Stackage.Tarballs
|
module Stackage.Tarballs
|
||||||
( makeTarballs
|
( makeTarballs
|
||||||
) where
|
) where
|
||||||
@ -27,11 +26,8 @@ makeTarballs ii = do
|
|||||||
createDirectoryIfMissing True $ takeDirectory extraTar
|
createDirectoryIfMissing True $ takeDirectory extraTar
|
||||||
L.writeFile extraTar $ Tar.write extraEntries
|
L.writeFile extraTar $ Tar.write extraEntries
|
||||||
where
|
where
|
||||||
#if MIN_VERSION_tar(0, 4, 0)
|
-- Using "error . show" for compatibility with tar 0.3 and 0.4
|
||||||
loop _ _ (Tar.Fail err) = throwIO err
|
loop _ _ (Tar.Fail err) = error $ show err
|
||||||
#else
|
|
||||||
loop _ _ (Tar.Fail err) = error err
|
|
||||||
#endif
|
|
||||||
loop stable extra Tar.Done = return (stable [], extra [])
|
loop stable extra Tar.Done = return (stable [], extra [])
|
||||||
loop stable extra (Tar.Next e es) =
|
loop stable extra (Tar.Next e es) =
|
||||||
loop stable' extra' es
|
loop stable' extra' es
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user