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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/040956358da23a525b4cd3a526735da40c71c566

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

commit 040956358da23a525b4cd3a526735da40c71c566
Author: Duncan Coutts <[email protected]>
Date:   Mon Feb 16 18:14:24 2009 +0000

    Add warnings in the case that no remote servers have been specified
    It's not strictly an error but it can be rather confusing.

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

 cabal-install/Distribution/Client/IndexUtils.hs |    7 +++++++
 cabal-install/Distribution/Client/Update.hs     |    5 ++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/cabal-install/Distribution/Client/IndexUtils.hs 
b/cabal-install/Distribution/Client/IndexUtils.hs
index 9ec714f..caa2e49 100644
--- a/cabal-install/Distribution/Client/IndexUtils.hs
+++ b/cabal-install/Distribution/Client/IndexUtils.hs
@@ -72,6 +72,13 @@ import System.Time
 -- This is a higher level wrapper used internally in cabal-install.
 --
 getAvailablePackages :: Verbosity -> [Repo] -> IO AvailablePackageDb
+getAvailablePackages verbosity [] = do
+  warn verbosity $ "No remote package servers have been specified. Usually "
+                ++ "you would have one specified in the config file."
+  return AvailablePackageDb {
+    packageIndex       = mempty,
+    packagePreferences = mempty
+  }
 getAvailablePackages verbosity repos = do
   info verbosity "Reading available packages..."
   pkgss <- mapM (readRepoIndex verbosity) repos
diff --git a/cabal-install/Distribution/Client/Update.hs 
b/cabal-install/Distribution/Client/Update.hs
index 77143e1..96f15e8 100644
--- a/cabal-install/Distribution/Client/Update.hs
+++ b/cabal-install/Distribution/Client/Update.hs
@@ -29,7 +29,7 @@ import qualified Paths_cabal_install
 import Distribution.Package
          ( PackageName(..), packageId, packageVersion )
 import Distribution.Simple.Utils
-         ( notice, comparing )
+         ( warn, notice, comparing )
 import Distribution.Verbosity
          ( Verbosity )
 
@@ -40,6 +40,9 @@ import Data.List (maximumBy)
 
 -- | 'update' downloads the package list from all known servers
 update :: Verbosity -> [Repo] -> IO ()
+update verbosity [] = do
+  warn verbosity $ "No remote package servers have been specified. Usually "
+                ++ "you would have one specified in the config file."
 update verbosity repos = do
   mapM_ (updateRepo verbosity) repos
   checkForSelfUpgrade verbosity repos



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

Reply via email to