-
Notifications
You must be signed in to change notification settings - Fork 712
Support reinstalling more packages (including base and template-haskell) with GHC >9.14 #10982
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
base: master
Are you sure you want to change the base?
Conversation
6cfbe6a
to
e49a4b5
Compare
ecb3159
to
dd63604
Compare
0bd8ca6
to
7b65354
Compare
-- We added a new field to compiler so we need to be careful | ||
-- to make sure that it is always defined, | ||
-- even if the test suite is being built with an older Cabal | ||
#if MIN_VERSION_Cabal(3,15,0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any ideas how to do this better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that it's the test suite, I don't think it matters. For Cabal itself we'd usually use a Distribution.Compat
module instead of raw CPP in the code.
7b65354
to
c035d6f
Compare
c035d6f
to
3f1729d
Compare
In short, this change allows reinstalling packages like `base` and `template-haskell` with GHC >9.14, and it doesn't modify the behaviour of cabal-install with older versions of GHC for backwards-compatibility. cabal-install includes a hardcoded list of non-reinstallable packages. cabal-install will refuse to use a different version of these packages in a build plan unless the --allow-boot-library-installs flag is set. This list of packages is too pessimistic, and needlessly coupled to GHC. For instance, as of GHC-9.12, `base` and `template-haskell` can be "re-installed" without issue. This patch allows compilers to specify exactly which packages are wired-in and so should not be reinstalled. In the case of GHC-9.14+, this amounts to ghc-internal and ghc itself. If a compiler chooses to specify this information then it overrides the hardcoded non-reinstallable package list. Otherwise, it is still used for the sake of backwards compatibility. Note that this information comes in the form of unit-ids rather than package names. This patch extends the solver with constraints that force the use of a precise unit-id. The behaviour here is still somewhat pessimistic. In the future, we could further relax this restriction and only ban reinstalling these packafes when absolutely necessary, eg, only ban re-installing `ghc` if we are using plugins, etc. For the GHC change that added the interface to expose the unit-id of ghc-internal, see: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13297 Resolves #10087 Co-Authored-By: Matthew Pickering <[email protected]>
3f1729d
to
f087826
Compare
Summary
This change allows reinstalling packages like
base
andtemplate-haskell
with GHC >9.14, and it doesn't modify the behaviourof cabal-install with older versions of GHC for backwards-compatibility.
Context
cabal-install includes a hardcoded list of non-reinstallable packages.
cabal-install will refuse to use a different version of these packages
in a build plan unless the --allow-boot-library-installs flag is set.
This list of packages is too pessimistic, and needlessly coupled to GHC.
For instance, as of GHC-9.12,
base
andtemplate-haskell
can be"re-installed" without issue.
Change
This patch allows compilers to specify exactly which packages are wired-in
and so should not be reinstalled.
In the case of GHC-9.14+, this amounts to ghc-internal and ghc itself.
If a compiler chooses to specify this information then it overrides the
hardcoded non-reinstallable package list. Otherwise, it is still used
for the sake of backwards compatibility.
Note that this information comes in the form of unit-ids rather than
package names. This patch extends the solver with constraints that force
the use of a precise unit-id.
The behaviour here is still somewhat pessimistic. In the future, we
could further relax this restriction and only ban reinstalling these
packafes when absolutely necessary, eg, only ban re-installing
ghc
ifwe are using plugins, etc.
For the GHC change that added the interface to expose the unit-id of
ghc-internal, see: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13297
Resolves #10087
Manual QA Notes
Build a compiler from this branch: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13297
and then confirm that when used with cabal from this branch it allows you to reinstall
template-haskell
for instance.For instance this is what happens if I try to build template-haskell with a released version of cabal-install:
cabal output
versus from this branch
cabal output
Include the following checklist in your PR:
significance: significant
in the changelog file.