From d1486d71beee4ca0f5f7efb8ce0ffac07aa84577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 1 Oct 2023 16:10:04 +0200 Subject: [PATCH] =?UTF-8?q?http:=20Factorize=20=E2=80=98checkout->json-obj?= =?UTF-8?q?ect=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/cuirass/http.scm (checkout->json-object): New procedure. (evaluation->json-object): Use it. --- src/cuirass/http.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm index 03f4e35..831ef4a 100644 --- a/src/cuirass/http.scm +++ b/src/cuirass/http.scm @@ -138,6 +138,13 @@ (file-size . ,(build-product-file-size product)))) (build-products build)))))) +(define (checkout->json-object checkout) + "Return an alist suitable for 'json->scm' representing CHECKOUT, +a record." + `((commit . ,(checkout-commit checkout)) + (channel . ,(checkout-channel checkout)) + (directory . ,(checkout-directory checkout)))) + (define (evaluation->json-object evaluation) "Turn EVALUATION into a representation suitable for 'json->scm'." `((id . ,(evaluation-id evaluation)) @@ -148,10 +155,7 @@ (evaltime . ,(evaluation-start-time evaluation)) (checkouts . ,(list->vector - (map (lambda (checkout) - `((commit . ,(checkout-commit checkout)) - (channel . ,(checkout-channel checkout)) - (directory . ,(checkout-directory checkout)))) + (map checkout->json-object ;; Get the complete lists of checkouts, not just those that are ;; different from the previous evaluation.