aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm25
1 files changed, 14 insertions, 11 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index b4c40a6..3f9b19e 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -293,21 +293,24 @@ UNION
INNER JOIN related_derivations
ON related_derivations.name = derivation_inputs.derivation_name
)
-SELECT DISTINCT related_derivations.name
+SELECT related_derivations.name
FROM related_derivations
INNER JOIN derivations
ON related_derivations.name = derivations.name
-INNER JOIN derivation_outputs
- ON related_derivations.name = derivation_outputs.derivation_name
WHERE related_derivations.name != :derivation
- AND derivation_outputs.output NOT IN (
- SELECT derivation_outputs.output
- FROM derivation_outputs
- INNER JOIN builds
- ON derivation_outputs.derivation_name = builds.derivation_name
- INNER JOIN derivations AS build_derivations
- ON builds.derivation_name = build_derivations.name
- WHERE build_derivations.system = derivations.system
+ AND NOT EXISTS (
+ SELECT 1
+ FROM builds
+ INNER JOIN derivation_outputs AS other_derivation_derivation_outputs
+ ON other_derivation_derivation_outputs.derivation_name =
+ builds.derivation_name
+ INNER JOIN derivations AS other_derivations
+ ON other_derivation_derivation_outputs.derivation_name =
+ other_derivations.name
+ INNER JOIN derivation_outputs
+ ON derivation_outputs.output = other_derivation_derivation_outputs.output
+ WHERE derivation_outputs.derivation_name = related_derivations.name
+ AND other_derivations.system = derivations.system
)
")))