-
Notifications
You must be signed in to change notification settings - Fork 704
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
Correctly link setup dependencies of linked packages #3268
Conversation
Looks fine to me. /cc @kosmikus |
cc/ @edsko |
This commit fixes #3248. |
I'm not sure I understand. You write in your test case docs:
This all makes perfect sense. However, if we are linking 1.C to 0.C, then surely 1.C's setup dependencies and 0.C's setup dependencies must in fact be linked. After all, linking 1.C to 0.C means that 1.C and 0.C are the very same package; they must be completely identical. What am I missing? |
I mean: it is true that 1.C's direct dependency on D and it's setup dependency on D should not be linked together, nor should 0.C's direct dependency on D and it's setup dependency on D. But 1.C's setup dependency on D should be linked to 0.C's setup dependency on D, and similarly 1.C's direct dependency on D should be linked to 0.C's direct dependency on D. |
Oops! I didn't realize that |
When the solver links a package, it also merges the 'LinkGroup's of the package's direct dependencies. This commit causes the solver to skip setup dependencies, which should remain independent of the package's other dependencies.
a6a637f
to
5824e63
Compare
@edsko I pushed another commit that links setup dependencies to other setup dependencies. I don't know if it's the best approach, since it treats direct setup dependencies as a special case. I initially tried using only the qualified package name to determine how to link a dependency. For example, if |
Wait... Maybe I'm starting to see what's going on. You are now manually qualifying the setup dependencies with the appropriate qualifier; maybe what you are saying here is that we should use |
@edsko Yes, I see that I need to use some of the logic in I just tried fixing the bug by using
This is only a problem when there is more than one qualifier. |
Hmmmm this is kind of subtle actually. Looking at the code, actually the dependencies that get passed as an argument to |
(Whatever the result is, this better be properly documented somewhere! Write a note!) |
+1. |
@grayjay Yep. |
@edsko, if you think that this fix is correct, feel free to merge. |
@23Skidoo No, the PR as currently pushed here is not completely correct I think. Let me give this some thought right now. |
@grayjay What do yo think of https://github.com/edsko/cabal/tree/pr/FixLinkDeps ? Single additional commit on top of your PR. Basically, the idea is that we requalify all dependencies in |
@edsko Thanks for working on this PR. Here is what I think happens after the solver chooses a flag for |
Hmmm, I see where you are coming from. I briefly experimented with having But it seems reasonable to have (and document) the following invariant: Package qualification should not depend on flag assignment (It may depend on global solver flags of course.) That addresses your concern, doesn't it? And if we state it like that, it seems like a very reasonable thing to insist on. It's complicated enough as it is; if we have local differences in qualification, I foresee no end of headaches. What do you think? |
@edsko I think that invariant makes sense. Do you want to open a new PR? |
https://github.com/edsko/cabal/tree/pr/FixLinkDeps fixed the issue and was included in #3357. The test from this PR was also included (2f4c440). |
See #3268 (comment) (cherry picked from commit 4ff4e2b)
See haskell#3268 (comment) (cherry picked from commit 4ff4e2b)
When the solver links a package, it also merges the
LinkGroup
s of the package's direct dependencies. This commit causes the solver to skip setup dependencies, which should remain independent of the package's other dependencies.Here is the test's log without the fix. It shows a
LinkGroup
containing both setup and non-setup goals for packageD
, which causes the solver to rejectD-2
forC
's setup script.