-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
rust: suggest correct dependency when found in Cargo.lock #13448
base: master
Are you sure you want to change the base?
rust: suggest correct dependency when found in Cargo.lock #13448
Conversation
{ | ||
"stdout": [ | ||
{ | ||
"line": "test cases/rust/26 cargo lock suggest dependency/meson.build:3:0: ERROR: Rust dependency \"bar-1.0-rs\" not found, but following versions were found using Cargo.lock import: \"bar-1-rs\", \"bar-2-rs\", \"bar-0-rs\", \"bar-0.8-rs\"" |
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.
I'm not sure whether this really needs a test. All we are testing is the warning message, no? Does that really need an integration test?
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.
If someone changes the cargo.lock import feature later, it would be useful to notice this. But if you don't see any value in this test, I can remove it too.
5ce9af5
to
f288c1e
Compare
fixed extra parentheses on the if. |
f288c1e
to
69f30dc
Compare
Report error only if dependency is required. |
s = name.split('-') | ||
if len(s) < 3: | ||
continue | ||
rs_ending = s.pop() |
Check notice
Code scanning / CodeQL
Unused local variable Note
if len(s) < 3: | ||
continue | ||
rs_ending = s.pop() | ||
version = s.pop() |
Check notice
Code scanning / CodeQL
Unused local variable Note
mesonbuild/wrap/wrap.py
Outdated
s = wrap.name.split('-') | ||
if len(s) < 3: | ||
continue | ||
rs_ending = s.pop() |
Check notice
Code scanning / CodeQL
Unused local variable Note
mesonbuild/wrap/wrap.py
Outdated
if len(s) < 3: | ||
continue | ||
rs_ending = s.pop() | ||
version = s.pop() |
Check notice
Code scanning / CodeQL
Unused local variable Note
69f30dc
to
f0fed38
Compare
fixed lint issues |
@eli-schwartz How can we indicate to meson test infra that the test is supposed to fail? |
83d2050
to
38d4b72
Compare
More idiomatic python. |
38d4b72
to
5bc92f9
Compare
Use rsplit to extract crate name + update test to have crate with |
Thanks for your recommendations @dnicolodi @eli-schwartz. I'm still looking for a way to indicate the test is supposed to fail. If you have suggestion, I would be happy to implement it to fix CI. |
As we refer to crates using API version instead of plain version, it can be confusing to user which is left with a simple "Dependency X not found". Thus, when we detect that a rust dependency is missing, and is not available using a wrap file, if we find something compatible using Cargo.lock import, we just list the correct dependencies names.
5bc92f9
to
2272524
Compare
Found how to implement a "failing" test, and rebased on top of master. |
Test failure does not seem related to this patch (lto issue on cygwin). |
As we refer to crates using API version instead of plain version, it can be confusing to user which is left with a simple "Dependency X not found".
Thus, when we detect that a rust dependency is missing, and is not available using a wrap file, if we find something compatible using Cargo.lock import, we just list the correct dependencies names.