diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs b/cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs index da5fa56963374a01d063952f72159712f6f4a8a6..467a743c1dae8b0614f1dd00d3a373feff3ad1d7 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs @@ -162,7 +162,11 @@ solve sc cinfo idx pkgConfigDB userPrefs userConstraints userGoals = nonInstallable = L.map mkPackageName [ "base" + , "ghc-bignum" , "ghc-prim" + , "ghc-boot" + , "ghc" + , "ghci" , "integer-gmp" , "integer-simple" , "template-haskell" diff --git a/cabal-install/src/Distribution/Client/Dependency.hs b/cabal-install/src/Distribution/Client/Dependency.hs index affa5bd57aa8bde72a4fce8306551155d65d5428..c5cbba8d48ebe2f7772e9e18816edde24533162a 100644 --- a/cabal-install/src/Distribution/Client/Dependency.hs +++ b/cabal-install/src/Distribution/Client/Dependency.hs @@ -400,6 +400,9 @@ dontUpgradeNonUpgradeablePackages params = , 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" diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs index 98d98ae4bbc3013c7a80bb493df77b4dd5a07d96..1101e05aff94d8f4ea8c6970738366c218c9a6c5 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs @@ -148,11 +148,17 @@ tests = [ , runTest $ mkTest db12 "baseShim5" ["D"] anySolverFailure , runTest $ mkTest db12 "baseShim6" ["E"] (solverSuccess [("E", 1), ("syb", 2)]) ] - , testGroup "Base" [ + , testGroup "Base and Nonupgradable" [ runTest $ mkTest dbBase "Refuse to install base without --allow-boot-library-installs" ["base"] $ solverFailure (isInfixOf "only already installed instances can be used") , runTest $ allowBootLibInstalls $ mkTest dbBase "Install base with --allow-boot-library-installs" ["base"] $ solverSuccess [("base", 1), ("ghc-prim", 1), ("integer-gmp", 1), ("integer-simple", 1)] + , runTest $ mkTest dbNonupgrade "Refuse to install newer ghc requested by another library" ["A"] $ + solverFailure (isInfixOf "rejecting: ghc-2.0.0 (constraint from non-upgradeable package requires installed instance)") + , runTest $ mkTest dbNonupgrade "Refuse to install newer ghci requested by another library" ["B"] $ + solverFailure (isInfixOf "rejecting: ghci-2.0.0 (constraint from non-upgradeable package requires installed instance)") + , runTest $ mkTest dbNonupgrade "Refuse to install newer ghc-boot requested by another library" ["C"] $ + solverFailure (isInfixOf "rejecting: ghc-boot-2.0.0 (constraint from non-upgradeable package requires installed instance)") ] , testGroup "reject-unconstrained" [ runTest $ onlyConstrained $ mkTest db12 "missing syb" ["E"] $ @@ -1123,6 +1129,19 @@ dbBase = [ , Right $ exAv "integer-gmp" 1 [] ] +dbNonupgrade :: ExampleDb +dbNonupgrade = [ + Left $ exInst "ghc" 1 "ghc-1" [] + , Left $ exInst "ghci" 1 "ghci-1" [] + , Left $ exInst "ghc-boot" 1 "ghc-boot-1" [] + , Right $ exAv "ghc" 2 [] + , Right $ exAv "ghci" 2 [] + , Right $ exAv "ghc-boot" 2 [] + , Right $ exAv "A" 1 [ExFix "ghc" 2] + , Right $ exAv "B" 1 [ExFix "ghci" 2] + , Right $ exAv "C" 1 [ExFix "ghc-boot" 2] + ] + db13 :: ExampleDb db13 = [ Right $ exAv "A" 1 [] diff --git a/changelog.d/issue-8489 b/changelog.d/issue-8489 new file mode 100644 index 0000000000000000000000000000000000000000..32f4c25ff8d435858375e21b538f604a763863e6 --- /dev/null +++ b/changelog.d/issue-8489 @@ -0,0 +1,11 @@ +synopsis: `ghc`, `ghc-boot`, `ghci` packages should be non-upgradable +packages: cabal-install +prs: #8501 +issues: #8489 + +description: { + +- Changed both `Distribution.Client.Dependency`'s `dontUpgradeNonUpgradeablePackages` + and `Distribution.Solver.Modular.Solver`'s `nonInstallable` to be in sync. + +} \ No newline at end of file