-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(datasource/crate): preserve build metadata #36005
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
base: main
Are you sure you want to change the base?
Conversation
@@ -299,7 +299,7 @@ exports[`modules/datasource/crate/index > getReleases > processes real data: lib | |||
"version": "0.2.50", | |||
}, | |||
{ | |||
"version": "0.2.51", | |||
"version": "0.2.51+metadata", |
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 believe the build metadata will eventually go through applyDatasourceFilters
, so should be fine here.
(though I haven't found a place to test this)
@@ -110,7 +110,7 @@ export class CrateDatasource extends Datasource { | |||
result.releases = lines | |||
.map((version) => { | |||
const release: Release = { | |||
version: version.vers.replace(/\+.*$/, ''), | |||
version: version.vers, |
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.
version: version.vers, | |
version: version.replace(/\+.*$/, ''), | |
versionOrig: version.vers, |
maybe we should better use gitRef
here? 🤔
gitRef: tag_name, |
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... but the version string here has nothing to do with git.
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.
@weihanglo can you please sign the cla?
@rarkins are you fine with this solution / workaround?
otherwise LGTM
Signed. Thank you! |
Co-authored-by: Michael Kriese <[email protected]>
Just fixed I think it is ready to merge. Thank you |
Thanks for the review! I am not sure what went wrong in the test coverage though: https://app.codecov.io/gh/renovatebot/renovate/pull/36005 |
Yeah, it's branches in ?? conditional, very annoying, but usually could be fixed by providing data for the rightmost value in expression |
Thanks. 661d18d fixes the missing branch coverage I believe. |
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.
otherwise LGTM
@@ -112,6 +112,9 @@ export class CrateDatasource extends Datasource { | |||
const release: Release = { | |||
version: version.vers.replace(/\+.*$/, ''), | |||
}; | |||
if (release.version !== version.vers) { | |||
release.versionOrig = version.vers; |
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.
@rarkins I think it should be stored in a property like the managerData instead because this field can be overwritten by a user extract config 🤔
Changes
Add a default
extractVersion
for cargo manager to remove build metadata,instead of manual stripp inside
CrateDatasource.getReleases
.This is just a proof of concept showing what I found. And sorry I didn't open a discussion first 😞. Feel free to close it.
Context
rust-lang/cargo#15557 (comment)
0.4.80+curl-8.12.1
.postprocessRelease
use the stripped version, which cannot be found because original exact version string is required, such ashttps://crates.io/crates/curl-sys/0.4.80+curl-8.12.1
.Documentation (please check one with an [x])
extractVersion
is added?How I've tested my work (please select one)
I have verified these changes via: