Open AbrilRBS opened 1 month ago
I think there might be some bootstraping situations where there might be a tool-require to a previous version. If the error is being correctly raised as a "loop in the graph", maybe we want to do the extra checks and error messages once the loop is detected and not in the build-profile? I am trying to avoid possible false positives and missing true positives (like if the loop happens because more than 1 tool-require).
I am not sure about how to reproduce this, following test passes:
def test_loop_build_profile():
c = TestClient(light=True)
c.save({"fmt/conanfile.py": GenConanfile("fmt", "1.0"),
"tool/conanfile.py": GenConanfile("tool", "1.0"),
"profile": "[settings]\nos=Linux\n[tool_requires]\n*:fmt/1.0"})
c.run("export fmt")
c.run("export tool")
c.run("install --requires=fmt/1.0 -pr:b=profile -b=missing")
print(c.out)
Conan 2 already contains some code to prevent depending on itself:
for pattern, tool_requires in profile.tool_requires.items():
if ref_matches(ref, pattern, is_consumer=conanfile._conan_is_consumer):
for tool_require in tool_requires: # Do the override
if str(tool_require) == str(ref): # FIXME: Ugly str comparison
continue # avoid self-loop of build-requires in build context
What is your suggestion?
We've seen some issues lately with users finding graph loops because of the usage of the
[tool_requires]
section in the build profile, affecting the same libraries they are trying to automatically includeie
In a build profile would generate a loop, with the solution being to, in this case, not include such library in the include pattern
We need a better error message for these cases, as the users are most of the time not aware where the issue is coming from (we might also need to add a note in the documentation about this too)
Something maybe like this?
Have you read the CONTRIBUTING guide?