guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: http: Rationalize build id conversion.


From: Mathieu Othacehe
Subject: branch master updated: http: Rationalize build id conversion.
Date: Sun, 02 Aug 2020 12:41:48 -0400

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix-cuirass.

The following commit(s) were added to refs/heads/master by this push:
     new 614ea05  http: Rationalize build id conversion.
614ea05 is described below

commit 614ea0576743e7ab83a7b4f82b48f272a67ebbf7
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Sun Aug 2 18:39:35 2020 +0200

    http: Rationalize build id conversion.
    
    * src/cuirass/http.scm (url-handler): Handle the id -> number conversion
    directly in the route declaration.
---
 src/cuirass/http.scm | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 6f9eca5..bcd6217 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -362,20 +362,18 @@ Hydra format."
        (if hydra-build
            (respond-json (object->json-string hydra-build))
            (respond-build-not-found id))))
-    (('GET "build" build-id "details")
-     (let* ((id (string->number build-id))
-            (build (and id (db-get-build id)))
-            (products (and build (db-get-build-products build-id))))
+    (('GET "build" (= string->number id) "details")
+     (let* ((build (and id (db-get-build id)))
+            (products (and build (db-get-build-products id))))
        (if build
            (respond-html
-            (html-page (string-append "Build " build-id)
+            (html-page (string-append "Build " id)
                        (build-details build products)
                        `(((#:name . ,(assq-ref build #:specification))
                           (#:link . ,(string-append "/jobset/" (assq-ref build 
#:specification)))))))
-           (respond-build-not-found build-id))))
-    (('GET "build" build-id "log" "raw")
-     (let* ((id (string->number build-id))
-            (build (and id (db-get-build id))))
+           (respond-build-not-found id))))
+    (('GET "build" (= string->number id) "log" "raw")
+     (let ((build (and id (db-get-build id))))
        (if build
            (match (assq-ref build #:outputs)
              (((_ (#:path . (? string? output))) _ ...)
@@ -388,13 +386,13 @@ Hydra format."
                                          #:headers `((location . ,uri)))
                          #:body "")))
              (()
-              ;; Not entry for BUILD-ID in the 'Outputs' table.
+              ;; Not entry for ID in the 'Outputs' table.
               (respond-json-with-error
                500
-               (format #f "Outputs of build ~a are unknown." build-id)))
+               (format #f "Outputs of build ~a are unknown." id)))
              (#f
-              (respond-build-not-found build-id)))
-           (respond-build-not-found build-id))))
+              (respond-build-not-found id)))
+           (respond-build-not-found id))))
     (('GET "output" id)
      (let ((output (db-get-output
                     (string-append (%store-prefix) "/" id))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]