Skip to content

Commit

Permalink
ghc, ghc-boot, ghci packages should be non-upgradable (haskell#…
Browse files Browse the repository at this point in the history
…8489) (haskell#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>
  • Loading branch information
2 people authored and alexbiehl committed Dec 15, 2022
1 parent ffd012d commit 6c30da0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions cabal-install/src/Distribution/Client/Dependency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"] $
Expand Down Expand Up @@ -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 []
Expand Down
11 changes: 11 additions & 0 deletions changelog.d/issue-8489
Original file line number Diff line number Diff line change
@@ -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.

}

0 comments on commit 6c30da0

Please sign in to comment.