[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Sun, 1 Oct 2023 10:45:29 -0400 (EDT) |
branch: master
commit d1486d71beee4ca0f5f7efb8ce0ffac07aa84577
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Oct 1 16:10:04 2023 +0200
http: Factorize ‘checkout->json-object’.
* 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 <checkout> 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.