Repository navigation
feat: fix issue #22 by adding support for rpm - #52
Open
georgbramm wants to merge 5 commits into
Open
georgbramm wants to merge 5 commits into
georgbramm wants to merge 5 commits into
Conversation
georgbramm
marked this pull request as draft
August 14, 2026 09:57
Contributor
Author
|
trying to solve this pr using https://crates.io/crates/rpm-version tomorrow |
Contributor
Author
|
adopted it to use crate rpm-version = "0.5.1" |
georgbramm
marked this pull request as ready for review
November 4, 2026 14:50
There was a problem hiding this comment.
🟡 Changes recommended
RPM is unavailable through public dynamic APIs, and inconsistent equality and hashing can produce incorrect range containment and duplicate detection.
6 open issues
What changed in this PR
This PR introduces a typed RPM versioning scheme backed by rpm-version, extending the library’s version comparison and constraint support.
Changes:
- Adds
RpmVersionwith EVR comparison, native constraint parsing, and string serialization. - Adds tests for RPM ordering, ranges, and serialization round trips.
- Adds dependencies and switches dynamic-range tests to the
assert_matchescrate.
| File | Description |
|---|---|
src/schemes/rpm.rs |
Implements the RPM version type, native conversion, and unit tests. |
src/schemes/mod.rs |
Exports the RPM module. |
src/range/vers.rs |
Adds RPM ordering and native constraint tests. |
src/range/dynamic.rs |
Updates the test assertion macro import. |
Cargo.toml |
Adds rpm-version and the assert_matches test dependency. |
Cargo.lock |
Locks the new dependencies. |
Review effort: Balanced
| pub mod cargo; | ||
| pub mod deb; | ||
| pub mod intdot; | ||
| pub mod rpm; |
Comment on lines
+53
to
+55
| let p1 = rpm_version::Evr::parse(&self.raw); | ||
| let p2 = rpm_version::Evr::parse(&other.raw); | ||
| p1 == p2 |
|
|
||
| impl std::hash::Hash for RpmVersion { | ||
| fn hash<H: std::hash::Hasher>(&self, state: &mut H) { | ||
| self.raw.hash(state); |
| pub static RPM_SCHEME: &str = "rpm"; | ||
|
|
||
| #[derive(Clone, Debug, Eq)] | ||
| #[cfg_attr(feature = "wasm", derive(tsify::Tsify))] |
Comment on lines
+147
to
+149
| } else { | ||
| (Comparator::Equal, raw) | ||
| }; |
Comment on lines
+173
to
+174
| // Validate via rpm_version parsing | ||
| let _ = rpm_version::Evr::parse(s); |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This PR implements full compliance with the official RPM version comparison (rpmvercmp) specification and EVR packaging rules for the rpm versioning scheme.
Key Features & Improvements
RPM Version Ordering (Ord / PartialOrd):
) Pre-release Support: Correctly forces pre-release/patch indicators using tildes to sort older than the base version (e.g., 1.0rc1 < 1.0).Constraint Parsing & Native Expansion (NativeVersionConverter):
Testing
Added a comprehensive test suite (test_rpm_comprehensive_ordering and test_rpm_intervals) validating tilde placement, segment alternation, numeric magnitudes, epochs, and release suffixes against canonical RPM behavior.