Skip to content

Request: 'cabal freeze --dry-run --no-installed-constraint' #2178

Closed
@mietek

Description

@mietek

Cabal automatically sets global installed constraints for installed packages, even during a dry run. Hence, if a local constraint conflicts with an installed package, Cabal will fail to resolve dependencies.

$ cat >fnord.cabal <<EOF
name:           fnord
version:        0.0
build-type:     Simple
cabal-version:  >= 1.2

executable fnord
  build-depends:  base == 4.7.0.0
EOF

$ cabal --no-require-sandbox freeze --dry-run
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: fnord-0.0 (user goal)
next goal: base (dependency of fnord-0.0)
rejecting: base-4.7.0.1/installed-1a5... (conflict: fnord => base==4.7.0.0)
rejecting: base-4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0, 4.5.1.0, 4.5.0.0, 4.4.1.0,
4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0, 4.1.0.0, 4.0.0.0,
3.0.3.2, 3.0.3.1 (global constraint requires installed instance)
Dependency tree exhaustively searched.

This makes it difficult to automatically determine the version of GHC needed to install a package, as it is no longer sufficient to just look at Cabal constraints. An option to prevent Cabal from setting global installed constraints would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions