diff options
Diffstat (limited to 'src/pipeline/steps.rs')
| -rw-r--r-- | src/pipeline/steps.rs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/pipeline/steps.rs b/src/pipeline/steps.rs index 3a6cff0..ba3a08e 100644 --- a/src/pipeline/steps.rs +++ b/src/pipeline/steps.rs @@ -5,7 +5,7 @@ use crate::error::{Error, Result}; use crate::git; use crate::pipeline::{Collect, CollectedPkg, Ctx, StepResult}; use crate::sandbox::Cmd; -use crate::watch::digests::cached_path; +use crate::watch::sources; pub fn run_step(ctx: &Ctx, step: &str) -> Result<StepResult> { match step { @@ -42,8 +42,7 @@ fn materialize(ctx: &Ctx) -> Result<StepResult> { } let _ = std::fs::remove_dir_all(&ctx.srcdir); git::materialize(&mirror, &ctx.src.aur_commit, &ctx.srcdir)?; - let tree = crate::watch::mirror::read_tree(&mirror, &ctx.src.aur_commit)?; - let computed = tree.recipe_hash(); + let computed = sources::recipe_hash(&mirror, &ctx.src.aur_commit)?; if !ctx.src.recipe_hash.is_empty() && computed != ctx.src.recipe_hash { return Err(Error::fail_closed(format!( "recipe_hash mismatch: approved {}, materialized {}", @@ -212,16 +211,7 @@ fn sources(ctx: &Ctx) -> Result<StepResult> { "local" => verified += 1, "vcs" | "git" | "svn" | "hg" | "bzr" => verified += 1, _ => { - let (digest, _size) = match cached_path(&ctx.db, &d.url, &d.digest) { - Some(p) => crate::hash::digest_file(&p)?, - None => crate::watch::digests::download_and_cache(&ctx.cfg, &ctx.db, &d.url)?, - }; - if digest != d.digest { - return Err(Error::fail_closed(format!( - "source {} hashed to {digest} but the candidate recorded {}", - d.url, d.digest - ))); - } + sources::verify_cached(&ctx.cfg, &ctx.db, &d.url, &d.digest)?; verified += 1; } } |
