ztar 1.0.1 → 1.0.2
raw patch · 4 files changed
+36/−21 lines, 4 filesdep +quickcheck-instancesdep −bytestring-arbitrarydep ~bytestringdep ~directorydep ~filepath
Dependencies added: quickcheck-instances
Dependencies removed: bytestring-arbitrary
Dependency ranges changed: bytestring, directory, filepath, path, zip, zlib
Files
- CHANGELOG.md +5/−0
- src/Codec/Archive/ZTar/Zip.hs +14/−10
- test/Test.hs +2/−2
- ztar.cabal +15/−9
CHANGELOG.md view
@@ -1,3 +1,8 @@+# ztar 1.0.2++Changes:+* Support GHC 8.8+ # ztar 1.0.1 Changes:
src/Codec/Archive/ZTar/Zip.hs view
@@ -18,7 +18,6 @@ ) where import qualified Codec.Archive.Zip as Zip-import Control.Monad.IO.Class (liftIO) import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as BS import System.Directory@@ -57,21 +56,26 @@ -> IO () create archive base paths = do archive' <- makeAbsolute archive- withCurrentDirectory base $ Zip.createArchive archive' $ mapM_ insert paths+ withCurrentDirectory base $ do+ files <- concatMapM search paths+ Zip.createArchive archive' $ mapM_ insertFile files where- insert path = do- isFile <- liftIO $ doesFileExist path- isDir <- liftIO $ doesDirectoryExist path+ search :: FilePath -> IO [FilePath]+ search path = do+ isFile <- doesFileExist path+ isDir <- doesDirectoryExist path if- | isFile -> insertFile path- | isDir -> insertDir path+ | isFile -> pure [path]+ | isDir -> searchDir path | otherwise -> fail $ "Path does not exist: " ++ path+ searchDir :: FilePath -> IO [FilePath]+ searchDir path =+ let mkPath = if path == "." then id else (path </>)+ in concatMapM (search . mkPath) =<< listDirectory path insertFile path = do path' <- Zip.mkEntrySelector path Zip.loadEntry Zip.BZip2 path' path- insertDir path =- let mkPath = if path == "." then id else (path </>)- in mapM_ (insert . mkPath) =<< liftIO (listDirectory path)+ concatMapM f = fmap concat . mapM f -- | Extract all the files contained in an archive compressed with Zip. --
test/Test.hs view
@@ -3,7 +3,6 @@ import Codec.Archive.ZTar import Control.Monad (forM, forM_) import qualified Data.ByteString as BS-import Data.ByteString.Arbitrary (ArbByteString(..)) import Data.List (isPrefixOf, nub) import Data.Maybe (fromJust) import Path@@ -22,6 +21,7 @@ import Path.IO (doesFileExist, ensureDir, isLocationOccupied, withTempDir) import qualified System.FilePath.Windows as Windows import Test.QuickCheck+import Test.QuickCheck.Instances.ByteString () import Test.QuickCheck.Monadic import Test.Tasty (defaultMain, testGroup) import Test.Tasty.QuickCheck (testProperty)@@ -103,7 +103,7 @@ isFile <- frequency [(1, pure False), (2^depth, pure True)] if isFile then do- Blind (ABS contents) <- arbitrary+ Blind contents <- arbitrary return [(dir `maybeSlash` toRelFile path, contents)] else mkFileTree (Just $ dir `maybeSlash` toRelDir path) (depth + 1)
ztar.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.31.0.+-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: 242b04032aa88690bdb786125bbc85e9393c89e0716e9ead63a5d95782012508+-- hash: 82a4fc42cc2601b991a1fb8edadcf461fd3def11a3e5f7b82e3449c34de83942 name: ztar-version: 1.0.1+version: 1.0.2 synopsis: Creating and extracting arbitrary archives description: Creating and extracting arbitrary archives. category: Codec@@ -49,16 +49,18 @@ , deepseq , directory >=1.3 && <1.4 , filepath >=1.4.1 && <1.5- , path >=0.5 && <0.7+ , path >=0.5 && <0.8 , process , text , unix-compat- , zip >=1.0 && <1.3+ , zip >=1.0 && <1.4 , zlib >=0.6 && <0.7 if flag(dev) ghc-options: -Werror if impl(ghc >= 8.0)- ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances+ ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances+ if impl(ghc <= 8.6)+ ghc-options: -Wnoncanonical-monadfail-instances default-language: Haskell2010 test-suite example@@ -75,7 +77,9 @@ if flag(dev) ghc-options: -Werror if impl(ghc >= 8.0)- ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances+ ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances+ if impl(ghc <= 8.6)+ ghc-options: -Wnoncanonical-monadfail-instances default-language: Haskell2010 test-suite ztar-test@@ -88,15 +92,17 @@ QuickCheck , base , bytestring- , bytestring-arbitrary , filepath , path , path-io+ , quickcheck-instances , tasty , tasty-quickcheck , ztar if flag(dev) ghc-options: -Werror if impl(ghc >= 8.0)- ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances+ ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances+ if impl(ghc <= 8.6)+ ghc-options: -Wnoncanonical-monadfail-instances default-language: Haskell2010