-
Notifications
You must be signed in to change notification settings - Fork 1.1k
#5617 Report dependants when a conflict occurs #5684
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
Conversation
- Update test to validate all conflict message - Retrieve dependants from previous graph node Signed-off-by: Uilian Ries <uilianries@gmail.com>
| self.retriever.save_recipe(libd_ref, libd_content) | ||
|
|
||
| with six.assertRaisesRegex(self, ConanException, "Conflict in LibB/0.1@user/testing"): | ||
| with six.assertRaisesRegex(self, ConanException, "Conflict in LibB/0.1@user/testing\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I get this message. It says a conflict in LibB/0.1 against a requirement defined by itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds weird, but the logic is correct.
I think it should be better this message:
Conflict in LibD/0.1@user/testing
Requirement LibA/0.2@user/testing conflicts with already defined LibA/0.1@user/testing in LibB/0.1@user/testing
To change it, override it in your base requirements
LibA/0.2@user/testing -> LibA/0.2@user/testing
LibA/0.2@user/testing -> LibB/0.1@user/testing
LibB/0.1@user/testing -> LibA/0.1@user/testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't understand this.
LibA/0.2@user/testing -> LibA/0.2@user/testing?
Is there a cyclic dependency LibA->LibB->LibA???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it should a root node actually.
LibA/0.2@user/testing -> root
LibA/0.2@user/testing -> LibB/0.1@user/testing
LibB/0.1@user/testing -> LibA/0.1@user/testing
The idea is illustrate that LibA/0.2@user/testing in under conflict with LibA/0.1@user/testing due LibB/0.1@user/testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I raise the stakes and ask if this is a conflict 🙈
If I'm not missing anything, this is the base graph of dependencies before this test:
This test modifies LibD with requires = "LibB/0.1@user/testing", ("LibA/0.2@user/testing", "override") so:
We can consider two scenarios:
- if
LibDis overriding requirements fromLibBthere is no such a conflict, as both should point toLibA/0.2now - every path to root (to
consumer) defines a different set of dependencies, then we have two paths and one of them doesn't go throughLibDso the dependency toLibAis not overridden in that one. In that case this message is ok, as the conflict is betweenLibBrequiringLibA/0.1(LibBis not overridden) andLibBrequiringLibA/0.2(if the library is overridden).
Please, tell me that my drawing is wrong, otherwise I would think that here we are not resolving the graph properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is still a conflict. When there are diamond structures, the overrides, or evaluated transitive dependencies should be the same. In the chain consumer->LibC->LibB, LibC is expecting to use LibA/0.1, there is no one in the chain that specifies otherwise. A newly introduced branch LibD by the consumer shouldn't be changing that behavior without the consumer knowing. An example:
- You have your app, that depends on Boost/1.70, which depends on OpenSSL/1.1 which depends on Zlib/1.2.11. All works good.
- Now you introduce in your app a new dependency to Poco/1.2 that depends on OpenSSL/1.1. but also has an override to ZLib/1.2.8. You want to detect that, not to downgrade to zlib/1.2.8 without noticing.
Summary: parallel branches in the dependency graph should agree on the versions or they will conflict, they cannot override each other, as there is no "priority" among them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Then it is a conflict and it is indeed a conflict between LibB and LibB (it would be really nice to improve the message, but it will require navigating through the graph and right now it is quite difficult).
conans/client/graph/graph_builder.py
Outdated
| " To change it, override it in your base requirements" | ||
| % (consumer_ref, new_ref, previous_ref)) | ||
| % (consumer_ref, new_ref, previous.ref, | ||
| next(iter(previous.dependants)).src)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only the first dependant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second is the package being built. But I understand your point, if we have more packages using defining the same version, then we should show them all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still sounds wrong. The first dependant is not necessarily the one causing the conflict (it can have the version overriden). The second one is not the one being built, could be just another package in the graph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, but as described on #5617 (comment), is hard to track when some conflict occurs. Showing both package and their linked node (package), helps to understand the problem. About the override feature, that's true, but when overriding the version we won't see this error.
|
suggestion first posted on #3098 (comment): would it be possible to show the dependency chain from the package user asked to create/install/info to the offending package (the one which has no recipe, or the conflicting packages), something like ProjectA/1.0.0@user/stable -> ProjectB/1.0.0@user/stable -> ProjectC/1.0.0@user/stable -> DeepDep/1.0.0@user/stable |
|
Another user with the same issue in #6362. I'm sure we can agree on the message and improve the user experience for the next release. |
memsharded
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge develop and solve conflicts.
I still need to understand that output...
conans/client/graph/graph_builder.py
Outdated
| " To change it, override it in your base requirements" | ||
| % (consumer_ref, new_ref, previous_ref)) | ||
| % (consumer_ref, new_ref, previous.ref, | ||
| next(iter(previous.dependants)).src)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still sounds wrong. The first dependant is not necessarily the one causing the conflict (it can have the version overriden). The second one is not the one being built, could be just another package in the graph.
| self.retriever.save_recipe(libd_ref, libd_content) | ||
|
|
||
| with six.assertRaisesRegex(self, ConanException, "Conflict in LibB/0.1@user/testing"): | ||
| with six.assertRaisesRegex(self, ConanException, "Conflict in LibB/0.1@user/testing\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't understand this.
LibA/0.2@user/testing -> LibA/0.2@user/testing?
Is there a cyclic dependency LibA->LibB->LibA???
…ure/conflict-ux
|
I just merged the develop branch into this PR |
|
Test are broken, please do check when possible. |
Signed-off-by: Uilian Ries <uilianries@gmail.com>
|
All green! 👍 |
jgsogo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the changes, it is a step forward and will help some users.
If I can comment about the message itself, I would prefer something like:
Conflict in '{consumer_ref}':
'{consumer_ref}' requires '{new_ref}' while '{next(iter(previous.dependants)).src}' requires '{previous.ref}'.
To fix this conflict you need to override the package '{new_ref.name}' in your root package.
|
@jgsogo your message looks better, I'll use it. |
Signed-off-by: Uilian Ries <uilianries@gmail.com>
|
@uilianries tests broken :) Please fix them and I will merge this. Thanks! |
|
Thanks for pinging |
Signed-off-by: Uilian Ries <uilianries@gmail.com>
jgsogo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚂


Changelog: Feature: Report in more details which packages are in conflict
Docs: Omit
closes #5617
developbranch, documenting this one.Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.