haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.59k stars 689 forks source link

Amend non-reinstallable packages list #10087

Open adamgundry opened 1 month ago

adamgundry commented 1 month ago

cabal-install maintains a list of nonReinstallablePackages, preventing certain packages being reinstalled by the user. This list needs some updates:

The list of non-reinstallable packages does not currently depend on the compiler version. Really it should; is there an easy way to achieve this?

https://github.com/haskell/cabal/blob/dda541cebcde25b3324dac4a59c8b9eb98b01e6a/cabal-install/src/Distribution/Client/Dependency.hs#L447-L471

adamgundry commented 1 month ago

I've opened #10093 to add ghc-internal to the list, since that is otherwise wrong for GHC 9.10. We don't need to resolve base and template-haskell just yet.

Ideally we would keep template-haskell in the list for existing GHC versions but remove it for future versions. Perhaps GHC should expose some interface whereby cabal-install can query the list of non-reinstallable packages?

geekosaur commented 1 month ago

I've been thinking it would be nice of the libdir contained a file of bootlibs and dependencies, which would allow us to both get the non-reinstallable libs and treat the others as non-reinstallable if ghc is in the closure.

[("base", Nothing), -- non-reinstallable in this version
 ("ghc", Just […]) -- list of packages that are non-reinstallable if "ghc" is used
]

(quick example only, I don't know enough about the details)

geekosaur commented 1 month ago

Also, do we need to worry about the likes of ghc-internal? -- ETA: wrong one, I saw several new internal libs in the list. ghc-boot, ghc-boot-th, ghc-experimental.

phadej commented 1 month ago

Perhaps GHC should expose some interface whereby cabal-install can query the list of non-reinstallable packages?

The issue is that packages which cannot be actually built are uploaded to Hackage. AFAICT, the only reason is to provide haddocks in the common place with everything else. But I'd argue it's primarily a Hackage issue. If say base-4.20.0.0 or ghc-internal-9.1001.1 are not reinstallable packages, they shouldn't be in Hackage index (= the input to solver) to begin with.

mpickering commented 1 month ago

@geekosaur Package distributed with ghc are reinstallable unless the build plan contains ghc. The reason that already installed packages are preferred is #9669 which is unrelated to this ticket as far as I can tell.

geekosaur commented 1 month ago

"The build plan contains ghc" is exactly the case I want to capture. I think I missed a case, though: Just [] captures things like text which are reinstallable.