diff --git a/src/db/mod.rs b/src/db/mod.rs index 7bc8938..3db5222 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -60,7 +60,10 @@ impl Database { // Check if we've already pulled in an update from another repo, // and if so compare versions if let Some(other_update) = updates.get(&name) { - if remote_package.version > other_update.version { + if remote_package.version > other_update.version + || (remote_package.version == other_update.version + && remote_package.release > other_update.release) + { // The remote version is an update to the already // pulled in update, so swap it out let update = Update { diff --git a/src/package/mod.rs b/src/package/mod.rs index 215cb7e..dfdd00b 100644 --- a/src/package/mod.rs +++ b/src/package/mod.rs @@ -122,7 +122,9 @@ impl Package { /// Tests whether this package is an update for another pub fn is_upgrade(&self, other: &Self) -> bool { - self.name == other.name && self.version > other.version + self.name == other.name + && (self.version > other.version + || (self.version == other.version && self.release > other.release)) } } diff --git a/src/version/mod.rs b/src/version/mod.rs index d37217b..21b3fa6 100644 --- a/src/version/mod.rs +++ b/src/version/mod.rs @@ -137,10 +137,21 @@ impl PartialOrd for Version { }, ) => b.partial_cmp(&d), ( - Self::SemVer { major, minor, patch }, + Self::SemVer { + major, + minor, + patch, + }, Self::Rapid { major: a, minor: b }, - ) => SemVer { major: *major, minor: *minor, patch: *patch } - .partial_cmp(&Rapid { major: *a, minor: *b }), + ) => SemVer { + major: *major, + minor: *minor, + patch: *patch, + } + .partial_cmp(&Rapid { + major: *a, + minor: *b, + }), _ => None, } }