Skip to content

Commit 09c90de

Browse files
ghc, ghc-boot, ghci packages should be non-upgradable (#8489) (#8501)
* ghc, ghc-boot, ghci should be non-upgradable * (PR number) * Checks for depending on GHC * Also tests ghc-boot, ghci * Simplify condition * Added "rejecting:" bits * Synced cabal-install-solver's list & Simplify testcase * Updated changelog * Fully remove base dependency in test dbNonUpgrade Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 017610c commit 09c90de

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ solve sc cinfo idx pkgConfigDB userPrefs userConstraints userGoals =
162162
nonInstallable =
163163
L.map mkPackageName
164164
[ "base"
165+
, "ghc-bignum"
165166
, "ghc-prim"
167+
, "ghc-boot"
168+
, "ghc"
169+
, "ghci"
166170
, "integer-gmp"
167171
, "integer-simple"
168172
, "template-haskell"

cabal-install/src/Distribution/Client/Dependency.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,9 @@ dontUpgradeNonUpgradeablePackages params =
400400
, pkgname <- [ mkPackageName "base"
401401
, mkPackageName "ghc-bignum"
402402
, mkPackageName "ghc-prim"
403+
, mkPackageName "ghc-boot"
404+
, mkPackageName "ghc"
405+
, mkPackageName "ghci"
403406
, mkPackageName "integer-gmp"
404407
, mkPackageName "integer-simple"
405408
, mkPackageName "template-haskell"

cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,17 @@ tests = [
148148
, runTest $ mkTest db12 "baseShim5" ["D"] anySolverFailure
149149
, runTest $ mkTest db12 "baseShim6" ["E"] (solverSuccess [("E", 1), ("syb", 2)])
150150
]
151-
, testGroup "Base" [
151+
, testGroup "Base and Nonupgradable" [
152152
runTest $ mkTest dbBase "Refuse to install base without --allow-boot-library-installs" ["base"] $
153153
solverFailure (isInfixOf "only already installed instances can be used")
154154
, runTest $ allowBootLibInstalls $ mkTest dbBase "Install base with --allow-boot-library-installs" ["base"] $
155155
solverSuccess [("base", 1), ("ghc-prim", 1), ("integer-gmp", 1), ("integer-simple", 1)]
156+
, runTest $ mkTest dbNonupgrade "Refuse to install newer ghc requested by another library" ["A"] $
157+
solverFailure (isInfixOf "rejecting: ghc-2.0.0 (constraint from non-upgradeable package requires installed instance)")
158+
, runTest $ mkTest dbNonupgrade "Refuse to install newer ghci requested by another library" ["B"] $
159+
solverFailure (isInfixOf "rejecting: ghci-2.0.0 (constraint from non-upgradeable package requires installed instance)")
160+
, runTest $ mkTest dbNonupgrade "Refuse to install newer ghc-boot requested by another library" ["C"] $
161+
solverFailure (isInfixOf "rejecting: ghc-boot-2.0.0 (constraint from non-upgradeable package requires installed instance)")
156162
]
157163
, testGroup "reject-unconstrained" [
158164
runTest $ onlyConstrained $ mkTest db12 "missing syb" ["E"] $
@@ -1123,6 +1129,19 @@ dbBase = [
11231129
, Right $ exAv "integer-gmp" 1 []
11241130
]
11251131

1132+
dbNonupgrade :: ExampleDb
1133+
dbNonupgrade = [
1134+
Left $ exInst "ghc" 1 "ghc-1" []
1135+
, Left $ exInst "ghci" 1 "ghci-1" []
1136+
, Left $ exInst "ghc-boot" 1 "ghc-boot-1" []
1137+
, Right $ exAv "ghc" 2 []
1138+
, Right $ exAv "ghci" 2 []
1139+
, Right $ exAv "ghc-boot" 2 []
1140+
, Right $ exAv "A" 1 [ExFix "ghc" 2]
1141+
, Right $ exAv "B" 1 [ExFix "ghci" 2]
1142+
, Right $ exAv "C" 1 [ExFix "ghc-boot" 2]
1143+
]
1144+
11261145
db13 :: ExampleDb
11271146
db13 = [
11281147
Right $ exAv "A" 1 []

changelog.d/issue-8489

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
synopsis: `ghc`, `ghc-boot`, `ghci` packages should be non-upgradable
2+
packages: cabal-install
3+
prs: #8501
4+
issues: #8489
5+
6+
description: {
7+
8+
- Changed both `Distribution.Client.Dependency`'s `dontUpgradeNonUpgradeablePackages`
9+
and `Distribution.Solver.Modular.Solver`'s `nonInstallable` to be in sync.
10+
11+
}

0 commit comments

Comments
 (0)