[commit: Cabal] master: Fix for marking reverse deps of failed packages (f824e4d)
Ian Lynagh
igloo at earth.li
Fri Jun 24 01:55:08 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/f824e4d222b52f8615cb530ca3be205926951702
>---------------------------------------------------------------
commit f824e4d222b52f8615cb530ca3be205926951702
Author: Duncan Coutts <duncan at haskell.org>
Date: Wed Jun 4 12:52:17 2008 +0000
Fix for marking reverse deps of failed packages
The reverse deps may have already failed due to depending on another
failed package. So do not assume all reverse deps are in the
configured state. If they are in the failed state then ignore them.
>---------------------------------------------------------------
cabal-install/Hackage/InstallPlan.hs | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/cabal-install/Hackage/InstallPlan.hs b/cabal-install/Hackage/InstallPlan.hs
index 8da4e3d..befccbd 100644
--- a/cabal-install/Hackage/InstallPlan.hs
+++ b/cabal-install/Hackage/InstallPlan.hs
@@ -234,8 +234,8 @@ failed pkgid buildResult buildResult' plan = assert (invariant plan') plan'
failures = PackageIndex.fromList
$ Failed pkg buildResult
: [ Failed pkg' buildResult'
- | pkgid' <- packagesThatDependOn plan pkgid
- , let pkg' = lookupConfiguredPackage plan pkgid' ]
+ | Just pkg' <- map (lookupConfiguredPackage' plan)
+ $ packagesThatDependOn plan pkgid ]
-- | lookup the reachable packages in the reverse dependency graph
--
@@ -252,8 +252,17 @@ lookupConfiguredPackage :: InstallPlan a
lookupConfiguredPackage plan pkgid =
case PackageIndex.lookupPackageId (planIndex plan) pkgid of
Just (Configured pkg) -> pkg
- Just _ -> error $ "InstallPlan: not configured " ++ display pkgid
- Nothing -> error $ "InstallPlan: no such package " ++ display pkgid
+ _ -> internalError $ "not configured or no such pkg " ++ display pkgid
+
+-- | lookup a package that we expect to be in the configured or failed state
+--
+lookupConfiguredPackage' :: InstallPlan a
+ -> PackageIdentifier -> Maybe ConfiguredPackage
+lookupConfiguredPackage' plan pkgid =
+ case PackageIndex.lookupPackageId (planIndex plan) pkgid of
+ Just (Configured pkg) -> Just pkg
+ Just (Failed _ reason) -> Nothing
+ _ -> internalError $ "not configured or no such pkg " ++ display pkgid
-- ------------------------------------------------------------
-- * Checking valididy of plans
More information about the Cvs-libraries
mailing list