diff options
Diffstat (limited to 'src/watch/digests.rs')
| -rw-r--r-- | src/watch/digests.rs | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/watch/digests.rs b/src/watch/digests.rs index d3119eb..b95bd6c 100644 --- a/src/watch/digests.rs +++ b/src/watch/digests.rs @@ -4,7 +4,6 @@ use crate::error::Result; use crate::recipe::{declared_sums, is_hex_digest, SKIP}; use crate::watch::mirror::Tree; -/// Resolve the digest of every `source=()` entry. pub fn resolve_sources( cfg: &Config, db: &Db, @@ -23,8 +22,6 @@ pub fn resolve_sources( }; if entry.is_vcs() { - // The resolved commit *is* the digest; captured during Stage B where - // we clone anyway (ยง5.2), so near-free. let pin = pins.iter().find(|p| p.index == entry.index); let digest = pin .map(|p| p.commit.clone()) @@ -36,10 +33,6 @@ pub fn resolve_sources( kind: entry.vcs.clone().unwrap_or_else(|| "vcs".into()), digest, size: 0, - // Computed from the recipe like every other entry (m-19), not - // hardcoded: for a VCS source the answer is usually - // yes-by-absence, so renderers must ask `is_vcs` before calling - // it a missing checksum. skip_declared: match declared_sums(recipe, entry.index) { Some(d) => d == SKIP || !is_hex_digest(&d), None => true, @@ -61,8 +54,6 @@ pub fn resolve_sources( let d = crate::hash::hex(&bytes); (d, bytes.len() as u64) } - // A "local" file that is not in the tree is the recipe's bug; - // record the absence rather than inventing a digest. None => (String::new(), 0), }; out.push(SourceDigest { @@ -76,9 +67,7 @@ pub fn resolve_sources( continue; } - // Static source. if !skip_declared { - // Trusted-as-declared: makepkg verifies it at build time. out.push(SourceDigest { index: entry.index, url: entry.url.clone(), @@ -90,8 +79,6 @@ pub fn resolve_sources( continue; } - // The paid path: download and stream-hash into the cache, which the - // build then reuses so the bytes are paid for once. let (digest, size) = download_and_cache(cfg, db, &entry.url)?; out.push(SourceDigest { index: entry.index, @@ -105,10 +92,6 @@ pub fn resolve_sources( Ok(out) } -/// Download `url`, hashing as we go, and record it in `source_cache`. -/// -/// This always goes to the network: the point of .5.3 is to notice that the bytes -/// behind a `SKIP` source changed while the version did not. pub fn download_and_cache(cfg: &Config, db: &Db, url: &str) -> Result<(String, u64)> { let tmp = cfg.source_cache_dir().join(format!("tmp-{}", crate::hash::short(url.as_bytes(), 16))); let (digest, size) = crate::fetch::fetch_to(url, &tmp)?; @@ -126,8 +109,6 @@ pub fn download_and_cache(cfg: &Config, db: &Db, url: &str) -> Result<(String, u Ok((digest, size)) } -/// The cached file holding `digest`, if we still have it. The build uses this -/// so the bytes it consumes are the bytes that were hashed at detection time. pub fn cached_path(db: &Db, url: &str, digest: &str) -> Option<std::path::PathBuf> { db::source_cache_path(db, url, digest) .ok() |
