-
Notifications
You must be signed in to change notification settings - Fork 993
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
fix(requires): don't stop propagating requires in build context #16333 #16539
fix(requires): don't stop propagating requires in build context #16333 #16539
Conversation
2519f44 summarizes the changes - requires in build context don't change having |
Thanks for contributing this. I have been wanting to move this forward a bit, but difficult to prioritize it high enough. The fact that are tests changing behavior is something that we need to carefully investigate, to see if something could be breaking. Specially how it affect other traits. I'll try to have a look at this in the following weeks, thanks! |
To my understanding, this is very much to be expected. This first if conan/conans/model/requires.py Lines 271 to 275 in cb106f0
conan/conans/model/requires.py Lines 277 to 283 in cb106f0
visible=False .
I do not fully understand why one would want to change traits when transforming a requirement downstream, maybe you can point me to some docs / other code? Using Note that stopping propagation when conan/conans/model/requires.py Lines 267 to 269 in cb106f0
As |
Sure, I am not saying that the changes look incorrect. Still for any changes like this we need to carefully analyze possible impact on users relying on that "incorrect" behavior and the ways they could be broken. Then, if it is what makes sense we can declare it a bug fix and move forward with it, it is just that we need a little time to review it, so it doesn't look possible to squeeze it in this release due in a couple of days, and it is planned for the next one. |
Dear @memsharded, is there anything more we could test? In particular, is this the correct target branch and will those changes land in 2.6.0? In that case, I'd update the branch and we might consider already rolling it out locally to check for any potential flaws - this should be the last showstopper before switching to conan 2 for us. |
Thanks @maximilianmuehlbauer for the ping. Everything is good, the branch is look, I am just trying to allocate some time for this, but it is being challenging, too many things on our plate, and this requires some quite deep consideration, cannot be done lightly. It is scheduled for next 2.6, hopefully we can have a look in the following weeks. |
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.
We have been considering this, and we think this is a bit too risky, and the cases for making visible "build" requires and propagating them downstream need a different consideration than regular requires, then don't follow the same rules.
We still understand that there might be some cases that could benefit from having propagating build requires, but we think it is necessary to build from them, from the real use case up, and not by changing the current logic and changing the affected tests.
The recommendation would be to start with some "real" use case in a form of a new test, that requires one or several tool-requires to be visible=True
. It is fine if the test is initially broken, we don't need the solution yet. From there we could work and define the right propagation logic for build requires, satisfying the real use case, and take an incremental approach from there, satisfying the use cases with the minimal "safest" changes.
if self.build and dep_pkg_type is not PackageType.SHARED and not require.run: # Build-requires | ||
return # don't propagate non-run packages |
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.
Propagation of visible=True
is not only about traits, packages do not only conflict because having headers
, even if they don't 2 different packages (for the same package name) with visible=True
will conflict.
If they don't conflict, there could be 2 different version of the same myscripts/version
package being propagated down the graph as visible, but not conflicting would be a problem.
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.
Hmm okay but shouldn't then requirements always be propagated when they are visible
? This is definitely not the case in the current implementation.
@@ -1194,9 +1194,9 @@ def test_visible_build_transitivity(self): | |||
# node, headers, lib, build, run | |||
_check_transitive(app, [(libd, True, True, False, False), | |||
(libc, True, True, False, False), | |||
(libb, False, False, True, False)]) | |||
(libb, True, True, True, False)]) |
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 change sounds problematic. It means it is propagating headers and libs from the build context to the host context, which will be broken in majority of cases. I don't think that headers and libs that might be in a package containing an executable that we are using via tool-requires
and some user decides to make it visible=True
to propagate such executable should start receiving headers+libs of a potentially different architecture, as they will result in compilation and/or link errors. Note this trait means" the libb
is contributing headers and libs to app
, which wouldn't be correct accross contexts.
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 that definitely makes sense. But shouldn't in that case headers
, libs
, transitive_headers
, transitive_libs
always be False
in the build context?
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.
Should that maybe be enforced somewhere?
I have now opened #16849 with a more minimal set of changes based on a new test with complex requirement tree; specifically |
Closing as #16849 has been merged instead |
Changelog: Fix #16333
This Pull Request treats requires in build context just like normal requires, i.e. their propagation isn't stopped arbitrarily if
visible=True
is set. Note thatbuild_
,tool_
andtest_
requires default tovisible=False
so this should only change things if users explicitly put a requirement in build context and setvisible=True
.The proposed changes fix the example in the linked issue and also our local Simulink workflow. Please let me know about additional checks / use cases to be performed or where unit tests could be added.
Docs: https://github.com/conan-io/docs/pull/XXXX
develop
branch, documenting this one.