File tree Expand file tree Collapse file tree 4 files changed +21
-18
lines changed Expand file tree Collapse file tree 4 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ test-suite hackage-tests
155155 , base-orphans >= 0.6 && < 0.10
156156 , clock >= 0.8 && < 0.9
157157 , optparse-applicative >= 0.13.2.0 && < 0.19
158- , tar >= 0.5.0.3 && < 0.7
158+ , tar >= 0.5.0.3 && < 0.8
159159 , tree-diff >= 0.1 && < 0.4
160160
161161 ghc-options : -Wall -rtsopts -threaded
Original file line number Diff line number Diff line change @@ -250,7 +250,7 @@ library
250250 , process >= 1.2.3.0 && < 1.7
251251 , random >= 1.2 && < 1.4
252252 , stm >= 2.0 && < 2.6
253- , tar >= 0.5.0.3 && < 0.7
253+ , tar >= 0.5.0.3 && < 0.8
254254 , time >= 1.5.0.1 && < 1.16
255255 , zlib >= 0.5.3 && < 0.8
256256 , hackage-security >= 0.6.2.0 && < 0.7
Original file line number Diff line number Diff line change 44{- FOURMOLU_DISABLE -}
55module Distribution.Client.Compat.Tar
66 ( extractTarGzFile
7+ , createTarGzFile
78#if MIN_VERSION_tar(0,6,0)
89 , Tar. Entry
910 , Tar. Entries
@@ -27,6 +28,7 @@ import qualified Codec.Archive.Tar.Check as Tar
2728#else
2829import qualified Codec.Archive.Tar.Entry as Tar
2930#endif
31+ import qualified Codec.Compression.GZip as GZip
3032import qualified Data.ByteString.Lazy as BS
3133import qualified Distribution.Client.GZipUtils as GZipUtils
3234
@@ -65,4 +67,20 @@ extractTarGzFile dir expected tar =
6567 . Tar. read
6668 . GZipUtils. maybeDecompress
6769 =<< BS. readFile tar
70+
71+ createTarGzFile
72+ :: FilePath
73+ -- ^ Full Tarball path
74+ -> FilePath
75+ -- ^ Base directory
76+ -> FilePath
77+ -- ^ Directory to archive, relative to base dir
78+ -> IO ()
79+ createTarGzFile tar base dir =
80+ #if MIN_VERSION_tar(0,7,0)
81+ BS. writeFile tar . GZip. compress =<< Tar. write' =<< Tar. pack' base [dir]
82+ #else
83+ BS. writeFile tar . GZip. compress . Tar. write =<< Tar. pack base [dir]
84+ #endif
85+
6886{- FOURMOLU_ENABLE -}
Original file line number Diff line number Diff line change 1717-- Reading, writing and manipulating \"@.tar@\" archive files.
1818module Distribution.Client.Tar
1919 ( -- * @tar.gz@ operations
20- createTarGzFile
20+ TarComp. createTarGzFile
2121 , TarComp. extractTarGzFile
2222
2323 -- * Other local utils
@@ -34,8 +34,6 @@ import Prelude ()
3434
3535import qualified Codec.Archive.Tar as Tar
3636import qualified Codec.Archive.Tar.Entry as Tar
37- import qualified Codec.Compression.GZip as GZip
38- import qualified Data.ByteString.Lazy as BS
3937import qualified Distribution.Client.Compat.Tar as TarComp
4038
4139-- for foldEntries...
@@ -45,19 +43,6 @@ import Control.Exception (throw)
4543
4644-- * High level operations
4745
48- --
49-
50- createTarGzFile
51- :: FilePath
52- -- ^ Full Tarball path
53- -> FilePath
54- -- ^ Base directory
55- -> FilePath
56- -- ^ Directory to archive, relative to base dir
57- -> IO ()
58- createTarGzFile tar base dir =
59- BS. writeFile tar . GZip. compress . Tar. write =<< Tar. pack base [dir]
60-
6146-- | Type code for the local build tree reference entry type. We don't use the
6247-- symbolic link entry type because it allows only 100 ASCII characters for the
6348-- path.
You can’t perform that action at this time.
0 commit comments