on master help sign in
tar 0.3 support without CPP
commit8ab54e67ac760457e8f638ce9d0987d86282b604 authorMichael Snoyman <michael@snoyman.com> dateSun 25 Nov 2012, 08:59 (14 years ago) parent5697fdd
2 files changed+3−12
Stackage/LoadDatabase.hs+1−6 Stackage/Tarballs.hs+2−6
Stackage/LoadDatabase.hs+1−6
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21module Stackage.LoadDatabase where
32
43import qualified Codec.Archive.Tar as Tar
@@ -44,11 +43,7 @@ loadPackageDB core deps = do
4443 lbs <- L.readFile tarName
4544 addEntries mempty $ Tar.read lbs
4645 where
47−#if MIN_VERSION_tar(0, 4, 0)
48− addEntries _ (Tar.Fail e) = throwIO e
49−#else
50− addEntries _ (Tar.Fail e) = error e
51−#endif
46+ addEntries _ (Tar.Fail e) = error $ show e
5247 addEntries db Tar.Done = return db
5348 addEntries db (Tar.Next e es) = addEntry db e >>= flip addEntries es
5449
Stackage/Tarballs.hs+2−6
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21module Stackage.Tarballs
32 ( makeTarballs
43 ) where
@@ -27,11 +26,8 @@ makeTarballs ii = do
2726 createDirectoryIfMissing True $ takeDirectory extraTar
2827 L.writeFile extraTar $ Tar.write extraEntries
2928 where
30−#if MIN_VERSION_tar(0, 4, 0)
31− loop _ _ (Tar.Fail err) = throwIO err
32−#else
33− loop _ _ (Tar.Fail err) = error err
34−#endif
29+ -- Using "error . show" for compatibility with tar 0.3 and 0.4
30+ loop _ _ (Tar.Fail err) = error $ show err
3531 loop stable extra Tar.Done = return (stable [], extra [])
3632 loop stable extra (Tar.Next e es) =
3733 loop stable' extra' es