Commit 27f9895c authored by Duncan Coutts's avatar Duncan Coutts

Rename the constructors of PackageConstraint to be more consistent

parent 748fe144
......@@ -142,12 +142,12 @@ planLocalPackage verbosity comp configFlags configExFlags installedPkgIndex
. addConstraints
-- version constraints from the config file or command line
[ PackageVersionConstraint name ver
[ PackageConstraintVersion name ver
| Dependency name ver <- configConstraints configFlags ]
. addConstraints
-- package flags from the config file or command line
[ PackageFlagsConstraint (packageName pkg)
[ PackageConstraintFlags (packageName pkg)
(configConfigurationsFlags configFlags) ]
$ standardInstallPolicy
......
......@@ -185,7 +185,7 @@ dontUpgradeBasePackage params =
addConstraints extraConstraints params
where
extraConstraints =
[ PackageInstalledConstraint pkgname
[ PackageConstraintInstalled pkgname
| all (/=PackageName "base") (depResolverTargets params)
, pkgname <- [ PackageName "base", PackageName "ghc-prim" ]
, isInstalled pkgname ]
......@@ -416,7 +416,7 @@ resolveWithoutDependencies (DepResolverParams targets constraints
Map.findWithDefault anyVersion pkgname packageVersionConstraintMap
packageVersionConstraintMap =
Map.fromList [ (name, range)
| PackageVersionConstraint name range <- constraints ]
| PackageConstraintVersion name range <- constraints ]
packagePreferences :: PackageName -> PackagePreferences
packagePreferences = interpretPackagesPreference
......
......@@ -295,10 +295,10 @@ addTopLevelTargets (pkg:pkgs) cs =
addTopLevelConstraints :: [PackageConstraint] -> Constraints
-> Progress Log Failure Constraints
addTopLevelConstraints [] cs = Done cs
addTopLevelConstraints (PackageFlagsConstraint _ _ :deps) cs =
addTopLevelConstraints (PackageConstraintFlags _ _ :deps) cs =
addTopLevelConstraints deps cs
addTopLevelConstraints (PackageVersionConstraint pkg ver:deps) cs =
addTopLevelConstraints (PackageConstraintVersion pkg ver:deps) cs =
case addTopLevelVersionConstraint pkg ver cs of
Satisfiable cs' pkgids ->
foldr (Step . Exclude) (addTopLevelConstraints deps cs') pkgids
......@@ -309,7 +309,7 @@ addTopLevelConstraints (PackageVersionConstraint pkg ver:deps) cs =
ConflictsWith conflicts ->
Fail (TopLevelVersionConstraintConflict pkg ver conflicts)
addTopLevelConstraints (PackageInstalledConstraint pkg:deps) cs =
addTopLevelConstraints (PackageConstraintInstalled pkg:deps) cs =
case addTopLevelInstalledConstraint pkg cs of
Satisfiable cs' pkgids ->
foldr (Step . Exclude) (addTopLevelConstraints deps cs') pkgids
......@@ -417,7 +417,7 @@ annotateSourcePackages constraints dfsNumber sourcePkgIndex =
flagsFor = fromMaybe [] . flip Map.lookup flagsMap
flagsMap = Map.fromList
[ (name, flags)
| PackageFlagsConstraint name flags <- constraints ]
| PackageConstraintFlags name flags <- constraints ]
-- | One of the heuristics we use when guessing which path to take in the
-- search space is an ordering on the choices we make. It's generally better
......
......@@ -63,9 +63,9 @@ type DependencyResolver = Platform
-- range or inconsistent flag assignment).
--
data PackageConstraint
= PackageVersionConstraint PackageName VersionRange
| PackageInstalledConstraint PackageName
| PackageFlagsConstraint PackageName FlagAssignment
= PackageConstraintVersion PackageName VersionRange
| PackageConstraintInstalled PackageName
| PackageConstraintFlags PackageName FlagAssignment
deriving (Show,Eq)
-- | A per-package preference on the version. It is a soft constraint that the
......
......@@ -241,13 +241,13 @@ planPackages comp configFlags configExFlags installFlags
. addConstraints
-- version constraints from the config file or command line
[ PackageVersionConstraint name ver
[ PackageConstraintVersion name ver
| Dependency name ver <- configConstraints configFlags ]
. addConstraints
--FIXME: this just applies all flags to all targets which
-- is silly. We should check if the flags are appropriate
[ PackageFlagsConstraint (pkgSpecifierTarget pkgSpecifier) flags
[ PackageConstraintFlags (pkgSpecifierTarget pkgSpecifier) flags
| let flags = configConfigurationsFlags configFlags
, not (null flags)
, pkgSpecifier <- pkgSpecifiers ]
......
......@@ -194,7 +194,7 @@ info verbosity packageDBs repos comp conf
-- supplied a non-trivial version constraint
showPkgVersion = not (null verConstraints)
verConstraint = foldr intersectVersionRanges anyVersion verConstraints
verConstraints = [ vr | PackageVersionConstraint _ vr <- constraints ]
verConstraints = [ vr | PackageConstraintVersion _ vr <- constraints ]
gatherPkgInfo prefs installedPkgIndex sourcePkgIndex (SpecificSourcePackage pkg) =
Right $ mergePackageInfo pref installedPkgs sourcePkgs
......
......@@ -176,7 +176,7 @@ pkgSpecifierConstraints :: Package pkg
=> PackageSpecifier pkg -> [PackageConstraint]
pkgSpecifierConstraints (NamedPackage _ constraints) = constraints
pkgSpecifierConstraints (SpecificSourcePackage pkg) =
[PackageVersionConstraint (packageName pkg)
[PackageConstraintVersion (packageName pkg)
(thisVersion (packageVersion pkg))]
......@@ -393,7 +393,7 @@ expandUserTarget :: FilePath
expandUserTarget worldFile userTarget = case userTarget of
UserTargetNamed (Dependency name vrange) ->
let constraints = [ PackageVersionConstraint name vrange
let constraints = [ PackageConstraintVersion name vrange
| not (isAnyVersion vrange) ]
in return [PackageTargetNamedFuzzy name constraints userTarget]
......@@ -402,9 +402,9 @@ expandUserTarget worldFile userTarget = case userTarget of
--TODO: should we warn if there are no world targets?
return [ PackageTargetNamed name constraints userTarget
| World.WorldPkgInfo (Dependency name vrange) flags <- worldPkgs
, let constraints = [ PackageVersionConstraint name vrange
, let constraints = [ PackageConstraintVersion name vrange
| not (isAnyVersion vrange) ]
++ [ PackageFlagsConstraint name flags
++ [ PackageConstraintFlags name flags
| not (null flags) ] ]
UserTargetLocalDir dir ->
......
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