aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-04-13 13:57:01 +0100
committerChristopher Baines <mail@cbaines.net>2020-04-13 13:57:01 +0100
commit4281e52862e5809c20774f8296cbe05b4c5d93a5 (patch)
treeb289281f785eafb1d54358d7572ecc84281162c6
parentdcd67b0b0c0295a1e2540d20fdcf77b6a0395b44 (diff)
downloadbuild-coordinator-4281e52862e5809c20774f8296cbe05b4c5d93a5.tar
build-coordinator-4281e52862e5809c20774f8296cbe05b4c5d93a5.tar.gz
Extract out substitute-derivation to the utils module
So it can be used by the coordinator as well.
-rw-r--r--guix-build-coordinator/agent.scm24
-rw-r--r--guix-build-coordinator/utils.scm28
2 files changed, 28 insertions, 24 deletions
diff --git a/guix-build-coordinator/agent.scm b/guix-build-coordinator/agent.scm
index 9c75253..f091401 100644
--- a/guix-build-coordinator/agent.scm
+++ b/guix-build-coordinator/agent.scm
@@ -25,8 +25,8 @@
#:use-module (rnrs bytevectors)
#:use-module (web http)
#:use-module (guix store)
- #:use-module (guix status)
#:use-module (guix derivations)
+ #:use-module (guix-build-coordinator utils)
#:use-module (guix-build-coordinator agent-messaging http)
#:export (run-agent))
@@ -50,28 +50,6 @@
builds)))
(define (pre-build-process derivation-name)
- (define (substitute-derivation derivation-name)
- (catch #t
- (lambda ()
- (with-store store
- (set-build-options store
- #:print-extended-build-trace? #t
- #:multiplexed-build-output? #t)
- (with-status-report
- (lambda (event status new)
- (print-build-event event status new)
- (match event
- (('substituter-succeeded substituted-drv)
- (when (string=? derivation-name
- substituted-drv)
- (close-connection store)))
- (_ #t)))
- (build-things store (list derivation-name)))))
- (lambda (key . args)
- ;; This is a hack, to ignore errors relating to closing the store
- ;; connection.
- #f)))
-
(let ((derivation
(if (file-exists? derivation-name)
(read-derivation-from-file derivation-name)
diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm
index 64144fa..3d34712 100644
--- a/guix-build-coordinator/utils.scm
+++ b/guix-build-coordinator/utils.scm
@@ -9,13 +9,17 @@
#:use-module (gcrypt random)
#:use-module (fibers)
#:use-module (fibers channels)
+ #:use-module (guix store)
+ #:use-module (guix status)
#:use-module (guix base64)
#:export (make-worker-thread-channel
call-with-worker-thread
random-v4-uuid
- make-base64-output-port))
+ make-base64-output-port
+
+ substitute-derivation))
(define %worker-thread-args
(make-parameter #f))
@@ -153,3 +157,25 @@ If already in the worker thread, call PROC immediately."
#f
#f
close))
+
+ (define (substitute-derivation derivation-name)
+ (catch #t
+ (lambda ()
+ (with-store store
+ (set-build-options store
+ #:print-extended-build-trace? #t
+ #:multiplexed-build-output? #t)
+ (with-status-report
+ (lambda (event status new)
+ (print-build-event event status new)
+ (match event
+ (('substituter-succeeded substituted-drv)
+ (when (string=? derivation-name
+ substituted-drv)
+ (close-connection store)))
+ (_ #t)))
+ (build-things store (list derivation-name)))))
+ (lambda (key . args)
+ ;; This is a hack, to ignore errors relating to closing the store
+ ;; connection.
+ #f)))