From 430dc2d20bef7bcb744bc1b095689d46d578826b Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Wed, 25 Aug 2021 20:13:17 +0200 Subject: [PATCH] Remove zip dependency --- cabal.project | 2 +- ghcup.cabal | 1 - lib/GHCup/Utils.hs | 9 ++------- stack.yaml | 4 +++- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/cabal.project b/cabal.project index bbc95b2..224e03a 100644 --- a/cabal.project +++ b/cabal.project @@ -16,7 +16,7 @@ source-repository-package source-repository-package type: git location: https://github.com/hasufell/libarchive - tag: 024a7e8ab7b4d3848dc64dca1e70a04831eedc99 + tag: 8587aab78dd515928024ecd82c8f215e06db85cd constraints: http-io-streams -brotli diff --git a/ghcup.cabal b/ghcup.cabal index 4c1d676..c6ba0ed 100644 --- a/ghcup.cabal +++ b/ghcup.cabal @@ -135,7 +135,6 @@ library , versions >=4.0.1 && <5.1 , word8 ^>=0.1.3 , yaml ^>=0.11.4.0 - , zip ^>=1.7.1 , zlib ^>=0.6.2.2 if (flag(internal-downloader) && !os(windows)) diff --git a/lib/GHCup/Utils.hs b/lib/GHCup/Utils.hs index 7971762..9717cbf 100644 --- a/lib/GHCup/Utils.hs +++ b/lib/GHCup/Utils.hs @@ -40,7 +40,6 @@ import GHCup.Utils.Prelude import GHCup.Utils.String.QQ import Codec.Archive hiding ( Directory ) -import Codec.Archive.Zip import Control.Applicative import Control.Exception.Safe import Control.Monad @@ -628,8 +627,7 @@ unpackToDir dfp av = do | ".tar.bz2" `isSuffixOf` fn -> liftE (untar . BZip.decompress =<< rf av) | ".tar" `isSuffixOf` fn -> liftE (untar =<< rf av) - | ".zip" `isSuffixOf` fn -> - withArchive av (unpackInto dfp) + | ".zip" `isSuffixOf` fn -> liftE (untar =<< rf av) | otherwise -> throwE $ UnknownArchive fn @@ -658,10 +656,7 @@ getArchiveFiles av = do | ".tar.bz2" `isSuffixOf` fn -> liftE (entries . BZip.decompress =<< rf av) | ".tar" `isSuffixOf` fn -> liftE (entries =<< rf av) - | ".zip" `isSuffixOf` fn -> - withArchive av $ do - entries' <- getEntries - pure $ fmap unEntrySelector $ Map.keys entries' + | ".zip" `isSuffixOf` fn -> liftE (entries =<< rf av) | otherwise -> throwE $ UnknownArchive fn diff --git a/stack.yaml b/stack.yaml index fcef979..cecb2e7 100644 --- a/stack.yaml +++ b/stack.yaml @@ -9,6 +9,9 @@ extra-deps: - git: https://github.com/hasufell/libarchive commit: 024a7e8ab7b4d3848dc64dca1e70a04831eedc99 + - git: https://github.com/hasufell/libarchive + commit: 8587aab78dd515928024ecd82c8f215e06db85cd + - brick-0.64@sha256:f03fa14607c22cf48af99e24c44f79a0fb073f7ec229f15e969fed9ff73c93f6,16530 - IfElse-0.85@sha256:6939b94acc6a55f545f63a168a349dd2fbe4b9a7cca73bf60282db5cc6aa47d2,445 - ascii-string-1.0.1.4@sha256:fa34f1d9ba57e8e89c0d4c9cef5e01ba32cb2d4373d13f92dcc0b531a6c6749b,2582 @@ -41,7 +44,6 @@ extra-deps: - streamly-posix-0.1.0.1@sha256:5d89b806281035d34020387ed99dde1ddab282c7ed66df3b7cd010b38fd3517b,2138 - strict-base-0.4.0.0@sha256:2ff4e43cb95eedf2995558d7fc34d19362846413dd39e6aa6a5b3ea8228fef9f,1248 - xor-0.0.1.0@sha256:f8362b4a68562b9afbcd727ff64c1a303970df3a032e0033d2f4c094c3501df3,2243 - - zip-1.7.1@sha256:0ce03d0fbffba47c1ab6fbb9166f8ba5373d828d78587df21b7e9d7bb150f929,3918 flags: http-io-streams: