In one of my packages, I semi-recently added an overly strict dependency version constraint to work around a bug in that particular version of the package. However, as new versions of other packages have been released, this is now causing dependency conflicts for some of my users. One of them helpfully suggested to replace the current, overly strict, constraint zip-archive == 0.2
with something along the lines of (zip-archive <= 0.2.3 && binary >= 0.5) || (zip-archive >= 0.2.3.1 && binary >= 0.7)
- that is, depend either on A or on B, and we don't really care which one.
Is there a way to express this in Cabal?
While I haven't verified this, I think you can do it using a flag:
flag someName
default: True
library
if flag(someName)
build-depends:
zip-archive >= 0.2.3.1,
binary >= 0.7
else
build-depends:
zip-archive <= 0.2.3,
binary >= 0.5
The solver will pick the branch that makes the overall constraint problem solvable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With