Skip to content

Conversation

@uilianries
Copy link
Member

@uilianries uilianries commented Aug 28, 2019

  • Update test to validate all conflict message
  • Retrieve dependents from previous graph node

Changelog: Feature: Report in more details which packages are in conflict
Docs: Omit

closes #5617

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, 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.

- 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"
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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???

Copy link
Member Author

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

Copy link
Contributor

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:

image

This test modifies LibD with requires = "LibB/0.1@user/testing", ("LibA/0.2@user/testing", "override") so:

image

We can consider two scenarios:

  • if LibD is overriding requirements from LibB there is no such a conflict, as both should point to LibA/0.2 now
  • every path to root (to consumer) defines a different set of dependencies, then we have two paths and one of them doesn't go through LibD so the dependency to LibA is not overridden in that one. In that case this message is ok, as the conflict is between LibB requiring LibA/0.1 (LibB is not overridden) and LibB requiring LibA/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.

Copy link
Member

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.

Copy link
Contributor

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).

" 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))
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

@ericLemanissier
Copy link
Contributor

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
There can be several chain from ProjectA to DeepDep, showing any of them is a useful information, showing all of them would be even better.

@jgsogo
Copy link
Contributor

jgsogo commented Jan 15, 2020

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.

@jgsogo jgsogo added this to the 1.23 milestone Feb 4, 2020
Copy link
Member

@memsharded memsharded left a 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...

" 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))
Copy link
Member

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"
Copy link
Member

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???

@uilianries
Copy link
Member Author

I just merged the develop branch into this PR

@memsharded
Copy link
Member

Test are broken, please do check when possible.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries
Copy link
Member Author

All green! 👍

Copy link
Contributor

@jgsogo jgsogo left a 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.

@uilianries
Copy link
Member Author

@jgsogo your message looks better, I'll use it.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@memsharded
Copy link
Member

@uilianries tests broken :) Please fix them and I will merge this. Thanks!

@uilianries
Copy link
Member Author

Thanks for pinging

Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚂

@jgsogo jgsogo merged commit f495493 into conan-io:develop Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

report both conflicting packages

4 participants