Skip to content
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

rattler_conda_types::Version::to_string() does not preserve case #527

Closed
0xbe7a opened this issue Feb 12, 2024 · 2 comments
Closed

rattler_conda_types::Version::to_string() does not preserve case #527

0xbe7a opened this issue Feb 12, 2024 · 2 comments

Comments

@0xbe7a
Copy link
Contributor

0xbe7a commented Feb 12, 2024

When uploading packages with rattler-build, we use different fields from parsed IndexJson to upload packages to anaconda.org. If we attempt upload a package with version 1.2.3_Beta1, it will fail because the original version case is lost after parsing and version.to_string() will return 1.2.3_beta1. Subsequently a release 1.2.3_beta1 is created but anaconda.org rejects the package upload as the versions from the IndexJson and the release are not the same. While it is true that 1.2.3_Beta1 == 1.2.3_beta1 when comparing versions, rattler should return the version with the original version when calling .to_string().

The following unit-test should pass:

#[test]
fn preserve_case() {
    let v = "1.2.3-Beta1";
    let version = Version::from_str(v).unwrap();
    assert_eq!(version.to_string(), v);
}
@baszalmstra
Copy link
Collaborator

We have VersionWithSource for that use case. Does that help?

@0xbe7a
Copy link
Contributor Author

0xbe7a commented Feb 12, 2024

Yeah, missed it. Works perfectly for this use-case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants