You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide a way to let cabal freeze freeze dependencies, only #7944
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.
Reacted by Brandon Simmons, Javier Neira and Benjamin Bray
cabal freeze is absolutely intended to constrain local packages. The desire is for a reproducible build, and the flag selection is absolutely part of reproducing the build.
Note that the debug flag could change the deps required, including their versions, in which case if you did a freeze with deps calculated with the flag on, and tried to run it with the flag off, the constraints might not even be satisfiable!
I mean, the intended usage is it records the flags and the deps both, and that freezes a reproducible configuration. If you want to have a reproducible configuration with a different set of flags, you use a different freeze file for that. Or, in this case, if you know your flag has no effect on dependencies, then, sure, delete the flag from the generated freeze file if you like.
Activity
gbaz commentedon Feb 1, 2022
cabal freezeis absolutely intended to constrain local packages. The desire is for a reproducible build, and the flag selection is absolutely part of reproducing the build.Note that the debug flag could change the deps required, including their versions, in which case if you did a
freezewith deps calculated with the flag on, and tried to run it with the flag off, the constraints might not even be satisfiable!robx commentedon Feb 1, 2022
So what's the intended usage story then for packages with flags?
gbaz commentedon Feb 1, 2022
I mean, the intended usage is it records the flags and the deps both, and that freezes a reproducible configuration. If you want to have a reproducible configuration with a different set of flags, you use a different freeze file for that. Or, in this case, if you know your flag has no effect on dependencies, then, sure, delete the flag from the generated freeze file if you like.