Skip to content

Extend --allow-newer to limit scope to single packages #2756

Closed

Description

@hvr

When trying to fixup cabal-metadata by empirical trial & error tweaks of inter-package depedencies, it's sometimes useful to lift the upper bound only for a single package rather than for every package, as other packages may rely on automatic cabal flags toggled by version ranges (which --allow-newer sometimes breaks) or we actually want all other constraints to remain intact to keep the solver from picking a bad install-plan that may result if all packages ignore that specific upper bound.

So, I hereby propose to enhance the --allow-never feature to allow to specify which package a constraint relaxation shall apply to. Here's a suggested backward-compatible syntax:

--allow-newer foo:base,lens,bar:time

whose meaning would be

  • drop any upper bound for base specified by package foo,
  • drop any upper bound for lens specified by any package
  • drop any upper bound for time specified by package bar

UPDATE: see https://cabal.readthedocs.io/en/latest/nix-local-build.html#cfg-field-allow-newer for documentation of currently supported syntax for --allow-newer and --allow-older.

Activity

  1. 23Skidoo commented on Aug 14, 2015

    @23Skidoo
    Member

    Not really a solver issue, --allow-newer is implemented as a preliminary step before running the solver.

  2. added 2 commits that reference this issue on Feb 19, 2016
    484eeb5
    e4b5416
  3. added a commit that references this issue on Mar 5, 2016
    46e1b49
  4. ezyang commented on Sep 1, 2016

    @ezyang
    Contributor

    Is there ever a case where you want the old-style sledgehammer usage? It seems rare, maybe we should discourage it?

  5. 23Skidoo commented on Sep 1, 2016

    @23Skidoo
    Member

    I don't have anything against.

  6. hvr commented on Sep 1, 2016

    @hvr
    MemberAuthor

    @ezyang are you suggesting a warning to be emitted which informs about the more granular syntax?

  7. ezyang commented on Sep 2, 2016

    @ezyang
    Contributor

    No, just a note in the docs. I've put in an admonition against in the new nix-local-build PR.

  8. lspitzner commented on Apr 13, 2018

    @lspitzner
    Collaborator

    This is not documented in the user-guide or in the commandline help. What is the syntax to do this via config file? Also, I tried to use this via commandline and get this:

    > cabal new-build --allow-newer foo:base
    cabal: Internal error in target matching. It should always be possible to find
    a syntax that's sufficiently qualified to give an unambiguous match. However
    when matching 'foo:base' we found foo:base (unknown-component) which does not
    have an unambiguous syntax. The possible syntax and the targets they match are
    as follows:
    cabal: <<loop>>
    > cabal --version
    cabal-install version 2.2.0.0
    compiled using version 2.2.0.1 of the Cabal library 
    
  9. lspitzner commented on Apr 13, 2018

    @lspitzner
    Collaborator

    Ah sorry, it is in the users-guide. My bad, I suck at using the search feature.

  10. 23Skidoo commented on Apr 13, 2018

    @23Skidoo
    Member

    Use --allow-newer=foo:base, otherwise it gets parsed as --allow-newer without arguments (i.e. "ignore all upper bounds everywhere"). We've been considering dropping the no-argument form in favour of --allow-newer=all, though.

  11. hvr commented on Apr 14, 2018

    @hvr
    MemberAuthor

    we really should drop the w/o argument variant, as it's too error-prone and moreover it's a too big of a sledge hammer. If you really want to drop all bounds you should say so explicitly

  12. tom-bop commented on Apr 16, 2018

    @tom-bop

    Re: --allow-newer=all: what if there's a package you depend on named all?

  13. hvr commented on Sep 29, 2018

    @hvr
    MemberAuthor

    @tom-bop ...then the special meaning of all takes preference. Given its special meaning throughout the cabal UI, the package name all is marked a reserved package name on Hackage; so at least on Hackage we won't have to deal with this.

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions