Ticket #925 (closed defect: fixed)

Opened 16 months ago

Last modified 15 months ago

Unused constraints result in "no available version"

Reported by: snoyberg Owned by:
Priority: normal Milestone: cabal-install-0.14
Component: cabal-install tool Version: 1.10.2.0
Severity: normal Keywords:
Cc: Difficulty: unknown
GHC Version: Platform:

Description

When testing out my recently released cabal nirvana[1], Greg Weber pointed out than when building a package that does not use all of the constraints in the Nirvana file, you get a message such as:

cabal: There is no available version of authenticate that satisfies ==1.0.0.1

I confirmed that this happens with command-line constraints as well. A simple test case is to go into a non-Yesod project and run:

cabal install --constraint "yesod >= 0.10"

Unfortunately, this prevents nirvana from being of any use at all, which was our best shot at avoiding dependency hell.

[1]  http://hackage.haskell.org/package/cabal-nirvana

Change History

Changed 16 months ago by snoyberg

  • component changed from Cabal library to cabal-install tool

Changed 16 months ago by kosmikus

  • summary changed from Unused constraints result in "no available version" to More flexible constraints, specified via local preferences file
  • type changed from defect to enhancement
  • milestone set to cabal-install-0.14

I've changed your bug into an enhancement request. What you're describing is intended behaviour. A constraint passed on the command line acts the same as a constraint put in the build-depends of a package, i.e., it not only restricts the range of versions, but also causes the package to actually be installed.

The closest to what you want that currently exists is --preference, and it should actually be sufficient in most cases. A --preference constraint does not prevent excluded versions from selected at all, but it will first try all preferred versions.

I appreciate the attempt you make with cabal-nirvana, but I don't like that it works by actually changing the downloaded files. Cabal already supports a global preferences file that's downloaded from Hackage. It should probably support local files with preferences, too. That would be relatively easy to change.

So there are two possible enhancements in this issue:

  • introduce a way to easily specify a large number of local preferences,
  • next to constraints introduced by --preference and --constraint

The mail

 http://www.mail-archive.com/haskell-cafe@haskell.org/msg96962.html

as well as the surrounding thread are also somewhat related.

Changed 16 months ago by kosmikus

Also see #380.

Changed 16 months ago by kosmikus

I may have misunderstood the intended meaning of the --constraint flag. Investigating.

Changed 15 months ago by kosmikus

  • status changed from new to closed
  • type changed from enhancement to defect
  • resolution set to fixed
  • summary changed from More flexible constraints, specified via local preferences file to Unused constraints result in "no available version"

Ok. I think that I have indeed mistakenly assumed that the old behaviour of --constraint was intended when it was not. Sorry for that.

In the current development repository (and in the upcoming cabal-install-0.14), constraints behave as was the assumption in this bug report originally. Saying --constraint=... on the command line does *not* introduce a target, it merely constrains the package.

So I'll restore the original title and consider this bug as fixed.

Note: See TracTickets for help on using tickets.