Try to work on build some more.
This commit is contained in:
@@ -7,7 +7,8 @@ use crate::package::PackageHandler;
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct Dependency {
|
||||
name: String,
|
||||
version: Version,
|
||||
#[serde(skip_serializing_if = "<Option<_>>::is_none")]
|
||||
version: Option<Version>,
|
||||
pub checksum: String,
|
||||
#[serde(skip_serializing_if = "<Option<_>>::is_none")]
|
||||
source: Option<String>, // Path / URL
|
||||
@@ -24,13 +25,19 @@ impl Dependency {
|
||||
// TODO: Convert from reverse domain name to path.
|
||||
return self.name.clone();
|
||||
}
|
||||
|
||||
pub fn is_updated(&self) -> crate::Result<bool> {
|
||||
// If the path is local and that file has not been updated.
|
||||
Ok(self.source.as_ref().is_some_and(|path| is_url(path))
|
||||
&& self.checksum == sha256::try_digest(self.source.as_ref().unwrap())?)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PackageHandler> for Dependency {
|
||||
fn from(value: PackageHandler) -> Self {
|
||||
Dependency {
|
||||
name: value.name(),
|
||||
version: value.version(),
|
||||
version: Some(value.version()),
|
||||
checksum: String::new(),
|
||||
source: None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user