Skip to content

Does cabal-3.10 impose setup.Cabal < 3.12? #9917

Open

Description

@andreasabel

When trying to make cabal-3.10 build packages with custom setups on GHC 9.10.0 (alpha3), which ships with Cabal-3.12, cabal insists to build Cabal-3.10.3.0.
If I try to force using the installed Cabal, constraint solving fails.

system-filepath-0.4.14$ cabal build -w ghc-9.10.0 -c 'setup.Cabal >=3.12'
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: system-filepath-0.4.14 (user goal)
[__1] next goal: system-filepath:setup.Cabal (dependency of system-filepath)
[__1] rejecting: system-filepath:setup.Cabal-3.12.0.0/installed-c30b
(constraint from maximum version of Cabal used by Setup.hs requires <3.12)

The package itself does not impose an upper bound on Cabal:

custom-setup
  setup-depends: Cabal >= 1.8, base >=4.0 && <5

This is not a problem with cabal-3.11 (master), this one does not impose this upper bound.

The docs say (https://cabal.readthedocs.io/en/3.10/cabal-package.html#pkg-field-custom-setup-setup-depends):

If the field is not specified the implicit package set will be used. The package set contains packages bundled with GHC (i.e. base, bytestring) and specifically Cabal. The specific bounds are put on Cabal dependency: lower-bound is inferred from cabal-version, and the upper-bound is < 1.25.

(Ok, the "< 1.25" is definitively stale doc here.)
The docs seem to say that the upper bound comes from whatever is bundled with GHC, which should be including Cabal-3.12 (bundled with GHC 9.10 alpha3).

Activity

  1. andreasabel commented on Apr 27, 2024

    @andreasabel
    MemberAuthor

    @ffaf1: This issue prevents me from evaluating Cabal-3.12 with a released cabal-install, and the following one with master:

    Not sure how I should verify relaxations to Cabal < 3.13 in my projects now...

  2. Bodigrim commented on Apr 27, 2024

    @Bodigrim
    Collaborator

    This is expected behavior:

    -- As we can't predict the future, we also place a global upper
    -- bound on the lib:Cabal version we know how to interact with:
    --
    -- The upper bound is computed by incrementing the current major
    -- version twice in order to allow for the current version, as
    -- well as the next adjacent major version (one of which will not
    -- be released, as only "even major" versions of Cabal are
    -- released to Hackage or bundled with proper GHC releases).
    --
    -- For instance, if the current version of cabal-install is an odd
    -- development version, e.g. Cabal-2.1.0.0, then we impose an
    -- upper bound `setup.Cabal < 2.3`; if `cabal-install` is on a
    -- stable/release even version, e.g. Cabal-2.2.1.0, the upper
    -- bound is `setup.Cabal < 2.4`. This gives us enough flexibility
    -- when dealing with development snapshots of Cabal and cabal-install.
    --
    setupMaxCabalVersionConstraint =
    alterVersion (take 2) $ incVersion 1 $ incVersion 1 cabalVersion

  3. andreasabel commented on Apr 27, 2024

    @andreasabel
    MemberAuthor

    Thanks for digging this out @Bodigrim!

    Maybe one should not have search through the source code of cabal to get this information.

    1. The docs (see OP) need to mention this.

    2. The reason for the constraint should be clearer. Currently it says:

      (constraint from maximum version of Cabal used by Setup.hs requires <3.12)

      Better formulation:

      (the use of cabal 3.10.* limits the maximum version of Cabal used by Setup.hs to <3.12)

    I am also a bit skeptical about placing this limit in the first place.

    As we can't predict the future, we also place a global upper bound on the lib:Cabal version we know how to interact with

    This sound to me like:

    As I cannot predict whether my house will stand for 50 years, I will tear it down after 20 years.

    I do not see the point of forcing pessimism into the constraint solving here.
    Should things actually break with a too new Cabal, then I can always place a suitable upper bound with -c setup.Cabal < VERSION, or can't I?

  4. Bodigrim commented on Apr 27, 2024

    @Bodigrim
    Collaborator

    I am also a bit skeptical about placing this limit in the first place.

    Given that Cabal-X is usually released a few weeks earlier than cabal-install-X, the limitation is quite annoying.

    Could it be "current version + 4"? So that cabal-install-3.10 could be used to test Cabal-3.12, hoping that cabal-install-3.12 will be available in time for Cabal-3.14.

  5. andreasabel commented on Apr 28, 2024

    @andreasabel
    MemberAuthor

    The original issue seems to be:

    However this issue only speaks about warnings which I find totally appropriate.
    So we would want a warning if cabal-x builds Setup.hs with Cabal-y where y is a release version bigger than x rather than a hard constraint one cannot overwrite.

    The commit that introduced the OP is c92b715. It has no tests and no doc changes may thus be simply revertible.

  6. 28 remaining items

  7. added a commit that references this issue on May 28, 2024
  8. ulysses4ever commented on May 28, 2024

    @ulysses4ever
    Collaborator
  9. RyanGlScott commented on May 28, 2024

    @RyanGlScott
    Member

    I will happily use cabal-install-3.12.0.0 once it is fully supported by ghcup and haskell-ci.

  10. phadej commented on May 28, 2024

    @phadej
    Collaborator

    I'd use cabal-install preleases if they were in ghcup prerelease channel

    I was unaware there are cabal-install prerelease, as it didn't show up in ghcup list. I don't read discourse.

  11. Bodigrim commented on May 28, 2024

    @Bodigrim
    Collaborator

    Could it be "current version + 4"?

    That would require to be more careful about backward compatibility of ./Setup interface.

    ...which is worth doing anyway.

    I'd say that promptly managing the cabal-install releases should be easier.

    One would hope so, but apparently it's not.

  12. andreasabel commented on May 29, 2024

    @andreasabel
    MemberAuthor

    I'd use cabal-install preleases if they were in ghcup prerelease channel

    I see this in ghcup list:

    ✔✔ cabal 3.10.3.0           latest,recommended                                    
    ✗  cabal 3.11.0.0.2024.4.19 latest-prerelease      
    

    ghcup config:

    ...
    url-source:
    - GHCupURL
    - https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml
    - https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml
    - https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml
    
  13. andreasabel commented on May 29, 2024

    @andreasabel
    MemberAuthor

    @phadej

    It's not as I try to explain. The cabal-install-3.14 would work without the constraint, cabal-install-3.12 won't.

    Ok, my model seems to be naive. I thought that it is only Setup.hs that needs the right Cabal version to build and function, but it the same library Cabal that dictates how cabal-install invokes Setup, and yes, then there is possibility of incongruence which isn't fixable either.

    Still, replacing the hardwired Cabal <... constraint by a stern warning seems a possibility.

  14. phadej commented on May 29, 2024

    @phadej
    Collaborator

    I tested with cabal 3.11.0.0.2024.4.19 and the Cabal-3.12.0.0 is picked up for setup-depends.

    So the only "issue" I see here, is that cabal-install-3.12.0.0 is not released.

  15. added a commit that references this issue on Jun 5, 2024
  16. Mikolaj commented on Jun 15, 2024

    @Mikolaj
    Member

    The release process (#9885) for cabal 3.12.1.0 is now at the point where we finished backporting all planned PRs. In the interest of releasing cabal-install 3.12.1.0 ASAP and so eliminating (I hope) the immediate problem described in this issue for the time being, we need to move on to the next steps of the release process. If you are working on a PR that fixes this here ticket in a more future-proof way than just by releasing a new cabal-install, please kindly submit it for review now. Please also note we need a consensus on how to solve this issue, so the review process would need to be double-purposed to also include that discussion (but with a concrete prototype PR in hand, that's sometimes easier).

    If the PR is not agreed on and doubly-reviewed by Monday morning, we are going to proceed with the release. But maybe a group of concerned user has the PR done and is finishing discussing it and forging the consensus behind the scenes. If so, it's time for the big reveal.

    Thank you for the discussion in this ticket and at the open cabal devs meeting. I wasn't aware the emergency measure of releasing only Cabal the library has such dire consequences for some users, so now we are wiser and we'd probably rather choose to sync a minor cabal version with a new GHC release (with all the hackery needed for that due to a versioned API) than to stagger a major version release as we did this time. If you have any spare capacity to help with releasing cabal, that would be awesome and maybe it would enable us to just do normal releases twice a year together with GHC and not spend time on tricks and hacks instead. :) Any other contribution, e.g., reviewing PRs (https://github.com/haskell/cabal/pulls?q=is%3Apr+is%3Aopen+label%3A%22attention%3A+needs-review%22) would also help.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions