Commit f9d92527 authored by Abhinav Gupta's avatar Abhinav Gupta
Browse files

Adjust message for `cabal update` with multiple remote-repos

parent 7d8a9792
......@@ -391,7 +391,7 @@ parsePreferredVersions = mapMaybe simpleParse
updatePackageIndexCacheFile :: Verbosity -> FilePath -> FilePath -> IO ()
updatePackageIndexCacheFile verbosity indexFile cacheFile = do
info verbosity "Updating the index cache file..."
info verbosity ("Updating index cache file " ++ cacheFile)
(mkPkgs, prefs) <- either fail return
. parsePackageIndex
. maybeDecompress
......
......@@ -33,6 +33,7 @@ import Distribution.Verbosity
import qualified Data.ByteString.Lazy as BS
import Distribution.Client.GZipUtils (maybeDecompress)
import System.FilePath (dropExtension)
import Data.Either (lefts)
-- | 'update' downloads the package list from all known servers
update :: Verbosity -> [Repo] -> IO ()
......@@ -41,6 +42,15 @@ update verbosity [] =
++ "you would have one specified in the config file."
update verbosity repos = do
jobCtrl <- newParallelJobControl
let remoteRepos = lefts (map repoKind repos)
case remoteRepos of
[] -> return ()
[remoteRepo] ->
notice verbosity $ "Downloading the latest package list from "
++ remoteRepoName remoteRepo
_ -> notice verbosity . unlines
$ "Downloading the latest package lists from: "
: map (("- " ++) . remoteRepoName) remoteRepos
mapM_ (spawnJob jobCtrl . updateRepo verbosity) repos
mapM_ (\_ -> collectJob jobCtrl) repos
......@@ -48,8 +58,6 @@ updateRepo :: Verbosity -> Repo -> IO ()
updateRepo verbosity repo = case repoKind repo of
Right LocalRepo -> return ()
Left remoteRepo -> do
notice verbosity $ "Downloading the latest package list from "
++ remoteRepoName remoteRepo
downloadResult <- downloadIndex verbosity remoteRepo (repoLocalDir repo)
case downloadResult of
FileAlreadyInCache -> return ()
......
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