[commit: Cabal] master: fix small bug in Hackage.Tar (fd13b8f)
Paolo Capriotti
p.capriotti at gmail.com
Tue May 8 00:00:38 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/fd13b8fc49851b567c0d41b6308b7de166233643
>---------------------------------------------------------------
commit fd13b8fc49851b567c0d41b6308b7de166233643
Author: Andrea Vezzosi <sanzhiyan at gmail.com>
Date: Thu Mar 20 15:13:22 2008 +0000
fix small bug in Hackage.Tar
The baseDir was passed instead of the full path.
>---------------------------------------------------------------
cabal-install/Hackage/Tar.hs | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/cabal-install/Hackage/Tar.hs b/cabal-install/Hackage/Tar.hs
index fca5be0..d0dd49b 100644
--- a/cabal-install/Hackage/Tar.hs
+++ b/cabal-install/Hackage/Tar.hs
@@ -214,8 +214,8 @@ createTarGzFile :: FilePath -- ^ Full Tarball path
createTarGzFile tarFile baseDir sourceDir = do
(entries,hs) <- fmap unzip
. mapM (unsafeInterleaveIO
- . createTarEntry baseDir
- . makeRelative baseDir)
+ . (\path -> createTarEntry path
+ $ makeRelative baseDir path))
=<< recurseDirectories [baseDir </> sourceDir]
BS.writeFile tarFile . GZip.compress . entries2Archive $ entries
mapM_ hClose (catMaybes hs) -- TODO: the handles are explicitly closed because of a bug in bytestring-0.9.0.1,
@@ -243,7 +243,9 @@ entries2Archive :: [TarEntry] -> ByteString
entries2Archive es = BS.concat $ (map putTarEntry es) ++ [BS.replicate (512*2) 0]
-- TODO: It needs to return the handle only because of the hack in createTarGzFile
-createTarEntry :: FilePath -> FilePath -> IO (TarEntry,Maybe Handle)
+createTarEntry :: FilePath -- ^ path to find the file
+ -> FilePath -- ^ path to use for the TarHeader
+ -> IO (TarEntry,Maybe Handle)
createTarEntry path relpath =
do ftype <- getFileType path
let tarpath = nativePathToTarPath ftype relpath
More information about the Cvs-libraries
mailing list