Commit 2c390120 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Fix bug where contraints where lost for case insensitive package matches

E.g. cabal install cabal-1.8.0.6 would actually install the latest version
instead, because when 'cabal' got corrected to 'Cabal' the associated
constraint 'cabal == 1.8.0.6' was not converted to 'Cabal == 1.8.0.6'.
parent 5c9d97c5
......@@ -574,7 +574,9 @@ disambiguatePackageTargets availablePkgIndex availableExtra targets =
pkgname userTarget)
Ambiguous pkgnames -> Left (PackageNameAmbigious
pkgname pkgnames userTarget)
Unambiguous pkgname' -> Right (NamedPackage pkgname' constraints)
Unambiguous pkgname' -> Right (NamedPackage pkgname' constraints')
where
constraints' = map (renamePackageConstraint pkgname') constraints
-- use any extra specific available packages to help us disambiguate
packageNameEnv :: PackageNameEnv
......@@ -682,6 +684,13 @@ userToPackageConstraint uc = case uc of
UserConstraintSource name -> PackageConstraintSource name
UserConstraintFlags name flags -> PackageConstraintFlags name flags
renamePackageConstraint :: PackageName -> PackageConstraint -> PackageConstraint
renamePackageConstraint name pc = case pc of
PackageConstraintVersion _ ver -> PackageConstraintVersion name ver
PackageConstraintInstalled _ -> PackageConstraintInstalled name
PackageConstraintSource _ -> PackageConstraintSource name
PackageConstraintFlags _ flags -> PackageConstraintFlags name flags
readUserConstraint :: String -> Either String UserConstraint
readUserConstraint str =
case readPToMaybe parse str of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment