haskell / cabal

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

--allow-newer doesn't work for build-tools #4431

Open RyanGlScott opened 7 years ago

RyanGlScott commented 7 years ago

The --allow-newer flag doesn't appear to work with build-tools. Given this simple .cabal file:

name:                foo
version:             0.1.0.0
build-type:          Simple
cabal-version:       >=1.10

library
  build-depends:       base
  build-tools:         alex < 3.2
  default-language:    Haskell2010

Trying to configure it fails when I have alex-3.2.1 installed, even with --allow-newer:

$ cabal configure --allow-newer
Resolving dependencies...
Configuring foo-0.1.0.0...
cabal: The program 'alex' version <3.2 is required but the version found at
/u/rgscott/.cabal/bin/alex is version 3.2.1
ezyang commented 7 years ago

CC @Ericson2314. Since allow-newer operates by rewriting dependencies, it should simply be a matter of also rewriting build-tools-depends.

hvr commented 7 years ago

@ezyang The way it acts now is a hack, please don't add to it by introducing additional tech debt (whcih we'd have to break and confuse users once we clean it up, or alternatively have tedious debates whether we can even change it again once users start depending on the broken semantics). Especially, allow-newer/older ought not to automatically act on qualified goals, even less so on non-lib deps. We need to harmonize this with the --constraint syntax for consistency.

andreasabel commented 5 years ago

@RyanGlScott: Me too.
@ezyang @hvr: Anything happening on this frontier?

hvr commented 5 years ago

@andreasabel not yet; first step is to define the new tool-aware extended syntax of --allow-{newer,older} (ideally we'd also take into account future support for qualified-aware relaxation, but that requires moving the logic into the solver -- which is a long-term goal, as the current pd-rewriting implementation a crude hack which runs into some issues); once the spec is available, the implementation should be fairly easy

ulysses4ever commented 1 year ago

6687 looks related