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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/2628f71e0d655031629df86a30792c12cd163092

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

commit 2628f71e0d655031629df86a30792c12cd163092
Author: Duncan Coutts <[email protected]>
Date:   Mon May 10 03:24:57 2010 +0000

    Update world file entries ignoring version constraints
    Otherwise it is easy to add impossible constraints to the world file.
    cabal install 'foo > 1' && cabal install 'foo < 1'
    Would give us a world file with both constraints.

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

 cabal-install/Distribution/Client/World.hs |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cabal-install/Distribution/Client/World.hs 
b/cabal-install/Distribution/Client/World.hs
index 1c9f117..3708033 100644
--- a/cabal-install/Distribution/Client/World.hs
+++ b/cabal-install/Distribution/Client/World.hs
@@ -48,10 +48,9 @@ import System.IO.Error( isDoesNotExistError, )
 import qualified Data.ByteString.Lazy.Char8 as B
 import Prelude hiding ( getContents )
 
-
 -- | Adds packages to the world file; creates the file if it doesn't 
--- exist yet. Flag assignments for a package are updated if already 
--- present. IO errors are non-fatal.
+-- exist yet. Version constraints and flag assignments for a package are
+-- updated if already present. IO errors are non-fatal.
 insert :: Verbosity -> Bool -> FilePath -> [UnresolvedDependency] -> IO ()
 insert = modifyWorld $ unionBy equalUDep
 
@@ -64,7 +63,8 @@ delete = modifyWorld $ flip (deleteFirstsBy equalUDep)
 -- | UnresolvedDependency values are considered equal if they refer to
 -- the same package, i.e., we don't care about differing versions or flags.
 equalUDep :: UnresolvedDependency -> UnresolvedDependency -> Bool
-equalUDep u1 u2 = dependency u1 == dependency u2
+equalUDep (UnresolvedDependency (Dependency pkg1 _) _)
+          (UnresolvedDependency (Dependency pkg2 _) _) = pkg1 == pkg2
 
 -- | Modifies the world file by applying an update-function ('unionBy'
 -- for 'insert', 'deleteFirstsBy' for 'delete') to the given list of



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

Reply via email to