Skip to content

ghc, ghc-boot, ghci packages should be non-upgradable (#8489) #8501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for syncing ghc-bignum, too.

, "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.

}