guix: ci: Add spec support to latest-evaluations.
authorMathieu Othacehe <othacehe@gnu.org>
Wed, 26 May 2021 12:54:43 +0000 (14:54 +0200)
committerMathieu Othacehe <othacehe@gnu.org>
Wed, 26 May 2021 13:29:32 +0000 (15:29 +0200)
* guix/ci.scm (latest-evaluations): Add spec parameter support.

guix/ci.scm

index 44cf0c5..0af04ff 100644 (file)
@@ -154,14 +154,21 @@ string such as \"x86_64-linux\"), restrict to builds for SYSTEM."
                                     (number->string evaluation)))))
     (json->evaluation evaluation)))
 
-(define* (latest-evaluations url #:optional (limit %query-limit))
-  "Return the latest evaluations performed by the CI server at URL."
-  (map json->evaluation
-       (vector->list
-        (json->scm
-         (http-fetch (string-append url "/api/evaluations?nr="
-                                    (number->string limit)))))))
-
+(define* (latest-evaluations url
+                             #:optional (limit %query-limit)
+                             #:key spec)
+  "Return the latest evaluations performed by the CI server at URL.  If SPEC
+is passed, only consider the evaluations for the given SPEC specification."
+  (let ((spec (if spec
+                  (format #f "&spec=~a" spec)
+                  "")))
+    (map json->evaluation
+         (vector->list
+          (json->scm
+           (http-fetch
+            (string-append url "/api/evaluations?nr="
+                           (number->string limit)
+                           spec)))))))
 
 (define* (evaluations-for-commit url commit #:optional (limit %query-limit))
   "Return the evaluations among the latest LIMIT evaluations that have COMMIT