-
Notifications
You must be signed in to change notification settings - Fork 711
cabal doesn't find a non-destructive install plan #2129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
/cc @kosmikus |
I may have a fix for this, but it requires more testing. It's all about tweaking heuristics, so it's potentially creating more problems than it solves. In general, there's no guarantee that a non-destructive install plan is chosen if there is one. You only have such a guarantee if you say The solver locally prefers an already installed package over any other version. However, whether that preference is respected depends on what other choices the solver has made already at this point. I'm going to explain the situation here, for future reference, also to myself. We're trying to install Doing so gives us this:
We end up with the undesired upgrade of Note that rejecting a different version of We can do the same with
As we see, not great either. Yay, no reinstall, but still an upgrade of There are two options to make progress:
I've implemented a change to
This looks much better. It chooses But this is a single example, and it's a significant change in heuristics. I'll run some more examples and tests to see how it seems to behave in general. I'm hopeful that this will turn out to be a general improvement, but I cannot yet say for certain. |
This changes the default solver heuristic to prefer package choice goals that have installed options over other goals. The reason is that this makes it less likely that undesired upgrades of already installed packages happen if they're not actually necessary. This is an attempt to fix haskell#2129.
If anyone wants to play with the change, it's at https://github.com/kosmikus/cabal/tree/prefer-goals-installed ... |
QQ: Isn't this mostly made redundant irrelevant by @ezyang's Nix-style packages work that's already in master? If so, please close. |
I think that the part of this issue related to the unnecessary upgrade of an installed package (transformers and mtl) is still relevant, because new-build still prefers installed packages. new-build will still need to deal with the packages that come with GHC, even if users have fewer reasons to install other packages globally. |
See #5276 for a newer example of cabal upgrading transformers unnecessarily. |
See UnkindPartition/tasty#80
The gist of it is that cabal unnecessarily suggests upgrading mtl from a globally installed version, then refuses to do it.
I thought the solver introduces constraints for the installed packages, but that didn't happen here, apparently.
The text was updated successfully, but these errors were encountered: