Skip to content

cabal-install: Fix non-reinstallable package set #9092

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 2 commits into from
Jul 18, 2023
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
23 changes: 19 additions & 4 deletions cabal-install/src/Distribution/Client/Dependency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -456,19 +456,34 @@ dontUpgradeNonUpgradeablePackages params =
. InstalledPackageIndex.lookupPackageName
(depResolverInstalledPkgIndex params)

-- NOTE: the lists of non-upgradable and non-installable packages used to be
-- | The set of non-reinstallable packages includes those which cannot be
-- rebuilt using a GHC installation and Hackage-published source distribution.
-- There are a few reasons why this might be true:
--
-- * the package overrides its unit ID (e.g. with ghc's @-this-unit-id@ flag),
-- which can result in multiple indistinguishable packages (having potentially
-- different ABIs) with the same unit ID.
--
-- * the package contains definitions of wired-in declarations which tie
-- it to a particular compiler (e.g. we can't build link against
-- @base-4.18.0.0@ using GHC 9.6.1).
--
-- * the package does not have a complete (that is, buildable) source distribution.
-- For instance, some packages provided by GHC rely on files outside of the
-- source tree generated by GHC's build system.
--
-- Note: the list of non-upgradable/non-installable packages used to be
-- respectively in this module and in `Distribution.Solver.Modular.Solver`.
-- Since they were kept synced, they are now combined in the following list.
--
-- See: https://github.com/haskell/cabal/issues/8581
-- See: https://github.com/haskell/cabal/issues/8581 and
-- https://github.com/haskell/cabal/issues/9064.
nonUpgradeablePackages :: [PackageName]
nonUpgradeablePackages =
[ mkPackageName "base"
, mkPackageName "ghc-bignum"
, mkPackageName "ghc-prim"
, mkPackageName "ghc-boot"
, mkPackageName "ghc"
, mkPackageName "ghci"
, mkPackageName "integer-gmp"
, mkPackageName "integer-simple"
Comment on lines 487 to 488
Copy link
Collaborator

Choose a reason for hiding this comment

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

Both integer-* packages are reinstallable now afaik.

Copy link
Member

Choose a reason for hiding this comment

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

@hsyl20 Is there an authoritative source about this? I can ship this change in the PR if you have a source :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

No authoritative source, sorry.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Even if this were true, that's only for latest ghcs, and this package set needs to span all supported ghcs, so we can't do it regardless. If we do start doing it going forward we'll need a per-ghc-version refactor of how we manage the set.

, mkPackageName "template-haskell"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,6 @@ tests =
, 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"
Expand Down Expand Up @@ -1301,8 +1295,6 @@ dbBase =
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 []
Comment on lines 1299 to 1300
Copy link
Collaborator

@grayjay grayjay Jul 15, 2023

Choose a reason for hiding this comment

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

The source versions of ghci and ghc-boot and packages B and C should also be removed.

Expand Down