Skip to content
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

Bugfix: Overridden requirement not found in lockfile #8907

Conversation

harendt
Copy link
Contributor

@harendt harendt commented May 2, 2021

Changelog: Bugfix: Fix that overridden requirements "cannot be found in lockfile".
Docs: omit

Fixes: #8870

In order to lock all requires of a recipe, the existing method GraphLock::lock_node() searches the requires field of a graph node for the corresponding references. But requirements with the property override=True are not included in the graph node's requires field, which leads to the error: Require '<package name>' cannot be found in lockfile. To fix this issue, the GraphLock::lock_node() method now searches transitive requires fields of a node if a requirement has the property override=True. A corresponding integration test has been added. The new integration test is failing without the fix, but passing with the fix.

  • 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.
  • N/A (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.

This fixes bug conan-io#8870, but it changes the layout of dependency graphs and
breaks several existing tests.
…dependencies

If a ConanFile defines a requirement with the property 'override=True',
GraphLock::lock_node() now searches the whole dependency graph instead
of just the direct dependencies of corresponding node.  This is
necessary because requirements of a ConanFile that were defined with the
property 'override=True' are not included in the 'requires' field of the
node that corresponds to that recipe.
@CLAassistant
Copy link

CLAassistant commented May 2, 2021

CLA assistant check
All committers have signed the CLA.

@harendt harendt marked this pull request as ready for review May 2, 2021 19:10
@memsharded memsharded added this to the 1.39 milestone Jun 30, 2021
@memsharded
Copy link
Member

Hi @harendt

Sorry this has taken a while to process. I am assigning it to next release, so we allocate some time to review it.
Thanks for your contribution!

@memsharded
Copy link
Member

Hi @harendt

I have proposed an alternative solution to this fix in #9215. The principle is that overrides do already exist as real requires elsewhere, that will be correctly extracted from the lockfile, so they can be ignored, no need to lock an override.

Please have a look. I have also added a way more simple test, probably it wasn't necessary a full CI test to fix this issue.

I wanted to do a PR to your fork, but it is a bit outdated from develop branch, and I didn't want to push changes directly. I would like to keep your contribution and your test, if you want to extract my fix and my test from this PR to yours, I'd be happy.

@harendt
Copy link
Contributor Author

harendt commented Jul 7, 2021

Sure, I can do that. What is your preferred way to "extract" your changes? Should I just merge your branch? Or should I cherry-pick your changes? In the latter case I would also have to rebase my branch onto the develop branch from conan-io or merge develop into my branch.

@memsharded
Copy link
Member

Sure, I can do that. What is your preferred way to "extract" your changes? Should I just merge your branch? Or should I cherry-pick your changes? In the latter case I would also have to rebase my branch onto the develop branch from conan-io or merge develop into my branch.

As you wish, at the end, the PR is squashed and merged, so whatever is easier for you.

…t-not-found-in-lockfile' into bugfix/overridden-requirement-not-found-in-lockfile
@memsharded memsharded merged commit bcc56f3 into conan-io:develop Jul 9, 2021
@memsharded
Copy link
Member

Perfect, thanks for reporting and contributing this fix! Will be in next 1.39

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.

[bug] Overridden requirement "cannot be found in lockfile"
3 participants