Try to work on build some more.

This commit is contained in:
Cutieguwu
2026-02-15 12:25:03 -05:00
parent a9fb52d8d7
commit 0fad1b74bc
5 changed files with 114 additions and 7 deletions

View File

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