Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal

On branch  : 

http://hackage.haskell.org/trac/ghc/changeset/d9e161d5f7f5340663e8c3aa30a34601eeab6d92

>---------------------------------------------------------------

commit d9e161d5f7f5340663e8c3aa30a34601eeab6d92
Author: Duncan Coutts <[email protected]>
Date:   Sun Oct 5 05:19:19 2008 +0000

    Handle constraints on paired packages
    The trick is that when applying constraints to paired
    packages, the constraint has to exclude both packages at
    once. We exclude the pair together or not at all. If it
    would only exclude one then we discard the constraint.

>---------------------------------------------------------------

 .../Client/Dependency/TopDown/Constraints.hs       |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git 
a/cabal-install/Distribution/Client/Dependency/TopDown/Constraints.hs 
b/cabal-install/Distribution/Client/Dependency/TopDown/Constraints.hs
index b08f11c..158eeb8 100644
--- a/cabal-install/Distribution/Client/Dependency/TopDown/Constraints.hs
+++ b/cabal-install/Distribution/Client/Dependency/TopDown/Constraints.hs
@@ -245,8 +245,15 @@ constrain (TaggedDependency installedConstraint 
(Dependency name versionRange))
   satisfiesConstraint pkg = satisfiesVersionConstraint pkg
                          && satisfiesInstallStateConstraint pkg
 
-  satisfiesVersionConstraint pkg =
-    packageVersion pkg `withinRange` versionRange
+  satisfiesVersionConstraint :: Package pkg => pkg -> Bool
+  satisfiesVersionConstraint = case Map.lookup name paired of
+    Nothing       -> \pkg ->
+      packageVersion pkg `withinRange` versionRange
+    Just (v1, v2) -> \pkg -> case packageVersion pkg of
+      v | v == v1
+       || v == v2   -> v1 `withinRange` versionRange
+                    || v2 `withinRange` versionRange
+        | otherwise -> v `withinRange` versionRange
 
   satisfiesInstallStateConstraint = case installedConstraint of
     NoInstalledConstraint -> \_   -> True



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to