diff options
author | Christopher Baines <mail@cbaines.net> | 2020-10-11 11:38:27 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-10-11 13:58:19 +0100 |
commit | 1530fad51727e2ed6f65a6cad2d870384774545b (patch) | |
tree | 443aad796f2572050ed92a9b42f0e59207792aae | |
parent | d4a8f2173aab144f580cc31b132b3290dc6cc452 (diff) | |
download | build-coordinator-1530fad51727e2ed6f65a6cad2d870384774545b.tar build-coordinator-1530fad51727e2ed6f65a6cad2d870384774545b.tar.gz |
Move around the code for build log file locations
build-log-file-location replaces build-log-file-exists? as it doesn't always
return a boolean, it also changes to return an absolute filepath for the log
file if it exists, as this will be easier to use.
-rw-r--r-- | guix-build-coordinator/agent-messaging/http/server.scm | 2 | ||||
-rw-r--r-- | guix-build-coordinator/coordinator.scm | 17 |
2 files changed, 11 insertions, 8 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm index 7656c6f..16f5ba7 100644 --- a/guix-build-coordinator/agent-messaging/http/server.scm +++ b/guix-build-coordinator/agent-messaging/http/server.scm @@ -338,7 +338,7 @@ port. Also, the port used can be changed by passing the --port option.\n" (datastore-agent-for-build datastore uuid))) (if (authenticated? agent-id-for-build request) (let* ((output-file-name - (build-log-file-location datastore uuid format)) + (build-log-file-destination uuid format)) (tmp-output-file-name (string-append output-file-name ".tmp"))) (mkdir-p (dirname output-file-name)) diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm index f561dd9..242e90e 100644 --- a/guix-build-coordinator/coordinator.scm +++ b/guix-build-coordinator/coordinator.scm @@ -62,6 +62,7 @@ start-hook-processing-threads build-output-file-location + build-log-file-destination build-log-file-location handle-build-start-report handle-build-result @@ -455,7 +456,7 @@ (string-append (%config 'build-logs-dir) "/" build-id)) -(define (build-log-file-location datastore build-id format) +(define (build-log-file-destination build-id format) (string-append (build-log-file-directory build-id) "/" (cond ((string=? format "bzip2") "log.bz2") @@ -463,13 +464,15 @@ (else (error "unknown log format" format))))) -(define (build-log-file-exists? build-id) - (let ((potential-files - (scandir (build-log-file-directory build-id) - (negate (cut member <> '("." "..")))))) +(define (build-log-file-location build-id) + (let* ((directory + (build-log-file-directory build-id)) + (potential-files + (scandir directory + (negate (cut member <> '("." "..")))))) (match potential-files ((file) (and (not (string-suffix? ".tmp" file)) - file)) + (string-append directory "/" file))) (() #f) (#f #f) ; directory doesn't exist (files (error @@ -493,7 +496,7 @@ (make-exception-with-message "build already processed")))) (when success? - (unless (build-log-file-exists? build-id) + (unless (build-log-file-location build-id) (raise-exception (make-exception-with-message "missing build log file"))) |