aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-01-26 18:28:32 +0100
committerLudovic Courtès <ludo@gnu.org>2018-01-26 18:28:32 +0100
commit8b26874cac35dabb0d4e203e0de8e9c3485738a1 (patch)
tree3705ba9a79edfed15acbd234ad3b68ba8c2dcc16
parentf3335e880c26897daced684710de7d79f5a83252 (diff)
downloadcuirass-8b26874cac35dabb0d4e203e0de8e9c3485738a1.tar
cuirass-8b26874cac35dabb0d4e203e0de8e9c3485738a1.tar.gz
http: Provide the correct values for 'finished' and 'busy'.
This should placate 'guix-hydra-queued-builds', for instance, which checks these values to choose between "Running" and "Scheduled". * src/cuirass/http.scm (build->hydra-build): Provide the correct value for #:finished and #:busy.
-rw-r--r--src/cuirass/http.scm13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 73f2b8b..1939c34 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -32,6 +32,9 @@
(define (build->hydra-build build)
"Convert BUILD to an assoc list matching hydra API format."
+ (define (bool->int bool)
+ (if bool 1 0))
+
`((#:id . ,(assq-ref build #:id))
(#:project . ,(assq-ref build #:repo-name))
(#:jobset . ,(assq-ref build #:branch))
@@ -44,11 +47,13 @@
(#:system . ,(assq-ref build #:system))
(#:nixname . ,(assq-ref build #:nix-name))
(#:buildstatus . ,(assq-ref build #:status))
-
- ;; TODO: Fill the fields above with correct values.
- (#:busy . 0)
+ (#:busy . ,(bool->int (eqv? (build-status started)
+ (assq-ref build #:status))))
(#:priority . 0)
- (#:finished . 1)
+ (#:finished . ,(bool->int
+ (not (memv (assq-ref build #:status)
+ (list (build-status scheduled)
+ (build-status started))))))
(#:buildproducts . #nil)
(#:releasename . #nil)
(#:buildinputs_builds . #nil)))