Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal On branch : master
http://hackage.haskell.org/trac/ghc/changeset/4eebb48b149774716827c10c23182669a00dce2a >--------------------------------------------------------------- commit 4eebb48b149774716827c10c23182669a00dce2a Author: Duncan Coutts <[email protected]> Date: Sat Nov 22 16:30:26 2008 +0000 Use a more general fix for "cabal install base" It's not specific to LHC. Normally we prevent upgrading of base since it's unlikely to work and would normally be accidental. However when the user explicitly asks to upgrade base then we let them do that and they can keep the pieces when it breaks. >--------------------------------------------------------------- cabal-install/Distribution/Client/Dependency.hs | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cabal-install/Distribution/Client/Dependency.hs b/cabal-install/Distribution/Client/Dependency.hs index 86cc587..83a36c2 100644 --- a/cabal-install/Distribution/Client/Dependency.hs +++ b/cabal-install/Distribution/Client/Dependency.hs @@ -43,7 +43,7 @@ import Distribution.Package import Distribution.Version ( VersionRange(AnyVersion), orLaterVersion ) import Distribution.Compiler - ( CompilerId(..), CompilerFlavor(LHC) ) + ( CompilerId(..) ) import Distribution.System ( OS, Arch ) import Distribution.Simple.Utils (comparing) @@ -142,9 +142,12 @@ hideBrokenPackages index = check p x = assert (p x) x hideBasePackage :: Package p => PackageIndex p -> PackageIndex p -hideBasePackage = PackageIndex.deletePackageName (PackageName "base") +hideBasePackage = PackageIndex.deletePackageName basePackage . PackageIndex.deletePackageName (PackageName "ghc-prim") +basePackage :: PackageName +basePackage = PackageName "base" + dependencyResolver :: DependencyResolver -> OS -> Arch -> CompilerId @@ -155,9 +158,16 @@ dependencyResolver -> Progress String String InstallPlan dependencyResolver resolver os arch comp installed available pref deps = let installed' = hideBrokenPackages installed - available' = case comp of -- Ugly hack to support LHC. - CompilerId LHC _ -> available - _ -> hideBasePackage available + -- If the user is not explicitly asking to upgrade base then lets + -- prevent that from happening accidentally since it is usually not what + -- you want and it probably does not work anyway. We do it by hiding the + -- available versions of it. That forces the dep solver to pick the + -- installed version(s). + available' | all (not . isBase) deps = hideBasePackage available + | otherwise = available + where isBase (UnresolvedDependency (Dependency pkg _) _) = + pkg == basePackage + in fmap toPlan $ resolver os arch comp installed' available' preference deps _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
