Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cabal-install-solver/src/Distribution/Solver/Modular.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import Distribution.Verbosity
-- solver. Performs the necessary translations before and after.
modularResolver :: SolverConfig -> DependencyResolver loc
modularResolver sc (Platform arch os) cinfo iidx sidx pkgConfigDB pprefs pcs pns =
fmap (uncurry postprocess) $ -- convert install plan
uncurry postprocess <$> -- convert install plan
solve' sc cinfo idx pkgConfigDB pprefs gcs pns
where
-- Indices have to be converted into solver-specific uniform index.
Expand Down Expand Up @@ -275,7 +275,7 @@ tryToMinimizeConflictSet runSolver sc cs cm =
++ "conflict set: " ++ showCS cs') $
ExhaustiveSearch smallestKnownCS smallestKnownCM
BackjumpLimitReached ->
failWith ("Reached backjump limit while minimizing conflict set.")
failWith "Reached backjump limit while minimizing conflict set."
BackjumpLimitReached
where
varStr = "\"" ++ showVar v ++ "\""
Expand Down
20 changes: 2 additions & 18 deletions cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ data SolverConfig = SolverConfig {
shadowPkgs :: ShadowPkgs,
strongFlags :: StrongFlags,
allowBootLibInstalls :: AllowBootLibInstalls,
nonInstallablePackages :: [PackageName],
onlyConstrained :: OnlyConstrained,
maxBackjumps :: Maybe Int,
enableBackjumping :: EnableBackjumping,
Expand Down Expand Up @@ -142,7 +143,7 @@ solve sc cinfo idx pkgConfigDB userPrefs userConstraints userGoals =
prunePhase = (if asBool (avoidReinstalls sc) then P.avoidReinstalls (const True) else id) .
(if asBool (allowBootLibInstalls sc)
then id
else P.requireInstalled (`elem` nonInstallable)) .
else P.requireInstalled (`elem` nonInstallablePackages sc)) .
(case onlyConstrained sc of
OnlyConstrainedAll ->
P.onlyConstrained pkgIsExplicit
Expand All @@ -155,23 +156,6 @@ solve sc cinfo idx pkgConfigDB userPrefs userConstraints userGoals =
pkgIsExplicit :: PN -> Bool
pkgIsExplicit pn = S.member pn allExplicit

-- packages that can never be installed or upgraded
-- If you change this enumeration, make sure to update the list in
-- "Distribution.Client.Dependency" as well
nonInstallable :: [PackageName]
nonInstallable =
L.map mkPackageName
[ "base"
, "ghc-bignum"
, "ghc-prim"
, "ghc-boot"
, "ghc"
, "ghci"
, "integer-gmp"
, "integer-simple"
, "template-haskell"
]

-- When --reorder-goals is set, we use preferReallyEasyGoalChoices, which
-- prefers (keeps) goals only if the have 0 or 1 enabled choice.
--
Expand Down
39 changes: 25 additions & 14 deletions cabal-install/src/Distribution/Client/Dependency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -395,24 +395,31 @@ dontUpgradeNonUpgradeablePackages params =
(PackageConstraint (ScopeAnyQualifier pkgname) PackagePropertyInstalled)
ConstraintSourceNonUpgradeablePackage
| Set.notMember (mkPackageName "base") (depResolverTargets params)
-- If you change this enumeration, make sure to update the list in
-- "Distribution.Solver.Modular.Solver" as well
, pkgname <- [ mkPackageName "base"
, mkPackageName "ghc-bignum"
, mkPackageName "ghc-prim"
, mkPackageName "ghc-boot"
, mkPackageName "ghc"
, mkPackageName "ghci"
, mkPackageName "integer-gmp"
, mkPackageName "integer-simple"
, mkPackageName "template-haskell"
]
, pkgname <- nonUpgradeablePackages
, isInstalled pkgname ]

isInstalled = not . null
. InstalledPackageIndex.lookupPackageName
(depResolverInstalledPkgIndex params)

-- NOTE: the lists of non-upgradable and non-installable packages used to be
-- respectively in this module and in `Distribution.Solver.Modular.Solver`.
-- Since they were kept synced, they are now combined in the following list.
--
-- See: https://github.com/haskell/cabal/issues/8581
nonUpgradeablePackages :: [PackageName]
nonUpgradeablePackages =
[ mkPackageName "base"
, mkPackageName "ghc-bignum"
, mkPackageName "ghc-prim"
, mkPackageName "ghc-boot"
, mkPackageName "ghc"
, mkPackageName "ghci"
, mkPackageName "integer-gmp"
, mkPackageName "integer-simple"
, mkPackageName "template-haskell"
]

addSourcePackages :: [UnresolvedSourcePackage]
-> DepResolverParams -> DepResolverParams
addSourcePackages pkgs params =
Expand Down Expand Up @@ -469,7 +476,7 @@ removeBounds relKind relDeps params =
}
where
sourcePkgIndex' :: PackageIndex.PackageIndex UnresolvedSourcePackage
sourcePkgIndex' = fmap relaxDeps $ depResolverSourcePkgIndex params
sourcePkgIndex' = relaxDeps <$> depResolverSourcePkgIndex params

relaxDeps :: UnresolvedSourcePackage -> UnresolvedSourcePackage
relaxDeps srcPkg = srcPkg
Expand Down Expand Up @@ -710,7 +717,11 @@ resolveDependencies platform comp pkgConfigDB solver params =
$ fmap (validateSolverResult platform comp indGoals)
$ runSolver solver (SolverConfig reordGoals cntConflicts fineGrained minimize
indGoals noReinstalls
shadowing strFlags allowBootLibs onlyConstrained_ maxBkjumps enableBj
shadowing strFlags allowBootLibs
-- See comment of nonUpgradeablePackages about
-- non-installable and non-upgradable packages.
nonUpgradeablePackages
onlyConstrained_ maxBkjumps enableBj
solveExes order verbosity (PruneAfterFirstSuccess False))
platform comp installedPkgIndex sourcePkgIndex
pkgConfigDB preferences constraints targets
Expand Down