[commit: Cabal] master: Minor improvements to InstallPlan documentation and error reporting (adf8e86)
Ian Lynagh
igloo at earth.li
Fri Jun 24 01:53:18 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/adf8e866d0f25d093624910fe4541fb6be74b196
>---------------------------------------------------------------
commit adf8e866d0f25d093624910fe4541fb6be74b196
Author: Duncan Coutts <duncan at haskell.org>
Date: Tue May 6 23:59:05 2008 +0000
Minor improvements to InstallPlan documentation and error reporting
>---------------------------------------------------------------
cabal-install/Hackage/InstallPlan.hs | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/cabal-install/Hackage/InstallPlan.hs b/cabal-install/Hackage/InstallPlan.hs
index de4783e..0684f47 100644
--- a/cabal-install/Hackage/InstallPlan.hs
+++ b/cabal-install/Hackage/InstallPlan.hs
@@ -158,6 +158,9 @@ invariant :: InstallPlan a -> Bool
invariant plan =
valid (planOS plan) (planArch plan) (planCompiler plan) (planIndex plan)
+internalError :: String -> a
+internalError msg = error $ "InstallPlan: internal error: " ++ msg
+
-- | Build an installation plan from a valid set of resolved packages.
--
new :: OS -> Arch -> CompilerId -> PackageIndex (PlanPackage a)
@@ -175,7 +178,8 @@ done :: InstallPlan buildResult -> Bool
done (InstallPlan { planIndex = index}) =
null [ () | Configured _ <- PackageIndex.allPackages index ]
--- | The next package, meaning a package which has no dependencies.
+-- | The next package, meaning a package which has all its dependencies
+-- installed already.
--
-- * The graph must not be 'done'.
--
@@ -187,14 +191,17 @@ next plan@(InstallPlan { planIndex = index }) = assert (invariant plan) $
, flip all (depends pkg) $ \dep ->
case PackageIndex.lookupPackageId index dep of
Just (Configured _) -> False
- Just (Failed _ _) -> False
+ Just (Failed _ _) -> internalError depOnFailed
Just (PreExisting _) -> True
Just (Installed _) -> True
- Nothing -> error "InstallPlan.next: incomplete install plan" ]
+ Nothing -> internalError incomplete ]
in case allReadyPackages of
- [] -> error $ "InstallPlan.next: internal error: no nodes with 0-outdegree\n"
- ++ unlines (map (display . packageId) (PackageIndex.allPackages index))
+ [] -> internalError noNextPkg
(pkg:_) -> pkg
+ where
+ incomplete = "install plan is not closed"
+ noNextPkg = "no configured pkg with all installed deps"
+ depOnFailed = "configured package depends on failed package"
-- | Marks a package in the graph as completed. Also saves the build result for
-- the completed package in the plan.
@@ -342,6 +349,10 @@ closed = null . PackageIndex.brokenPackages
consistent :: PackageIndex (PlanPackage a) -> Bool
consistent = null . PackageIndex.dependencyInconsistencies
+-- | A 'ConfiguredPackage' is valid if the flag assignment is total and if
+-- in the configuration given by the flag assignment, all the package
+-- dependencies are satisfied by the specified packages.
+--
configuredPackageValid :: OS -> Arch -> CompilerId -> ConfiguredPackage -> Bool
configuredPackageValid os arch comp pkg =
null (configuredPackageProblems os arch comp pkg)
More information about the Cvs-libraries
mailing list