haskell / haskell/cabal

Provide a way to let `cabal freeze` freeze dependencies, only

Open
#7,944 3 comments 3 reactions 0 assignees View on GitHub
cabal-install: cmd/freeze type: user-question
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
I'm not sure whether there's a bug, but the behaviour I see is, e.g.:

- create `x.cabal` with a flag definition:
```
flag debug
description: Enable debug support
default: False
```
- run `cabal freeze`; `cabal.project.freeze` now includes `x -debug`
- in `cabal.project.local`, set `flags: +debug`

Now `cabal build` fails:
```
[__1] rejecting: x:-debug (constraint from config file, command line flag, or
user target requires opposite flag selection)
[__1] rejecting: x:+debug (constraint from project config
/private/tmp/x/cabal.project.freeze requires opposite flag selection)
```

I can work around this by following up `cabal freeze` with removing the flag constraint on `x`, but that's painful. Some thoughts:

- should `cabal freeze` constrain local packages at all?
- `cabal freeze` help lists the flag `--dependencies-only`, which doesn't seem to do anything; maybe it could be made to not set local package flags?

Tested with cabal-install 3.6.2.0 on macOS.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.