[commit: Cabal] master: Hide the installed instance when installing the local package. (55f07e8)
Paolo Capriotti
p.capriotti at gmail.com
Tue May 8 00:01:49 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/55f07e8f9a6908b6a86bf706840b24f4a2fa78c7
>---------------------------------------------------------------
commit 55f07e8f9a6908b6a86bf706840b24f4a2fa78c7
Author: Duncan Coutts <duncan at haskell.org>
Date: Tue May 6 13:32:36 2008 +0000
Hide the installed instance when installing the local package.
Otherwise the dependency resolver may decide to pick the installed
instance of the package but we really do want to install the local
version. So to remove that choice from the dep resolver we just
delete it from the installed package index.
>---------------------------------------------------------------
cabal-install/Hackage/Install.hs | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/cabal-install/Hackage/Install.hs b/cabal-install/Hackage/Install.hs
index 6dbb78e..560dc49 100644
--- a/cabal-install/Hackage/Install.hs
+++ b/cabal-install/Hackage/Install.hs
@@ -138,9 +138,11 @@ installLocalPackage verbosity packageDB repos comp conf miscOptions configFlags
installed <- getInstalledPackages verbosity comp packageDB conf
available <- fmap mconcat (mapM (IndexUtils.readRepoIndex verbosity) repos)
let -- The trick is, we add the local package to the available index and
- -- then ask to resolve a dependency on exactly that package. So the
- -- resolver ends up having to pick the local package.
+ -- remove it from the installed index. Then we ask to resolve a
+ -- dependency on exactly that package. So the resolver ends up having
+ -- to pick the local package.
available' = PackageIndex.insert localPackage available
+ installed' = PackageIndex.delete (packageId localPackage) `fmap` installed
localPackage = AvailablePackage {
packageInfoId = packageId desc,
Available.packageDescription = desc,
@@ -157,7 +159,7 @@ installLocalPackage verbosity packageDB repos comp conf miscOptions configFlags
-- info verbosity $ unlines (map (" "++) (concat details))
info verbosity "Resolving dependencies..."
case resolveDependencies buildOS buildArch (compilerId comp)
- installed available' [localDependency] of
+ installed' available' [localDependency] of
Left missing -> die $ "Unresolved dependencies: " ++ showDependencies missing
Right installPlan -> do
when (verbosity >= verbose || dryRun miscOptions) $
More information about the Cvs-libraries
mailing list