From 4bc509e181ecb6c2de856ef25708dbbfa482ad8d Mon Sep 17 00:00:00 2001 From: Abastro Date: Thu, 29 Sep 2022 16:59:11 +0900 Subject: [PATCH 1/9] ghc, ghc-boot, ghci should be non-upgradable --- cabal-install/src/Distribution/Client/Dependency.hs | 3 +++ changelog.d/issue-8489 | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 changelog.d/issue-8489 diff --git a/cabal-install/src/Distribution/Client/Dependency.hs b/cabal-install/src/Distribution/Client/Dependency.hs index affa5bd57aa..c5cbba8d48e 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/changelog.d/issue-8489 b/changelog.d/issue-8489 new file mode 100644 index 00000000000..1a5dd14ca5d --- /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: #???? +issues: #8489 + +description: { + +- `Distribution.Solver.Modular.Solver`'s `nonInstallable` list was left intact, as + there seem to be discrepancies between the two. Possibly, the comments are outdated. + +} \ No newline at end of file From 93eb6bf988181c7377a6943d6d0a801a1b801964 Mon Sep 17 00:00:00 2001 From: Abastro Date: Thu, 29 Sep 2022 17:23:20 +0900 Subject: [PATCH 2/9] (PR number) --- changelog.d/issue-8489 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/issue-8489 b/changelog.d/issue-8489 index 1a5dd14ca5d..1c364b76a87 100644 --- a/changelog.d/issue-8489 +++ b/changelog.d/issue-8489 @@ -1,6 +1,6 @@ synopsis: `ghc`, `ghc-boot`, `ghci` packages should be non-upgradable packages: cabal-install -prs: #???? +prs: #8501 issues: #8489 description: { From 4cd65ad6425e34b8c9fed37ccdc564dc03f86f70 Mon Sep 17 00:00:00 2001 From: Abastro Date: Sun, 23 Oct 2022 18:42:52 +0900 Subject: [PATCH 3/9] Checks for depending on GHC --- .../Distribution/Solver/Modular/Solver.hs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs index 98d98ae4bbc..3a72aaf03c4 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs @@ -153,6 +153,16 @@ tests = [ 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 dbGHCDepend "Refuse to install newer version of ghc requested by another library" ["A"] $ + solverFailure . isInfixOf $ + "Could not resolve dependencies:\n" + ++ "[__0] trying: A-1.0.0 (user goal)\n" + ++ "[__1] next goal: ghc (dependency of A)\n" + ++ "[__1] rejecting: ghc-1.0.0/installed-1 (conflict: A => ghc==2.0.0)\n" + ++ "[__1] rejecting: ghc-2.0.0 (constraint from non-upgradeable package requires installed instance)\n" + ++ "[__1] fail (backjumping, conflict set: A, ghc)\n" + ++ "After searching the rest of the dependency tree exhaustively, " + ++ "these were the goals I've had most trouble fulfilling: A, ghc" ] , testGroup "reject-unconstrained" [ runTest $ onlyConstrained $ mkTest db12 "missing syb" ["E"] $ @@ -1123,6 +1133,16 @@ dbBase = [ , Right $ exAv "integer-gmp" 1 [] ] +dbGHCDepend :: ExampleDb +dbGHCDepend = + let base = exInst "base" 1 "base-1" [] + in [ + Left base + , Left $ exInst "ghc" 1 "ghc-1" [base] + , Right $ exAv "ghc" 2 [] + , Right $ exAv "A" 1 [ExFix "ghc" 2] + ] + db13 :: ExampleDb db13 = [ Right $ exAv "A" 1 [] From 9b751e54fff4bd1d37f2e3988265665a4245bd5f Mon Sep 17 00:00:00 2001 From: Abastro Date: Mon, 24 Oct 2022 21:08:43 +0900 Subject: [PATCH 4/9] Also tests ghc-boot, ghci --- .../Distribution/Solver/Modular/Solver.hs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs index 3a72aaf03c4..ad5e1c81290 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs @@ -148,12 +148,12 @@ 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 dbGHCDepend "Refuse to install newer version of ghc requested by another library" ["A"] $ + , runTest $ mkTest dbNonupgrade "Refuse to install newer ghc requested by another library" ["A"] $ solverFailure . isInfixOf $ "Could not resolve dependencies:\n" ++ "[__0] trying: A-1.0.0 (user goal)\n" @@ -163,6 +163,10 @@ tests = [ ++ "[__1] fail (backjumping, conflict set: A, ghc)\n" ++ "After searching the rest of the dependency tree exhaustively, " ++ "these were the goals I've had most trouble fulfilling: A, ghc" + , runTest $ mkTest dbNonupgrade "Refuse to install newer ghci requested by another library" ["B"] $ + solverFailure (isInfixOf "constraint from non-upgradeable package requires installed instance") + , runTest $ mkTest dbNonupgrade "Refuse to install newer ghc-boot requested by another library" ["C"] $ + solverFailure (isInfixOf "constraint from non-upgradeable package requires installed instance") ] , testGroup "reject-unconstrained" [ runTest $ onlyConstrained $ mkTest db12 "missing syb" ["E"] $ @@ -1133,14 +1137,20 @@ dbBase = [ , Right $ exAv "integer-gmp" 1 [] ] -dbGHCDepend :: ExampleDb -dbGHCDepend = +dbNonupgrade :: ExampleDb +dbNonupgrade = let base = exInst "base" 1 "base-1" [] in [ Left base , Left $ exInst "ghc" 1 "ghc-1" [base] - , Right $ exAv "ghc" 2 [] + , Left $ exInst "ghci" 1 "ghci-1" [base] + , Left $ exInst "ghc-boot" 1 "ghc-boot-1" [base] + , Right $ exAv "ghc" 2 [ExFix "base" 1] + , Right $ exAv "ghci" 2 [ExFix "base" 1] + , Right $ exAv "ghc-boot" 2 [ExFix "base" 1] , Right $ exAv "A" 1 [ExFix "ghc" 2] + , Right $ exAv "B" 1 [ExFix "ghci" 2] + , Right $ exAv "C" 1 [ExFix "ghc-boot" 2] ] db13 :: ExampleDb From b836247117bb1969fcbb8b78fa461fe4b1022f83 Mon Sep 17 00:00:00 2001 From: Abastro Date: Mon, 24 Oct 2022 21:21:05 +0900 Subject: [PATCH 5/9] Simplify condition --- .../UnitTests/Distribution/Solver/Modular/Solver.hs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs index ad5e1c81290..fbac10ca34e 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs @@ -154,15 +154,7 @@ tests = [ , 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 $ - "Could not resolve dependencies:\n" - ++ "[__0] trying: A-1.0.0 (user goal)\n" - ++ "[__1] next goal: ghc (dependency of A)\n" - ++ "[__1] rejecting: ghc-1.0.0/installed-1 (conflict: A => ghc==2.0.0)\n" - ++ "[__1] rejecting: ghc-2.0.0 (constraint from non-upgradeable package requires installed instance)\n" - ++ "[__1] fail (backjumping, conflict set: A, ghc)\n" - ++ "After searching the rest of the dependency tree exhaustively, " - ++ "these were the goals I've had most trouble fulfilling: A, ghc" + solverFailure (isInfixOf "constraint from non-upgradeable package requires installed instance") , runTest $ mkTest dbNonupgrade "Refuse to install newer ghci requested by another library" ["B"] $ solverFailure (isInfixOf "constraint from non-upgradeable package requires installed instance") , runTest $ mkTest dbNonupgrade "Refuse to install newer ghc-boot requested by another library" ["C"] $ From 54a01fc9b5729dea6808d9c8a9c52b039b2cbba0 Mon Sep 17 00:00:00 2001 From: Abastro Date: Tue, 25 Oct 2022 19:57:06 +0900 Subject: [PATCH 6/9] Added "rejecting:" bits --- .../tests/UnitTests/Distribution/Solver/Modular/Solver.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs index fbac10ca34e..6fa1769928c 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs @@ -154,11 +154,11 @@ tests = [ , 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 "constraint from non-upgradeable package requires installed instance") + 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 "constraint from non-upgradeable package requires installed instance") + 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 "constraint from non-upgradeable package requires installed instance") + 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"] $ From a65771f2994a9c1a59534d1978e03d9e4d9e3175 Mon Sep 17 00:00:00 2001 From: Abastro Date: Thu, 27 Oct 2022 16:21:07 +0900 Subject: [PATCH 7/9] Synced cabal-install-solver's list & Simplify testcase --- .../src/Distribution/Solver/Modular/Solver.hs | 4 ++++ .../UnitTests/Distribution/Solver/Modular/Solver.hs | 11 ++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs b/cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs index da5fa569633..467a743c1da 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/tests/UnitTests/Distribution/Solver/Modular/Solver.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs index 6fa1769928c..a85bfb3ded8 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs @@ -1130,13 +1130,10 @@ dbBase = [ ] dbNonupgrade :: ExampleDb -dbNonupgrade = - let base = exInst "base" 1 "base-1" [] - in [ - Left base - , Left $ exInst "ghc" 1 "ghc-1" [base] - , Left $ exInst "ghci" 1 "ghci-1" [base] - , Left $ exInst "ghc-boot" 1 "ghc-boot-1" [base] +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 [ExFix "base" 1] , Right $ exAv "ghci" 2 [ExFix "base" 1] , Right $ exAv "ghc-boot" 2 [ExFix "base" 1] From 91e91371fa74725268ae2409bb8bd596f5b67713 Mon Sep 17 00:00:00 2001 From: Abastro Date: Thu, 27 Oct 2022 16:25:35 +0900 Subject: [PATCH 8/9] Updated changelog --- changelog.d/issue-8489 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.d/issue-8489 b/changelog.d/issue-8489 index 1c364b76a87..32f4c25ff8d 100644 --- a/changelog.d/issue-8489 +++ b/changelog.d/issue-8489 @@ -5,7 +5,7 @@ issues: #8489 description: { -- `Distribution.Solver.Modular.Solver`'s `nonInstallable` list was left intact, as - there seem to be discrepancies between the two. Possibly, the comments are outdated. +- Changed both `Distribution.Client.Dependency`'s `dontUpgradeNonUpgradeablePackages` + and `Distribution.Solver.Modular.Solver`'s `nonInstallable` to be in sync. } \ No newline at end of file From db82990de56ba141b775e8c46eeed78db216171a Mon Sep 17 00:00:00 2001 From: Abastro Date: Fri, 28 Oct 2022 20:06:14 +0900 Subject: [PATCH 9/9] Fully remove base dependency in test dbNonUpgrade --- .../tests/UnitTests/Distribution/Solver/Modular/Solver.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs index a85bfb3ded8..1101e05aff9 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs @@ -1134,9 +1134,9 @@ 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 [ExFix "base" 1] - , Right $ exAv "ghci" 2 [ExFix "base" 1] - , Right $ exAv "ghc-boot" 2 [ExFix "base" 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]