Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/af358a62fcf9d2117ffb26eeb05b3c3993fd8797

>---------------------------------------------------------------

commit af358a62fcf9d2117ffb26eeb05b3c3993fd8797
Author: Pepe Iborra <[email protected]>
Date:   Mon May 21 09:44:21 2007 +0000

    Be more verbose in Update

>---------------------------------------------------------------

 .../src/Network/Hackage/CabalInstall/Fetch.hs      |    3 ++-
 .../src/Network/Hackage/CabalInstall/Update.hs     |    7 ++++++-
 .../src/Network/Hackage/CabalInstall/Utils.hs      |    8 ++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/cabal-install/src/Network/Hackage/CabalInstall/Fetch.hs 
b/cabal-install/src/Network/Hackage/CabalInstall/Fetch.hs
index 025bc2c..4c4934d 100644
--- a/cabal-install/src/Network/Hackage/CabalInstall/Fetch.hs
+++ b/cabal-install/src/Network/Hackage/CabalInstall/Fetch.hs
@@ -38,6 +38,7 @@ import Network.Hackage.CabalInstall.Config (packagesDirectory)
 import Network.Hackage.CabalInstall.Dependency (filterFetchables, 
resolveDependencies)
 
 import Distribution.Package (PackageIdentifier(..), showPackageId)
+import Distribution.Verbosity
 import System.FilePath ((</>), (<.>))
 import System.Directory (copyFile)
 import System.IO (IOMode(..), hPutStr, Handle, hClose, openBinaryFile)
@@ -87,7 +88,7 @@ downloadFile path url
 -- Downloads a package to [config-dir/packages/package-id] and returns the 
path to the package.
 downloadPackage :: ConfigFlags -> PackageIdentifier -> String -> IO String
 downloadPackage cfg pkg url
-    = do message (configOutputGen cfg) 2 $ "GET " ++ show url
+    = do message (configOutputGen cfg) verbose $ "GET " ++ show url
          mbError <- downloadFile path url
          case mbError of
            Just err -> fail $ printf "Failed to download '%s': %s" 
(showPackageId pkg) (show err)
diff --git a/cabal-install/src/Network/Hackage/CabalInstall/Update.hs 
b/cabal-install/src/Network/Hackage/CabalInstall/Update.hs
index c54f250..c9bf4b9 100644
--- a/cabal-install/src/Network/Hackage/CabalInstall/Update.hs
+++ b/cabal-install/src/Network/Hackage/CabalInstall/Update.hs
@@ -17,6 +17,7 @@ module Network.Hackage.CabalInstall.Update
 import Network.Hackage.CabalInstall.Types (ConfigFlags (..), OutputGen(..), 
PkgInfo(..))
 import Network.Hackage.CabalInstall.Config (writeKnownPackages)
 import Network.Hackage.CabalInstall.TarUtils (extractTarFile, tarballGetFiles)
+import Network.Hackage.CabalInstall.Utils (isVerbose)
 import Network.Hackage.CabalInstall.Fetch (downloadIndex, packagesDirectory)
 
 import Distribution.Package (PackageIdentifier(..), pkgName, showPackageId)
@@ -24,10 +25,12 @@ import Distribution.PackageDescription 
(PackageDescription(..), readPackageDescr
 import Distribution.Verbosity
 import System.FilePath ((</>), joinPath, addExtension, takeExtension)
 
-import Control.Monad (liftM)
+import Control.Monad (liftM, when)
 import Data.List (intersperse, isSuffixOf)
 import Data.Version (showVersion)
 
+import Text.Printf
+
 -- | 'update' downloads the package list from all known servers
 update :: ConfigFlags -> IO ()
 update cfg =
@@ -36,6 +39,7 @@ update cfg =
               indexPath <- downloadIndex cfg server
               extractTarFile tarPath indexPath
               contents <- tarballGetFiles tarPath indexPath
+              when (isVerbose cfg) $ printf "Retrieved %d package 
descriptions\n" (length contents)
               let packageDir = packagesDirectory cfg
                   cabalFiles = [ packageDir </> path
                                | path <- contents
@@ -45,6 +49,7 @@ update cfg =
               packageDescriptions <-
                   mapM (readPackageDescription v') cabalFiles
               return $ map (parsePkg server) packageDescriptions
+       when (isVerbose cfg) $ printf "Processed %d package descriptions\n" 
(length packages)
        writeKnownPackages cfg packages
     where servers = configServers cfg
           output = configOutputGen cfg
diff --git a/cabal-install/src/Network/Hackage/CabalInstall/Utils.hs 
b/cabal-install/src/Network/Hackage/CabalInstall/Utils.hs
new file mode 100644
index 0000000..af7b773
--- /dev/null
+++ b/cabal-install/src/Network/Hackage/CabalInstall/Utils.hs
@@ -0,0 +1,8 @@
+module Network.Hackage.CabalInstall.Utils where
+
+import Distribution.Verbosity
+import Network.Hackage.CabalInstall.Types
+
+
+
+isVerbose cfg = configVerbose cfg >= verbose
\ No newline at end of file



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to