summaryrefslogtreecommitdiffstats
path: root/src/watch
diff options
context:
space:
mode:
Diffstat (limited to 'src/watch')
-rw-r--r--src/watch/detect.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/watch/detect.rs b/src/watch/detect.rs
index 55b7543..3134e19 100644
--- a/src/watch/detect.rs
+++ b/src/watch/detect.rs
@@ -258,6 +258,35 @@ fn score(
if let Ok(a) = crate::review::risk::assess(db, cfg, pb, recipe, digests, accepted) {
let _ = crate::review::candidates::set_risk(db, id, &a.level, &a.signals);
}
+ // Record now what would block the build later, using the same rule the plan
+ // step uses. A reviewer approving a package whose dependencies we have not
+ // published yet should see that before they approve it, not as a blocked
+ // build afterwards (ยง10.4).
+ let missing = missing_deps(db, pb, recipe);
+ let _ = crate::review::candidates::set_missing_deps(db, id, &missing);
+}
+
+/// Dependencies that are ours to publish but are not in the index yet.
+fn missing_deps(db: &Db, pb: &Pkgbase, recipe: &Recipe) -> Vec<String> {
+ let ours = match db::our_package_names(db) {
+ Ok(o) => o,
+ Err(_) => return Vec::new(),
+ };
+ let mut out = Vec::new();
+ for dep in crate::pkgver::dep_names(&recipe.depends) {
+ if ours.contains(&dep) || dep == pb.name || recipe.pkgnames.contains(&dep) {
+ continue;
+ }
+ let ours_to_publish = db::get_subscription(db, &dep)
+ .map(|s| s.is_some())
+ .unwrap_or(false)
+ || db::get_pkgbase(db, &dep).map(|p| p.is_some()).unwrap_or(false);
+ if ours_to_publish {
+ out.push(dep);
+ }
+ }
+ out.sort();
+ out
}
fn outcome_of(up: Upsert) -> Outcome {