From 6160f09410a330a03fe6a95b3252b6f5c4322931 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 24 Oct 2020 19:14:30 +0100 Subject: Don't assume the missing input to a build is a direct input Substitutes could be available for all direct inputs, but be missing for things they reference. This could happen if those builds happened on a machine with the store items available for example. Therefore, search the entire graph for the relevant derivation when looking for the derivation to build to provide the missing input. This change matches up with the similar improvement around handling fetching substitutes. --- guix-build-coordinator/hooks.scm | 61 ++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 33 deletions(-) (limited to 'guix-build-coordinator/hooks.scm') diff --git a/guix-build-coordinator/hooks.scm b/guix-build-coordinator/hooks.scm index e4b2bff..0006a95 100644 --- a/guix-build-coordinator/hooks.scm +++ b/guix-build-coordinator/hooks.scm @@ -337,39 +337,34 @@ (build-coordinator-datastore build-coordinator)) (let ((build (datastore-find-build datastore build-id))) - (let ((derivation-inputs - (datastore-find-derivation-inputs datastore - (assq-ref build 'derivation-name)))) - (simple-format #t "missing-inputs: ~A\n~A\n" - build-id - (string-join (map (lambda (input) - (string-append " - " input)) - missing-inputs) - "\n")) - (for-each (lambda (missing-input) - (let ((input-derivation - (any (lambda (derivation-input) - (if (string=? (assq-ref derivation-input 'output) - missing-input) - (assq-ref derivation-input 'derivation) - #f)) - derivation-inputs))) - (unless input-derivation - (error "couldn't find a derivation for " missing-input)) - - (let ((builds-for-output - (datastore-list-builds-for-output datastore - missing-input))) - (if (null? builds-for-output) - (begin - (simple-format #t - "submitting build for ~A\n" - input-derivation) - (submit-build build-coordinator input-derivation)) - (simple-format #t "~A builds exist for ~A, skipping\n" - (length builds-for-output) - missing-input))))) - missing-inputs)))) + (simple-format #t "missing-inputs: ~A\n~A\n" + build-id + (string-join (map (lambda (input) + (string-append " - " input)) + missing-inputs) + "\n")) + (for-each (lambda (missing-input) + (let ((input-derivation + (datastore-find-derivation-for-output + datastore + (assq-ref build 'derivation-name) + missing-input))) + (unless input-derivation + (error "couldn't find a derivation for " missing-input)) + + (let ((builds-for-output + (datastore-list-builds-for-output datastore + missing-input))) + (if (null? builds-for-output) + (begin + (simple-format #t + "submitting build for ~A\n" + input-derivation) + (submit-build build-coordinator input-derivation)) + (simple-format #t "~A builds exist for ~A, skipping\n" + (length builds-for-output) + missing-input))))) + missing-inputs))) (define %default-hooks `((build-submitted . ,default-build-submitted-hook) -- cgit v1.2.3