cargo: fix pre-release version constraint handling#15661
cargo: fix pre-release version constraint handling#15661joaquinhuigomez wants to merge 1 commit intomesonbuild:masterfrom
Conversation
Meson's version_compare treats pre-release suffixes (e.g. 0.8.0-rc.7) as greater than the stable release, but semver specifies the opposite. Strip pre-release suffixes when converting Cargo version constraints so that stable versions correctly satisfy pre-release constraints.
This seems like kind of a hack: Maybe if these versions are to be compared using semver rules, we should have an actual implementation of that? Which would make it easier to surface support for that kind of comparison into It seems like I actually sketched out an implementation for making |
|
Fair point — a proper semver scheme parameter would be cleaner than patching the default comparator. Happy to rework this toward that approach if you think it's worth reviving the idea from #4017. |
|
Our default version compare is rpm compatible, and I'd prefer to keep it that way for consistency (though I probably wouldn't have picked the RPM format if I was implementing it). This matters because pkg-config uses an RPM compatible version comparison. There's a lot of of hackery we do to make cargo/rust versions work correctly, and having a builtin handler of some kind makes sense to me. @bonzini on the cargo part |
|
Makes sense to keep rpm as the default. Happy to wait for input from @bonzini on the cargo side before deciding the direction here. |
|
I like the idea of adding a Bonus points for a FeatureDeprecated if either version has an alphanumeric component and no |
|
That makes sense — parsing semver into the existing Version tuple format keeps the comparison logic clean. I'll rework the PR to add a |
Fixes #15636
Meson's version_compare treats pre-release suffixes (e.g.
0.8.0-rc.7) as greater than the stable release, but semver specifies the opposite. This causes dependency resolution to fail when a stable version like0.8.0should satisfy>= 0.8.0-rc.7.Strip pre-release suffixes when converting Cargo version constraints to meson format so that stable versions correctly satisfy pre-release constraints.