aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-04-13 15:44:58 +0100
committerChristopher Baines <mail@cbaines.net>2020-04-13 15:44:58 +0100
commit80b6b4dd8fdef2ee7631870bcf1a8353d5cf5148 (patch)
tree0aeb3a7f35db4aeb7d65ee20330d20d25f65ef07 /guix-build-coordinator
parent52e2360e9ef14402deff8c19889822c5f5b03914 (diff)
downloadbuild-coordinator-80b6b4dd8fdef2ee7631870bcf1a8353d5cf5148.tar
build-coordinator-80b6b4dd8fdef2ee7631870bcf1a8353d5cf5148.tar.gz
Only download missing inputs if all have substitutes
To avoid potentially wasting time. Instead, report the missing inputs to the coordinator as soon as possible. The build may be scheduled on a different agent, so it might not be necessary to download the inputs which do have substitutes available.
Diffstat (limited to 'guix-build-coordinator')
-rw-r--r--guix-build-coordinator/agent.scm37
1 files changed, 23 insertions, 14 deletions
diff --git a/guix-build-coordinator/agent.scm b/guix-build-coordinator/agent.scm
index 3e0e9ac..1eb0d58 100644
--- a/guix-build-coordinator/agent.scm
+++ b/guix-build-coordinator/agent.scm
@@ -53,21 +53,30 @@
(define (pre-build-process derivation-name)
(define (find-missing-inputs inputs)
- (let ((output-paths
- (append-map derivation-input-output-paths inputs)))
+ (let* ((output-paths
+ (append-map derivation-input-output-paths inputs))
+ (missing-paths
+ (remove file-exists? output-paths))
+ (path-substitutes
+ (with-store store
+ (map (lambda (file)
+ (has-substitutes? store file))
+ missing-paths))))
- (with-store store
- (fold (lambda (file result)
- (if (file-exists? file)
- result
- (if (has-substitutes? store file)
- (begin
- (with-store store
- (build-things store output-paths))
- result)
- (cons file result))))
- '()
- output-paths))))
+ (if (member #f path-substitutes)
+ (fold (lambda (file substitute-available? result)
+ (if substitute-available?
+ result
+ (cons file result)))
+ '()
+ missing-paths
+ path-substitutes)
+ (begin
+ ;; Download the substitutes
+ (with-store store
+ (build-things store missing-paths))
+
+ '()))))
(let ((derivation
(if (file-exists? derivation-name)