Skip to content

Commit 8078074

Browse files
committed
cabal-install: Fix non-reinstallable package set (backport #9092) (#9141)
cabal-install: Fix non-reinstallable package set In #9064 we discovered that `ghc-boot` was added to the non-reinstallable package set due to #8051 despite there being no reason why it can't be built from its source distribution. This revealed the fact that there is quite some ambiguity around what constitutes a non-reinstallable package. In #9064 we worked out a hopefully-more-clear picture of non-reinstallability. Here we update the commentary to describe this concept and update the lists to reflect the new definition. Closes #9064. (cherry picked from commit 2e32a44) # Conflicts: # cabal-install/src/Distribution/Client/Dependency.hs * Fix tests (cherry picked from commit 249374d) # Conflicts: # cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs * Fix conflicts
1 parent 529f850 commit 8078074

File tree

2 files changed

+866
-46
lines changed

2 files changed

+866
-46
lines changed

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

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,43 @@ dontUpgradeNonUpgradeablePackages params =
413413
. InstalledPackageIndex.lookupPackageName
414414
(depResolverInstalledPkgIndex params)
415415

416-
addSourcePackages :: [UnresolvedSourcePackage]
417-
-> DepResolverParams -> DepResolverParams
416+
-- | The set of non-reinstallable packages includes those which cannot be
417+
-- rebuilt using a GHC installation and Hackage-published source distribution.
418+
-- There are a few reasons why this might be true:
419+
--
420+
-- * the package overrides its unit ID (e.g. with ghc's @-this-unit-id@ flag),
421+
-- which can result in multiple indistinguishable packages (having potentially
422+
-- different ABIs) with the same unit ID.
423+
--
424+
-- * the package contains definitions of wired-in declarations which tie
425+
-- it to a particular compiler (e.g. we can't build link against
426+
-- @base-4.18.0.0@ using GHC 9.6.1).
427+
--
428+
-- * the package does not have a complete (that is, buildable) source distribution.
429+
-- For instance, some packages provided by GHC rely on files outside of the
430+
-- source tree generated by GHC's build system.
431+
--
432+
-- Note: the list of non-upgradable/non-installable packages used to be
433+
-- respectively in this module and in `Distribution.Solver.Modular.Solver`.
434+
-- Since they were kept synced, they are now combined in the following list.
435+
--
436+
-- See: https://github.com/haskell/cabal/issues/8581 and
437+
-- https://github.com/haskell/cabal/issues/9064.
438+
nonUpgradeablePackages :: [PackageName]
439+
nonUpgradeablePackages =
440+
[ mkPackageName "base"
441+
, mkPackageName "ghc-bignum"
442+
, mkPackageName "ghc-prim"
443+
, mkPackageName "ghc"
444+
, mkPackageName "integer-gmp"
445+
, mkPackageName "integer-simple"
446+
, mkPackageName "template-haskell"
447+
]
448+
449+
addSourcePackages
450+
:: [UnresolvedSourcePackage]
451+
-> DepResolverParams
452+
-> DepResolverParams
418453
addSourcePackages pkgs params =
419454
params {
420455
depResolverSourcePkgIndex =

0 commit comments

Comments
 (0)