Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cabal-tests/Cabal-tests.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ test-suite hackage-tests
, base-orphans >=0.6 && <0.10
, clock >=0.8 && <0.9
, optparse-applicative >=0.13.2.0 && <0.19
, tar >=0.5.0.3 && <0.7
, tar >=0.5.0.3 && <0.8
, tree-diff >=0.1 && <0.4

ghc-options: -Wall -rtsopts -threaded
Expand Down
2 changes: 1 addition & 1 deletion cabal-install/cabal-install.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ library
, process >= 1.2.3.0 && < 1.7
, random >= 1.2 && < 1.4
, stm >= 2.0 && < 2.6
, tar >= 0.5.0.3 && < 0.7
, tar >= 0.5.0.3 && < 0.8
, time >= 1.5.0.1 && < 1.16
, zlib >= 0.5.3 && < 0.8
, hackage-security >= 0.6.2.0 && < 0.7
Expand Down
18 changes: 18 additions & 0 deletions cabal-install/src/Distribution/Client/Compat/Tar.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{- FOURMOLU_DISABLE -}
module Distribution.Client.Compat.Tar
( extractTarGzFile
, createTarGzFile
#if MIN_VERSION_tar(0,6,0)
, Tar.Entry
, Tar.Entries
Expand All @@ -27,6 +28,7 @@ import qualified Codec.Archive.Tar.Check as Tar
#else
import qualified Codec.Archive.Tar.Entry as Tar
#endif
import qualified Codec.Compression.GZip as GZip
import qualified Data.ByteString.Lazy as BS
import qualified Distribution.Client.GZipUtils as GZipUtils

Expand Down Expand Up @@ -65,4 +67,20 @@ extractTarGzFile dir expected tar =
. Tar.read
. GZipUtils.maybeDecompress
=<< BS.readFile tar

createTarGzFile
:: FilePath
-- ^ Full Tarball path
-> FilePath
-- ^ Base directory
-> FilePath
-- ^ Directory to archive, relative to base dir
-> IO ()
createTarGzFile tar base dir =
#if MIN_VERSION_tar(0,7,0)
BS.writeFile tar . GZip.compress =<< Tar.write' =<< Tar.pack' base [dir]
#else
BS.writeFile tar . GZip.compress . Tar.write =<< Tar.pack base [dir]
#endif

{- FOURMOLU_ENABLE -}
17 changes: 1 addition & 16 deletions cabal-install/src/Distribution/Client/Tar.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
-- Reading, writing and manipulating \"@.tar@\" archive files.
module Distribution.Client.Tar
( -- * @tar.gz@ operations
createTarGzFile
TarComp.createTarGzFile
, TarComp.extractTarGzFile

-- * Other local utils
Expand All @@ -34,8 +34,6 @@ import Prelude ()

import qualified Codec.Archive.Tar as Tar
import qualified Codec.Archive.Tar.Entry as Tar
import qualified Codec.Compression.GZip as GZip
import qualified Data.ByteString.Lazy as BS
import qualified Distribution.Client.Compat.Tar as TarComp

-- for foldEntries...
Expand All @@ -45,19 +43,6 @@ import Control.Exception (throw)

-- * High level operations

--

createTarGzFile
:: FilePath
-- ^ Full Tarball path
-> FilePath
-- ^ Base directory
-> FilePath
-- ^ Directory to archive, relative to base dir
-> IO ()
createTarGzFile tar base dir =
BS.writeFile tar . GZip.compress . Tar.write =<< Tar.pack base [dir]

-- | Type code for the local build tree reference entry type. We don't use the
-- symbolic link entry type because it allows only 100 ASCII characters for the
-- path.
Expand Down
Loading