summaryrefslogtreecommitdiffstats
path: root/src/watch/staleness.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/watch/staleness.rs')
-rw-r--r--src/watch/staleness.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/watch/staleness.rs b/src/watch/staleness.rs
index cc7242c..e052b26 100644
--- a/src/watch/staleness.rs
+++ b/src/watch/staleness.rs
@@ -102,20 +102,21 @@ pub fn downgrades(db: &Db) -> Result<Vec<Stale>> {
/// its recipe dependencies.
pub fn dependents_of(db: &Db, name: &str) -> Result<Vec<String>> {
let mut out: Vec<String> = Vec::new();
- for p in db::index_packages(db)? {
- if p.name == name {
+ for (pkgname, json) in db::index_recipes(db)? {
+ if pkgname == name {
continue;
}
- let depends = db::recipe_json_of_index_package(db, &p.name)?
- .and_then(|j| serde_json::from_str::<crate::db::model::Recipe>(&j).ok())
- .map(|r| {
- crate::pkgver::dep_names(&r.depends)
- .into_iter()
- .any(|d| d == name)
- })
- .unwrap_or(false);
+ // A recipe we cannot read is not a recipe that does not depend on
+ // `name`: treat the unreadable as a reason to look, so a malformed
+ // srcinfo cannot silently hide a dependent package from staleness.
+ let depends = match serde_json::from_str::<crate::db::model::Recipe>(&json) {
+ Ok(r) => crate::pkgver::dep_names(&r.depends)
+ .into_iter()
+ .any(|d| d == name),
+ Err(_) => true,
+ };
if depends {
- out.push(p.name);
+ out.push(pkgname);
}
}
Ok(out)