packages feed

zip 1.2.0 → 1.3.0

raw patch · 9 files changed

+97/−51 lines, 9 filesdep −semigroupsdep ~base

Dependencies removed: semigroups

Dependency ranges changed: base

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+## Zip 1.3.0++* Dropped support for GHC 8.2 and older.++* Added a Cabal flag `-fdisable-bzip2` to remove the bzip2 C library+  dependency and hence support for BZip2 entries.+ ## Zip 1.2.0  * Added the `setExternalFileAttrs` function and the `edExternalFileAttrs`
Codec/Archive/Zip.hs view
@@ -1,6 +1,6 @@ -- | -- Module      :  Codec.Archive.Zip--- Copyright   :  © 2016–2018 Mark Karpov+-- Copyright   :  © 2016–present Mark Karpov -- License     :  BSD 3 clause -- -- Maintainer  :  Mark Karpov <markkarpov92@gmail.com>
Codec/Archive/Zip/CP437.hs view
@@ -1,6 +1,6 @@ -- | -- Module      :  Codec.Archive.Zip.CP437--- Copyright   :  © 2016–2018 Mark Karpov+-- Copyright   :  © 2016–present Mark Karpov -- License     :  BSD 3 clause -- -- Maintainer  :  Mark Karpov <markkarpov92@gmail.com>
Codec/Archive/Zip/Internal.hs view
@@ -1,6 +1,6 @@ -- | -- Module      :  Codec.Archive.Zip.Internal--- Copyright   :  © 2016–2018 Mark Karpov+-- Copyright   :  © 2016–present Mark Karpov -- License     :  BSD 3 clause -- -- Maintainer  :  Mark Karpov <markkarpov92@gmail.com>@@ -55,7 +55,9 @@ import System.IO import qualified Data.ByteString     as B import qualified Data.Conduit        as C+#ifdef ENABLE_BZIP2 import qualified Data.Conduit.BZlib  as BZ+#endif import qualified Data.Conduit.Binary as CB import qualified Data.Conduit.List   as CL import qualified Data.Conduit.Zlib   as Z@@ -499,8 +501,12 @@         dataSink       Deflate -> withCompression $         Z.compress 9 (Z.WindowBits (-15)) .| dataSink+#ifdef ENABLE_BZIP2       BZip2   -> withCompression $         BZ.bzip2 .| dataSink+#else+      BZip2   -> throwM BZip2Unsupported+#endif   return DataDescriptor     { ddCRC32            = fromIntegral crc32     , ddCompressedSize   = compressedSize@@ -1014,7 +1020,11 @@   -> ConduitT ByteString ByteString m () decompressingPipe Store   = C.awaitForever C.yield decompressingPipe Deflate = Z.decompress $ Z.WindowBits (-15)+#ifdef ENABLE_BZIP2 decompressingPipe BZip2   = BZ.bunzip2+#else+decompressingPipe BZip2   = throwM BZip2Unsupported+#endif  -- | Sink that calculates CRC32 check sum for incoming stream. 
Codec/Archive/Zip/Type.hs view
@@ -1,6 +1,6 @@ -- | -- Module      :  Codec.Archive.Zip.Type--- Copyright   :  © 2016–2018 Mark Karpov+-- Copyright   :  © 2016–present Mark Karpov -- License     :  BSD 3 clause -- -- Maintainer  :  Mark Karpov <markkarpov92@gmail.com>@@ -9,6 +9,7 @@ -- -- Types used by the package. +{-# LANGUAGE CPP                #-} {-# LANGUAGE DeriveDataTypeable #-}  module Codec.Archive.Zip.Type@@ -192,6 +193,13 @@     -- ^ Thrown when you try to get contents of non-existing entry   | ParsingFailed FilePath String     -- ^ Thrown when archive structure cannot be parsed+#ifndef ENABLE_BZIP2+  | BZip2Unsupported+    -- ^ Thrown when attempting to decompress a 'BZip2' entry and the+    -- library is compiled without support for it.+    --+    -- @since 1.3.0+#endif   deriving (Eq, Ord, Typeable)  instance Show ZipException where@@ -199,5 +207,10 @@     "No such entry found: " ++ show s ++ " in " ++ show file   show (ParsingFailed file msg) =     "Parsing of archive structure failed: \n" ++ msg ++ "\nin " ++ show file+#ifndef ENABLE_BZIP2+  show BZip2Unsupported =+    "Encountered a zipfile entry with BZip2 compression, but " +++    "the zip library has been built with bzip2 disabled."+#endif  instance Exception ZipException
LICENSE.md view
@@ -1,4 +1,4 @@-Copyright © 2016–2018 Mark Karpov+Copyright © 2016–present Mark Karpov  All rights reserved. 
README.md view
@@ -22,11 +22,11 @@ * [License](#license)  This is a feature-rich, memory-efficient, and type-safe library to-manipulate Zip archives in Haskell. The library is the most complete and-efficient implementation of .ZIP specification in pure Haskell (at least-from open-sourced ones). In particular, it's created with large multimedia-data in mind and provides all features users might expect, comparable in-terms of feature-set with libraries like `libzip` in C.+manipulate Zip archives. The library is the most complete and efficient+implementation of .ZIP specification in Haskell (at least from open-sourced+ones). In particular, it's created with large multimedia data in mind and+provides all features users might expect, comparable in terms of feature-set+with libraries like `libzip` in C.  ## Why this library is written @@ -43,21 +43,19 @@ simple to use. However it creates Zip archives purely, as `ByteStrings`s in memory that you can then write to the file system. This is not acceptable if you work with more-or-less big data. For example, if you have collection of-files with total size of 500 MB and you want to pack them into an archive,-you can easily consume up to 1 GB of memory (the files plus resulting-archive). Not always you can afford to do this or do this at scale. Even if-you want just to look at list of archive entries it will read it into memory-in all its entirety. For my use-case it's not acceptable.+files with total size of 500 MB and you want to pack them into archive, you+can easily consume up to 1 GB of memory (the files plus resulting archive).+Not always you can afford to do this or do this at scale. Even if you want+just to look at list of archive entries it will read it into memory in all+its entirety.  ### LibZip -This is a binding to C-library [`libzip`](https://en.wikipedia.org/wiki/Libzip). There is always a-certain kind of trouble when you are using bindings. For example, you need-to take care that target library is installed and its version is compatible-with the version of your binding. Yes, this means additional headaches. It-should be just “plug and play”, but now you need to watch out for-compatibility.+This is a binding to C library [`libzip`][libzip]. There is always a certain+kind of trouble with bindings. For example, you need to take care that+target library is installed and its version is compatible with the version+of your binding. Yes, this means additional headaches. It should be just+“plug and play”, but now you need to watch out for compatibility.  It's not that bad with libraries that do not break their API for years, but it's not the case with `libzip`. As the maintainer of `LibZip` puts it:@@ -72,10 +70,10 @@ version of the library from Stackage, and I don't yet know what will be on the server. -After much frustration with all these things I decided to avoid using of+After much frustration with all these things I decided to avoid using `LibZip`, because after all, this is not that sort of a project that-shouldn't be done in pure Haskell. By rewriting this in Haskell, I also can-make it safer to use.+shouldn't be done completely in Haskell. By rewriting this in Haskell, I+also can make it safer to use.  ### zip-conduit @@ -84,22 +82,22 @@ feature-rich and has certain problems (including programming style, it uses `error` if an entry is missing in archive, among other things), some of them are reported on its issue tracker. It also does not appear to be maintained-(the last sign of activity was on December 23, 2014).+(last sign of activity was on December 23, 2014).  ## Features  The library supports all features specified in the modern .ZIP specification except for encryption and multi-disk archives. See more about this below. -For reference, here is a [copy of the specification](https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.3.TXT).+For reference, here is a [copy of the specification][specification].  ### Compression methods  `zip` supports the following compression methods:  * Store (no compression, just store files “as is”)-* [DEFLATE](https://en.wikipedia.org/wiki/DEFLATE)-* [Bzip2](https://en.wikipedia.org/wiki/Bzip2)+* [DEFLATE](deflate)+* [Bzip2](bzip2)  The best way to add a new compression method to the library is to write a conduit that will do the compression and publish it as a library. `zip` can@@ -134,7 +132,8 @@ when anything from this list takes place:  * Total size of archive is greater than 4 GB.-* Size of compressed/uncompressed file in archive is greater than 4 GB.+* Size of a single compressed/uncompressed file in archive is greater than 4+  GB. * There are more than 65535 entries in archive.  The library is particularly suited for processing of large files. For@@ -270,13 +269,18 @@  ## Contribution -You can contact the maintainer via-[the issue tracker](https://github.com/mrkkrp/zip/issues).+You can contact the maintainer via [the issue+tracker](https://github.com/mrkkrp/zip/issues). -Pull requests are also welcome and will be reviewed quickly.+Pull requests are also welcome.  ## License -Copyright © 2016–2018 Mark Karpov+Copyright © 2016–present Mark Karpov  Distributed under BSD 3 clause license.++[libzip]: https://en.wikipedia.org/wiki/Libzip+[specification]: https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.3.TXT+[deflate]: https://en.wikipedia.org/wiki/DEFLATE+[bzip2]: https://en.wikipedia.org/wiki/Bzip2
tests/Main.hs view
@@ -37,8 +37,8 @@ import qualified Data.Text.Encoding      as T import qualified System.FilePath         as FP -#if !MIN_VERSION_base(4,11,0)-import Data.Monoid+#if !MIN_VERSION_base(4,13,0)+import Data.Semigroup ((<>)) #endif  -- | Zip tests. Please note that Zip64 feature is not currently tested@@ -88,7 +88,13 @@   arbitrary = B.pack <$> listOf arbitrary  instance Arbitrary CompressionMethod where-  arbitrary = elements [Store, Deflate, BZip2]+  arbitrary = elements+    [ Store+    , Deflate+#ifdef ENABLE_BZIP2+    , BZip2+#endif+    ]  instance Arbitrary UTCTime where   arbitrary = UTCTime
zip.cabal view
@@ -1,7 +1,7 @@ name:                 zip-version:              1.2.0+version:              1.3.0 cabal-version:        1.18-tested-with:          GHC==8.0.2, GHC==8.2.2, GHC==8.4.3+tested-with:          GHC==8.4.4, GHC==8.6.5, GHC==8.8.1 license:              BSD3 license-file:         LICENSE.md author:               Mark Karpov <markkarpov92@gmail.com>@@ -20,15 +20,19 @@   manual:             True   default:            False +flag disable-bzip2+  description:         Removes dependency on bzip2 C library and hence support for BZip2 entries.+  default:             False+  manual:              True+ library-  build-depends:      base             >= 4.9     && < 5.0+  build-depends:      base             >= 4.11    && < 5.0                     , bytestring       >= 0.9     && < 0.11-                    , bzlib-conduit    >= 0.3     && < 0.4                     , case-insensitive >= 1.2.0.2 && < 1.3                     , cereal           >= 0.3     && < 0.6                     , conduit          >= 1.3     && < 1.4                     , conduit-extra    >= 1.3     && < 1.4-                    , containers       >= 0.5.6.2 && < 0.6+                    , containers       >= 0.5     && < 0.7                     , digest           < 0.1                     , directory        >= 1.2.2   && < 1.4                     , dlist            >= 0.8     && < 0.9@@ -38,11 +42,11 @@                     , mtl              >= 2.0     && < 3.0                     , resourcet        >= 1.2     && < 1.3                     , text             >= 0.2     && < 1.3-                    , time             >= 1.4     && < 1.9+                    , time             >= 1.4     && < 1.10                     , transformers     >= 0.4     && < 0.6                     , transformers-base-  if !impl(ghc >= 8.0)-    build-depends:    semigroups       >= 0.16+  if !flag(disable-bzip2)+    build-depends:    bzlib-conduit    >= 0.3     && < 0.4   exposed-modules:    Codec.Archive.Zip                     , Codec.Archive.Zip.CP437   other-modules:      Codec.Archive.Zip.Internal@@ -52,21 +56,22 @@                       -Wincomplete-record-updates                       -Wincomplete-uni-patterns                       -Wnoncanonical-monad-instances-                      -Wnoncanonical-monadfail-instances     cpp-options:      -DHASKELL_ZIP_DEV_MODE   else     ghc-options:      -O2 -Wall+  if !flag(disable-bzip2)+    cpp-options:      -DENABLE_BZIP2   default-language:   Haskell2010  test-suite tests   main-is:            Main.hs   hs-source-dirs:     tests   type:               exitcode-stdio-1.0-  build-depends:      base             >= 4.9     && < 5.0+  build-depends:      base             >= 4.11    && < 5.0                     , QuickCheck       >= 2.4     && < 3.0                     , bytestring       >= 0.9     && < 0.11                     , conduit          >= 1.3     && < 1.4-                    , containers       >= 0.5.6.2 && < 0.6+                    , containers       >= 0.5     && < 0.7                     , directory        >= 1.2.2   && < 1.4                     , dlist            >= 0.8     && < 0.9                     , exceptions       >= 0.6     && < 0.11@@ -74,13 +79,15 @@                     , hspec            >= 2.0     && < 3.0                     , temporary        >= 1.1     && < 1.4                     , text             >= 0.2     && < 1.3-                    , time             >= 1.4     && < 1.9+                    , time             >= 1.4     && < 1.10                     , transformers     >= 0.4     && < 0.6                     , zip   if flag(dev)     ghc-options:      -O0 -Wall -Werror   else     ghc-options:      -O2 -Wall+  if !flag(disable-bzip2)+    cpp-options:      -DENABLE_BZIP2   default-language:   Haskell2010  source-repository head@@ -90,7 +97,7 @@ executable haskell-zip-app   main-is:            Main.hs   hs-source-dirs:     bench-app-  build-depends:      base             >= 4.7 && < 5.0+  build-depends:      base             >= 4.11 && < 5.0                     , filepath         >= 1.2 && < 1.5                     , zip   if flag(dev)@@ -98,7 +105,6 @@                       -Wincomplete-record-updates                       -Wincomplete-uni-patterns                       -Wnoncanonical-monad-instances-                      -Wnoncanonical-monadfail-instances   else     ghc-options:      -O2 -Wall   default-language:   Haskell2010