Commit 38189542 authored by bjorn@bringert.net's avatar bjorn@bringert.net
Browse files

Replace zlib use by compression.

parent de2fbfaa
......@@ -7,5 +7,3 @@
- Overhaul verbosity
- Figure out command-line interface
- Get rid of zlib dependency
......@@ -15,7 +15,7 @@ Build-depends: base, mtl, network, regex-compat,
filepath >= 1.0,
Cabal>=1.3,
HTTP >= 3000.0 && < 3000.1,
zlib >= 0.3
compression >= 0.1
Extra-Source-Files: copyright README
Executable: cabal-install
......
-- | Simplistic TAR archive reading. Only gets the file names and file contents.
module Network.Hackage.CabalInstall.Tar (TarHeader(..), TarFileType(..),
readTarArchive, extractTarArchive,
extractTarGzFile) where
extractTarGzFile, gunzip) where
import qualified Data.ByteString.Lazy.Char8 as BS
import Data.ByteString.Lazy.Char8 (ByteString)
......@@ -15,7 +15,8 @@ import System.Directory (Permissions(..), setPermissions, createDirectoryIfMissi
import System.FilePath ((</>), isValid, isAbsolute)
import System.Posix.Types (FileMode)
import Codec.Compression.GZip (decompress)
--import Codec.Compression.GZip (decompress)
import Codec.Compression.GZip.GUnZip (gunzip)
data TarHeader = TarHeader {
tarFileName :: FilePath,
......@@ -43,7 +44,7 @@ extractTarGzFile :: Maybe FilePath -- ^ Destination directory
-> FilePath -- ^ Tarball
-> IO ()
extractTarGzFile mdir file =
BS.readFile file >>= extractTarArchive mdir . readTarArchive . decompress
BS.readFile file >>= extractTarArchive mdir . readTarArchive . gunzip
--
-- * Extracting
......
......@@ -17,13 +17,13 @@ module Network.Hackage.CabalInstall.Update
import Network.Hackage.CabalInstall.Types (ConfigFlags (..), PkgInfo(..), Repo(..))
import Network.Hackage.CabalInstall.Utils (isVerbose)
import Network.Hackage.CabalInstall.Fetch (downloadIndex, packagesDirectory)
import Network.Hackage.CabalInstall.Tar (gunzip)
import Distribution.Package (PackageIdentifier(..), pkgName, showPackageId)
import Distribution.PackageDescription (PackageDescription(..), readPackageDescription, GenericPackageDescription(..))
import Distribution.Verbosity
import System.FilePath ((</>), joinPath, addExtension, takeExtension, dropExtension)
import Codec.Compression.GZip(decompress)
import Control.Monad (liftM, when)
import qualified Data.ByteString.Lazy.Char8 as BS
import Data.ByteString.Lazy.Char8 (ByteString)
......@@ -41,4 +41,4 @@ updateRepo :: ConfigFlags
updateRepo cfg repo =
do printf "Downloading package list from server '%s'\n" (repoURL repo)
indexPath <- downloadIndex cfg repo
BS.readFile indexPath >>= BS.writeFile (dropExtension indexPath) . decompress
BS.readFile indexPath >>= BS.writeFile (dropExtension indexPath) . gunzip
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment