[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 0ebd0b632e4ae60f70a1ff44f04e7e48ead6c6a5
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Oct 1 16:09:03 2023 +0200
database: ‘db-get-jobs-history’ returns an alist keyed by symbols.
* src/cuirass/database.scm (db-get-jobs-history): Use symbols instead of
keywords as alist keys.
* src/cuirass/http.scm (jobs-history->json-object): Adjust accordingly.
* tests/database.scm ("db-get-jobs-history"): Adjust accordingly.
---
src/cuirass/database.scm | 20 ++++++++++----------
src/cuirass/http.scm | 6 +++---
tests/database.scm | 4 ++--
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index 764d6ee..56f452f 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -1000,28 +1000,28 @@ AND Jobs.name = ANY(:names);")
(match rows
(() (sort evaluations
(lambda (a b)
- (let ((eval (cut assq-ref <> #:evaluation)))
+ (let ((eval (cut assq-ref <> 'evaluation)))
(> (eval a) (eval b))))))
(((name evaluation build status)
. rest)
(loop rest
(let* ((eval (find (lambda (e)
- (eq? (assq-ref e #:evaluation)
+ (eq? (assq-ref e 'evaluation)
(string->number evaluation)))
evaluations))
(jobs (and eval
- (assq-ref eval #:jobs)))
- (job `((#:name . ,name)
- (#:build . ,(string->number build))
- (#:status . ,(string->number status)))))
+ (assq-ref eval 'jobs)))
+ (job `((name . ,name)
+ (build . ,(string->number build))
+ (status . ,(string->number status)))))
(if eval
(begin
- (assq-set! eval #:jobs (cons job jobs))
+ (assq-set! eval 'jobs (cons job jobs))
evaluations)
;; TODO: Define a record type.
- (cons `((#:evaluation . ,(string->number evaluation))
- (#:checkouts . ,(db-get-checkouts evaluation))
- (#:jobs . ,(list job)))
+ (cons `((evaluation . ,(string->number evaluation))
+ (checkouts . ,(db-get-checkouts evaluation))
+ (jobs . ,(list job)))
evaluations))))))))))
(define (db-add-build-dependencies source-derivation target-derivations)
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 55c96b2..03f4e35 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -215,11 +215,11 @@
(scm->json-string
(list->vector
(map (lambda (eval)
- `((evaluation . ,(assq-ref eval #:evaluation))
+ `((evaluation . ,(assq-ref eval 'evaluation))
(checkouts . ,(list->vector
- (assq-ref eval #:checkouts)))
+ (assq-ref eval 'checkouts)))
(jobs . ,(list->vector
- (assq-ref eval #:jobs)))))
+ (assq-ref eval 'jobs)))))
history))))
(define (handle-build-request build-id)
diff --git a/tests/database.scm b/tests/database.scm
index 5e0dc73..1b85c16 100644
--- a/tests/database.scm
+++ b/tests/database.scm
@@ -334,8 +334,8 @@ timestamp, checkouttime, evaltime) VALUES ('guix', 0, 0, 0,
0);")
#:spec "guix"
#:limit 2)
((eval)
- (and (eq? (assq-ref eval #:evaluation) 4)
- (eq? (length (assq-ref eval #:jobs)) 1))))))
+ (and (eq? (assq-ref eval 'evaluation) 4)
+ (eq? (length (assq-ref eval 'jobs)) 1))))))
(test-assert "db-update-build-status!"
(with-fibers