[commit: Cabal] master: fix small bug in Hackage.Tar (80625d6)
Ian Lynagh
igloo at earth.li
Fri Jun 24 01:52:06 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/80625d6a11c0fc16efd90e6320f170cd9df6870a
>---------------------------------------------------------------
commit 80625d6a11c0fc16efd90e6320f170cd9df6870a
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