-
Notifications
You must be signed in to change notification settings - Fork 696
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
Solver: Detect cycles between packages and their setup scripts (fixes #4161). #5023
Conversation
@grayjay so in the case of the example in #4980, what does "breaking the cycle" mean? that it uses whatever This makes me wonder a bit: What would happen if |
This change just causes the solver to backtrack when a package's setup script depends on the same instance of the package. The solver could choose any other solution, such as using an installed version of the package for the setup script or avoiding the package entirely. When I ran it on the example in #4980, it used
The choice doesn't really make sense in this case, but I think it's still an improvement over choosing the same instance. Maybe the solver should prevent packages from directly depending on any version of the same package, to avoid the ambiguity that you mentioned. We would also need to filter the default setup dependencies added by new-build. I think we would still need to allow indirect dependencies on the same package; for example, Cabal depends on I tried copying Data/Binary.hs to the top-level directory, but I wasn't sure how to make cabal use it for the setup script, even if I renamed it to not conflict with the existing binary module. |
I think I found a test-only bug that is causing the solver QuickCheck tests to time out. I'll try to make a PR this weekend. |
I made a PR to fix the QuickCheck failures: #5035 |
…askell#4161). The solver already detected cycles involving more than one package, but it allowed dependencies between components within a package. This commit treats a dependency between a package's setup script and library as a cycle in order to allow the solver to backtrack and try to break the cycle. A more thorough solution would involve tracking all dependencies between components, as in haskell#4087. This commit also fixes the internal error in issue haskell#4980.
The solver already detected cycles involving more than one package, but it
allowed dependencies between components within a package. This commit treats a
dependency between a package's setup script and library as a cycle in order to
allow the solver to backtrack and try to break the cycle. A more thorough
solution would involve tracking all dependencies between components, as in #4087.
This commit also fixes the internal error in issue #4980.
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!
/cc @kosmikus @hvr