From d90f395e814ee74e531cd7f6e5910bc4a095aa54 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 3 Jan 2021 10:38:16 +0000 Subject: Have build list cope with multiple pages --- scripts/guix-build-coordinator.in | 65 ++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 28 deletions(-) (limited to 'scripts/guix-build-coordinator.in') diff --git a/scripts/guix-build-coordinator.in b/scripts/guix-build-coordinator.in index da63025..64e38ca 100644 --- a/scripts/guix-build-coordinator.in +++ b/scripts/guix-build-coordinator.in @@ -380,18 +380,19 @@ canceled?: ~A %client-option-defaults %builds-list-option-defaults) rest))) - (let ((response (request-builds-list - (assq-ref opts 'coordinator) - #:tags (assq-ref opts 'tags) - #:not-tags (assq-ref opts 'not-tags) - #:processed (assq-ref opts 'processed) - #:canceled (assq-ref opts 'canceled) - #:after-id (assq-ref opts 'after-id) - #:limit (assq-ref opts 'limit)))) - (for-each - (lambda (build-details) - (simple-format (current-output-port) - "id: ~A + (let loop ((after-id #f)) + (let ((response (request-builds-list + (assq-ref opts 'coordinator) + #:tags (assq-ref opts 'tags) + #:not-tags (assq-ref opts 'not-tags) + #:processed (assq-ref opts 'processed) + #:canceled (assq-ref opts 'canceled) + #:after-id (or after-id (assq-ref opts 'after-id)) + #:limit (assq-ref opts 'limit)))) + (for-each + (lambda (build-details) + (simple-format (current-output-port) + "id: ~A derivation: ~A processed: ~A canceled: ~A @@ -399,22 +400,30 @@ priority: ~A tags: ~A \n" - (assoc-ref build-details "uuid") - (assoc-ref build-details "derivation-name") - (if (assoc-ref build-details "processed") - "true" - "false") - (if (assoc-ref build-details "canceled") - "true" - "false") - (assoc-ref build-details "priority") - (string-join - (map (match-lambda - ((key . val) - (string-append " " key ": " val))) - (assoc-ref build-details "tags")) - "\n"))) - (vector->list (assoc-ref response "builds")))))) + (assoc-ref build-details "uuid") + (assoc-ref build-details "derivation-name") + (if (assoc-ref build-details "processed") + "true" + "false") + (if (assoc-ref build-details "canceled") + "true" + "false") + (assoc-ref build-details "priority") + (string-join + (map (match-lambda + ((key . val) + (string-append " " key ": " val))) + (assoc-ref build-details "tags")) + "\n"))) + (vector->list (assoc-ref response "builds"))) + + (when (= (vector-length (assoc-ref response "builds")) + (assq-ref opts 'limit)) + (loop + (assoc-ref (vector-ref + (assoc-ref response "builds") + (- (vector-length (assoc-ref response "builds")) 1)) + "uuid"))))))) (("build" "show-blocking" rest ...) (let ((opts (parse-options %base-options (append %base-option-defaults -- cgit v1.2.3