From 0b3cb443e70b46ec61455255c3ddfc2a26997613 Mon Sep 17 00:00:00 2001 From: aur-build Date: Wed, 18 Nov 2026 07:16:36 +0000 Subject: =?UTF-8?q?watch:=20two-stage=20VCS=20watcher=20=E2=80=94=20ls-rem?= =?UTF-8?q?ote=20probe,=20pkgver()=20resolution,=20pin=20capture=20(=C2=A7?= =?UTF-8?q?5.2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stage A probes every VCS source in source=() with git ls-remote, respecting #commit/#tag/#branch fragments, and returns one UpstreamPin per source. If the tip set equals the accepted release's pins, nothing can have changed and Stage B never runs — the common case costs one round trip per source and no clone. svn/hg have no cheap universal probe, so they are reported as unprobed and force Stage B rather than being silently treated as unchanged. Stage B runs only on movement: it fetches into a persistent vcs_cache (rather than re-cloning a multi-gigabyte upstream daily), runs makepkg --vercheck, and captures the pins from the clone it already has. Results are cached on (pkgbase, recipe_hash, upstream_tip) with a per-pkgbase cooldown, and a process-wide slot cap bounds concurrent resolutions. The resolved epoch:pkgver-pkgrel plus the pins go into identity_hash, so a different commit is a different thing to approve. Also fixes a misclassification the new path exposed: a VCS source's digest is its pin, so upstream movement showed up as an integrity_alert. Integrity events are now restricted to fixed downloads; VCS movement under a frozen pkgver is pin_drift, as §5.2 specifies. New fixtures git-multi (two upstreams) and git-tagged (#tag pin). 10 tests in tests/vcs.rs. --- tests/common/mod.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'tests/common/mod.rs') diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 0dc5396..d2582c9 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -245,10 +245,13 @@ pub fn materialize_fixture(root: &Path, name: &str) -> Fixture { std::fs::create_dir_all(&aur).unwrap(); let upstream = root.join(format!("upstream/{name}")); + let upstream2 = root.join(format!("upstream/{name}-2")); let subs = [ ("@AUR_DIR@".to_string(), data.display().to_string()), ("@UPSTREAM_DIR@".to_string(), upstream.display().to_string()), + ("@UPSTREAM2_DIR@".to_string(), upstream2.display().to_string()), ]; + let mut has_upstream2 = false; let mut recipe_files: Vec<(String, String)> = Vec::new(); let mut has_upstream_ref = false; @@ -261,6 +264,7 @@ pub fn materialize_fixture(root: &Path, name: &str) -> Fixture { let body = std::fs::read_to_string(&path).unwrap_or_default(); let body = subs.iter().fold(body, |b, (from, to)| b.replace(from, to)); has_upstream_ref |= body.contains(&upstream.display().to_string()); + has_upstream2 |= body.contains(&upstream2.display().to_string()); if matches!(fname.as_str(), "payload.bin" | "data.bin") { std::fs::write(data.join(&fname), &body).unwrap(); } else { @@ -270,6 +274,16 @@ pub fn materialize_fixture(root: &Path, name: &str) -> Fixture { if has_upstream_ref { make_git_repo(&upstream, &[("README", "upstream\n")], "upstream: initial"); } + if has_upstream2 { + make_git_repo(&upstream2, &[("README", "second upstream\n")], "upstream: initial"); + } + // A `#tag=v1` source needs the tag to exist. + if std::fs::read_to_string(src.join("PKGBUILD")) + .unwrap_or_default() + .contains("#tag=") + { + git(&upstream, &["tag", "v1"]); + } make_git_repo( &aur, &recipe_files.iter().map(|(n, b)| (n.as_str(), b.as_str())).collect::>(), @@ -282,6 +296,7 @@ pub fn materialize_fixture(root: &Path, name: &str) -> Fixture { data, manifest, upstream: has_upstream_ref.then_some(upstream), + upstream2: has_upstream2.then_some(upstream2), } } @@ -292,6 +307,8 @@ pub struct Fixture { pub data: PathBuf, pub manifest: PathBuf, pub upstream: Option, + /// A second upstream repo, for pkgbases that build from two of them. + pub upstream2: Option, } impl Fixture { @@ -333,6 +350,24 @@ impl Fixture { git(&up, &["rev-parse", "HEAD"]) } + /// Add a commit to the second upstream repo. + pub fn upstream2_commit(&self, body: &str) -> String { + let up = self.upstream2.clone().expect("fixture has no second upstream repo"); + git_add_commit(&up, &[(("README"), body)], body); + git(&up, &["rev-parse", "HEAD"]) + } + + /// HEAD of the (first) upstream repo. + pub fn upstream_head(&self) -> String { + let up = self.upstream.clone().expect("fixture has no upstream repo"); + git(&up, &["rev-parse", "HEAD"]) + } + + pub fn upstream2_head(&self) -> String { + let up = self.upstream2.clone().expect("fixture has no second upstream repo"); + git(&up, &["rev-parse", "HEAD"]) + } + pub fn manifest_json(&self) -> serde_json::Value { serde_json::from_str(&std::fs::read_to_string(&self.manifest).unwrap()).unwrap() } -- cgit v1.2.3