diff options
author | Christopher Baines <mail@cbaines.net> | 2020-10-24 19:14:30 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-10-24 19:14:30 +0100 |
commit | 6160f09410a330a03fe6a95b3252b6f5c4322931 (patch) | |
tree | 5487953e6fbe27e7986f5c52537f8416c8fb152e /guix-build-coordinator/hooks.scm | |
parent | 0df7fce1f2746fadfe3f9aa82826b48c84b3eab2 (diff) | |
download | build-coordinator-6160f09410a330a03fe6a95b3252b6f5c4322931.tar build-coordinator-6160f09410a330a03fe6a95b3252b6f5c4322931.tar.gz |
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.
Diffstat (limited to 'guix-build-coordinator/hooks.scm')
-rw-r--r-- | guix-build-coordinator/hooks.scm | 61 |
1 files changed, 28 insertions, 33 deletions
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) |