-
Notifications
You must be signed in to change notification settings - Fork 352
fix(conan): Properly check for Conan version #10493
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(conan): Properly check for Conan version #10493
Conversation
Conan v1 and v2 return 'Conan version X.XX' when called with '--version' parameter. To properly determine which variant of the Conan handler to be used, the full prefix has to be checked, otherwise ConanV2Handler will always be used. Signed-off-by: Jens Erdmann <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10493 +/- ##
=========================================
Coverage 56.75% 56.75%
Complexity 1644 1644
=========================================
Files 337 337
Lines 12480 12480
Branches 1177 1177
=========================================
Hits 7083 7083
Misses 4945 4945
Partials 452 452
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
||
private val handler by lazy { | ||
if (command.getVersion().startsWith("1.")) { | ||
if (command.getVersion().startsWith("Conan version 1.")) { |
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.
Removing this prefix is already done in line 77, so I don't think it's necessary.
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.
Oh I missed that one.
Then I am running out of ideas. I am still running into the issue that ConanV2Handler is used in combination with Conan version 1:
14:12:24.377 [DefaultDispatcher-worker-1] WARN org.ossreviewtoolkit.plugins.packagemanagers.conan.ConanV2Handler - Failed to list remotes.
14:12:25.568 [DefaultDispatcher-worker-1] ERROR org.ossreviewtoolkit.analyzer.PackageManager - Conan failed to resolve dependencies for path 'conanfile.py': IOException: Running 'conan graph info -f json --out-file /tmp/ort-ConanV2Handler12215941369031907775/info.json -s compiler=gcc -s compiler.libcxx=libstdc++ -s compiler.version=11.1 conanfile.py' in '/builds/Jens.Erdmann/mflstd-impl' failed with exit code 1:
ERROR: Unknown command '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.
Maybe @nnobelis can help here. But please move the discussion to, well, GitHub discussions or to Slack then.
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.
As a side note, #10127 might be of interest to you, @jens-erdmann.
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.
Makes sense. Sorry for the noise
@sschuberth I have found the issue and a fix for it. Should we reopen this or should I file a new PR? |
It depends a bit on how different the solution (commit titles and code) would be, but I'd have a tendency for opening a new PR in this case. |
Conan v1 and v2 return 'Conan version X.XX' when called with '--version' parameter. To properly determine which variant of the Conan handler to be used, the full prefix has to be checked, otherwise ConanV2Handler will always be used.
For reference the outputs of Conan v1 and v2 from Docker image version 61.0.0:
ort@e3e6081438c0:~$ conan --version
Conan version 1.66.0
ort@e3e6081438c0:~$ conan2 --version
Conan version 2.14.0