summaryrefslogtreecommitdiffstats
path: root/src/watch/digests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/watch/digests.rs')
-rw-r--r--src/watch/digests.rs26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/watch/digests.rs b/src/watch/digests.rs
index 8136850..d3119eb 100644
--- a/src/watch/digests.rs
+++ b/src/watch/digests.rs
@@ -1,15 +1,3 @@
-//! Source digest resolution (§5.3).
-//!
-//! `sha256sums=('SKIP')` is the hole in the integrity story. We resolve and
-//! record the digest of *every* source ourselves, at detection time, regardless
-//! of what the PKGBUILD declares — which turns a silent artifact swap into a
-//! reviewable (or at least alertable) event.
-//!
-//! Cost control: only `SKIP`-declared static sources cost bandwidth. Declared
-//! checksums are trusted-as-declared for identity because makepkg enforces them
-//! at build time; VCS digests come free from the pin we already resolved; local
-//! files are already in the mirror.
-
use crate::config::Config;
use crate::db::{self, *};
use crate::error::Result;
@@ -49,10 +37,9 @@ pub fn resolve_sources(
digest,
size: 0,
// Computed from the recipe like every other entry (m-19), not
- // hardcoded: the field answers "did the recipe give us a
- // checksum?", and for a VCS source the answer is usually yes-by-
- // absence — which is why renderers must ask `is_vcs` before
- // calling it a missing checksum.
+ // 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,
@@ -120,11 +107,8 @@ pub fn resolve_sources(
/// Download `url`, hashing as we go, and record it in `source_cache`.
///
-/// This always goes to the network. That is deliberate: the whole point of §5.3
-/// is to notice that the bytes behind a `SKIP` source changed while the version
-/// did not, and answering from our own cache would make that impossible. The
-/// cache exists so the *build* can reuse the bytes it was reviewed against
-/// ([`cached_path`]), not so detection can skip looking.
+/// 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)?;