Fix for dependency resolution - take into account release number

This commit is contained in:
Nathan Fisher 2023-03-30 10:59:02 -04:00
parent 94eb94952f
commit efb28a30e2
3 changed files with 21 additions and 5 deletions

View File

@ -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 {

View File

@ -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))
}
}

View File

@ -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,
}
}