Skip to content
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

Amend non-reinstallable packages list #10087

Open
Tracked by #10440
adamgundry opened this issue Jun 8, 2024 · 11 comments
Open
Tracked by #10440

Amend non-reinstallable packages list #10087

adamgundry opened this issue Jun 8, 2024 · 11 comments

Comments

@adamgundry
Copy link
Member

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?

-- | 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.
nonReinstallablePackages :: [PackageName]
nonReinstallablePackages =
[ mkPackageName "base"
, mkPackageName "ghc-bignum"
, mkPackageName "ghc-prim"
, mkPackageName "ghc"
, mkPackageName "integer-gmp"
, mkPackageName "integer-simple"
, mkPackageName "template-haskell"
]

adamgundry added a commit that referenced this issue Jun 9, 2024
GHC 9.10 ships with a new wired-in package, ghc-internal, which cannot
be reinstalled. This commit prevents cabal-install from attempting it.
@adamgundry
Copy link
Member Author

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
Copy link
Collaborator

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
Copy link
Collaborator

geekosaur commented Jun 9, 2024

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
Copy link
Collaborator

phadej commented Jun 9, 2024

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
Copy link
Collaborator

@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
Copy link
Collaborator

"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.

Mikolaj pushed a commit that referenced this issue Jun 10, 2024
GHC 9.10 ships with a new wired-in package, ghc-internal, which cannot
be reinstalled. This commit prevents cabal-install from attempting it.
mergify bot added a commit that referenced this issue Jun 13, 2024
)

GHC 9.10 ships with a new wired-in package, ghc-internal, which cannot
be reinstalled. This commit prevents cabal-install from attempting it.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
mergify bot pushed a commit that referenced this issue Jun 13, 2024
)

GHC 9.10 ships with a new wired-in package, ghc-internal, which cannot
be reinstalled. This commit prevents cabal-install from attempting it.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit b1c8ee6)
mergify bot added a commit that referenced this issue Jun 13, 2024
) (#10108)

GHC 9.10 ships with a new wired-in package, ghc-internal, which cannot
be reinstalled. This commit prevents cabal-install from attempting it.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit b1c8ee6)

Co-authored-by: Adam Gundry <[email protected]>
erikd pushed a commit to erikd/cabal that referenced this issue Jun 17, 2024
… (haskell#10093)

GHC 9.10 ships with a new wired-in package, ghc-internal, which cannot
be reinstalled. This commit prevents cabal-install from attempting it.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
mmhat pushed a commit to mmhat/cabal that referenced this issue Jun 24, 2024
… (haskell#10093)

GHC 9.10 ships with a new wired-in package, ghc-internal, which cannot
be reinstalled. This commit prevents cabal-install from attempting it.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
tbidne pushed a commit to tbidne/cabal that referenced this issue Jul 3, 2024
… (haskell#10093)

GHC 9.10 ships with a new wired-in package, ghc-internal, which cannot
be reinstalled. This commit prevents cabal-install from attempting it.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
@TeofilC
Copy link
Collaborator

TeofilC commented Sep 22, 2024

I think we only need the first half of your tuple @geekosaur, the second part is just the reverse dependencies of the package from the list, and I think that should be covered already.

I've made a ticket to track the GHC side of this: https://gitlab.haskell.org/ghc/ghc/-/issues/25282

@geekosaur
Copy link
Collaborator

The second would matter if the bootlibs started to include a package with a partial or disjoint set of dependencies; I was thinking in terms of forward compatibility.

@TeofilC
Copy link
Collaborator

TeofilC commented Sep 23, 2024

The second would matter if the bootlibs started to include a package with a partial or disjoint set of dependencies; I was thinking in terms of forward compatibility.

I see that makes sense. I feel like maybe we could just go with the simpler thing for now. And if we need this in the future we could modify the interface. I don't imagine we will be needing this extra feature any time soon, since you normally want all the dependencies as well, otherwise you'd currently get broken packages.

hubot pushed a commit to ghc/ghc that referenced this issue Sep 23, 2024
This lets Cabal know which packages are not reinstallable.
Previously this was a fixed list that was hard-coded into Cabal.

See: <haskell/cabal#10087>

Resolvces #25282
hubot pushed a commit to ghc/ghc that referenced this issue Sep 23, 2024
This lets Cabal know which packages are not reinstallable.
Previously this was a fixed list that was hard-coded into Cabal.

See: <haskell/cabal#10087>

Resolvces #25282
hubot pushed a commit to ghc/ghc that referenced this issue Sep 23, 2024
This lets Cabal know which packages are not reinstallable.
Previously this was a fixed list that was hard-coded into Cabal.

See: <haskell/cabal#10087>

Resolvces #25282
hubot pushed a commit to ghc/ghc that referenced this issue Sep 25, 2024
This lets Cabal know which packages are wired-in.
In turn Cabal can use this information to determine which packages
should be re-installable.
Previously this was a fixed list that was hard-coded into Cabal.

See: <haskell/cabal#10087>

Resolves #25282
@TeofilC
Copy link
Collaborator

TeofilC commented Oct 29, 2024

To update on this. I made an initial MR here: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13297

@mpickering made some great points and it's likely that this interface will need more thought as GHC shouldn't expose information about packages, as that's outside its area of concern.

I'm taking a break from this right now (someone else is free to pick it up), but I'm hoping to get back to it before 9.14

@geekosaur
Copy link
Collaborator

Insifar as it's ghc that is foisting this set of packages and their special requirements on the community, I must disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants