[commit: Cabal] master: Fix constraint set handling for installed constraints (436558c)
Ian Lynagh
igloo at earth.li
Fri Jun 24 02:01:19 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/436558c19ac9b8c82e87c151911bb0bde35adfc9
>---------------------------------------------------------------
commit 436558c19ac9b8c82e87c151911bb0bde35adfc9
Author: Duncan Coutts <duncan at haskell.org>
Date: Fri Dec 19 18:23:28 2008 +0000
Fix constraint set handling for installed constraints
A rather subtle bug. The code was actually correct but the transitionsTo
assertion was not accounting for a transition between the case where
a package's available version had been excluded and then the whole thing
got excluded by a version constraint. It counted one side as a loss
without a corresponding gain on the other side.
>---------------------------------------------------------------
.../Client/Dependency/TopDown/Constraints.hs | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/cabal-install/Distribution/Client/Dependency/TopDown/Constraints.hs b/cabal-install/Distribution/Client/Dependency/TopDown/Constraints.hs
index 46d946b..25475b3 100644
--- a/cabal-install/Distribution/Client/Dependency/TopDown/Constraints.hs
+++ b/cabal-install/Distribution/Client/Dependency/TopDown/Constraints.hs
@@ -102,6 +102,9 @@ transitionsTo constraints @(Constraints available _ excluded )
availableGained = [ pkg | OnlyInRight pkg <- availableChange ]
excludedLost = [ pkg | OnlyInLeft pkg <- excludedChange ]
excludedGained = [ pkg | OnlyInRight pkg <- excludedChange ]
+ ++ [ pkg | InBoth (ExcludedPackage _ (_:_) [])
+ pkg@(ExcludedPackage _ (_:_) (_:_))
+ <- excludedChange ]
availableChange = mergeBy (\a b -> packageId a `compare` packageId b)
(PackageIndex.allPackages available)
(PackageIndex.allPackages available')
@@ -199,7 +202,7 @@ constrain (TaggedDependency installedConstraint (Dependency name versionRange))
= id
update pkg = case pkg of
InstalledOnly _ -> id
- AvailableOnly _ -> error "impossible" -- PackageIndex.deletePackageId (packageId pkg)
+ AvailableOnly _ -> PackageIndex.deletePackageId (packageId pkg)
InstalledAndAvailable i _ -> PackageIndex.insert (InstalledOnly i)
-- Applying the constraint means adding exclusions for the packages that
@@ -215,7 +218,7 @@ constrain (TaggedDependency installedConstraint (Dependency name versionRange))
= Nothing
| otherwise = case pkg of
InstalledOnly _ -> Nothing
- AvailableOnly _ -> Just (ExcludedPackage pkgid [reason] [])
+ AvailableOnly _ -> Just (ExcludedPackage pkgid [] [reason])
InstalledAndAvailable _ _ ->
case PackageIndex.lookupPackageId excluded pkgid of
Just (ExcludedPackage _ avail both)
More information about the Cvs-libraries
mailing list