Skip to content

Print maximum ghc version in ebuild comment #143

@solpeth

Description

@solpeth

Background

Haskell packages are famously/notoriously strict on dependency version ranges. This improves predictability of correct compilation and operation, but increases the maintenance burden to ensure that the fragile/non-existent ABI stability is appropriately dealt with when bumping package versions.

All packages are required to have version bounds on their dependencies in hackage. We reflect this in our ebuilds generated by hackport, except for GHC.

Problem

We have very few resources in the Gentoo Haskell project. Most haskell work occurs here rather than in ::gentoo. No haskell packages are stabilised as a rule. Because of how easy it is to break packages with dependency version changes, we have to methodically and meticulously work through dependency trees when bumping packages.

The most complex package to bump is GHC itself.

GHC includes not only the compiler, but core libraries. It depends on these libraries for its internal operation. These core libraries should almost never be upgraded by Portage to a different version, as it may break GHC's operation or confuse cabal when building other packages that depend on these libraries. Thus, we must keep the GHC version and a bunch of non-upgradeable packages tightly matched.

Some packages are not visible to Portage (some are due to historical changes in bundled libraries, e.g. some packages were once not bundled but now are, and vice versa, leading to ::haskell maintainers marking such packages as dummy libraries that defer to GHC's bundled libraries rather than emerging a second copy of the library from hackage). Hackport will determine the minimum GHC version for any given haskell package based on the versions of the bundled libraries that the package depends on. But it does not determine a maximum version.

This is by and large intended behaviour to avoid adding significantly to the workload of loosening upper bounds. However, this also means that we have no visibility of package incompatibility with newer GHC versions. This means we must, by hand and with our limited resources, try to compile the entire ::haskell repository on a newer GHC version to determine if it is reasonably safe to bump the GHC version for all users.

Current GHC bumping process

  1. Build a list of key packages (easy)
  2. Build 75% of the repository (very time-consuming)

With such limited resources, step 2 takes a very long time. ::haskell only recently keyworded a version of GHC that is not even supported upstream anymore. This is too slow.

Proposed GHC bumping process

  1. Build a list of key packages (unchanged)
  2. Rely on upstream dependency data to determine compatibility for the rest of the repository

My proposed solution to step 2 is to have hackport insert an easily-greppable comment in the ebuilds which marks the highest ghc version the package is compatible with. While not perfect, it has the benefit of:

  1. Avoiding adding to the maintenance burden of adding the GHC upper bound in RDEPEND
  2. Avoiding having to build the whole repository to get to 75% success.

We should be able to rely on upstream reports for compatibility. Many projects use CI tools to automate this. Hackage itself checks packages automatically against a range of GHC versions. Where a Gentoo-specific quirk contributes to a compatibility issue that should not exist, we can deal with that directly with our limited resources.

Pros

  1. Much faster bumping of GHC versions to remain relevant and up to date to an upstream-supported version at the very least. We effectively eliminate the 75% build requirement while minimising unintended breakage. Although we are for all intents and purposes the place to go to for haskell packaging in Gentoo Linux, we are also not ::gentoo, and some (but not too much) breakage should be occasionally expected and acceptable. We should be able to deal with such breakage quickly and directly when it does arise
  2. Freeing up resources for other tasks, e.g. improving tooling and syncing to ::gentoo.

Cons

  1. We are relying on upstream being correct in their determination of GHC compatibility, rather than directly verifying this ourselves
  2. This will not help in the immediate sense, as ebuilds will need to be commented by hackport when otherwise updated.

Mechanism of Operation in Hackport

  1. Determine maximum GHC version allowed by the package (see the current logic in determining the minimum GHC version, which may be able to be re-used for this purpose)
  2. Print a comment (perhaps near the top of the ebuild like hackport flags) of a specific format which is easily greppable by developers, and perhaps can be easily parsed by automated scripts.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions