feat: etc

This commit is contained in:
2025-02-27 02:11:37 +01:00
parent 1586f81152
commit 947b384511
18 changed files with 263 additions and 146 deletions

View File

@ -1,11 +1,13 @@
use anyhow::{anyhow, Result};
use std::hash::{DefaultHasher, Hash, Hasher};
use crate::pkg::PkgKey;
use crate::Profile;
use crate::pkg_store::PackageStore;
use crate::Profile;
use anyhow::{anyhow, Result};
pub struct AppData {
pub profile: Option<Profile>,
pub pkgs: PackageStore
pub pkgs: PackageStore,
}
impl AppData {
@ -37,4 +39,14 @@ impl AppData {
Ok(())
}
}
pub fn sum_packages(&self, p: &Profile) -> String {
let mut hasher = DefaultHasher::new();
for pkg in &p.mods {
let x = self.pkgs.get(pkg).unwrap().loc.as_ref().unwrap();
pkg.hash(&mut hasher);
x.version.hash(&mut hasher);
}
hasher.finish().to_string()
}
}