unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines via "Development of GNU Guix and the GNU System distribution." <guix-devel@gnu.org>
To: guix-devel@gnu.org
Subject: [PATCH] http: Support fetching builds by derivation.
Date: Wed,  2 Oct 2019 08:17:57 +0100	[thread overview]
Message-ID: <20191002071757.4659-1-christopher.baines@digital.cabinet-office.gov.uk> (raw)
In-Reply-To: <87sgocrf4r.fsf@gnu.org>

There's a one to one mapping of build id to derivation, so allow querying by
derivation file name as well. I'm looking at this as I'm interested in getting
build information in to the Guix Data Service.

* src/cuirass/http.scm (url-handler): Support fetching builds by numeric id or
the derivation file name.
---
 src/cuirass/http.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 2da3637..b6a4358 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -42,6 +42,7 @@
   #:use-module (sxml simple)
   #:use-module (cuirass templates)
   #:use-module (guix utils)
+  #:use-module ((guix store) #:select (%store-prefix))
   #:use-module (guix build union)
   #:export (run-cuirass-server))
 
@@ -243,11 +244,14 @@ Hydra format."
     (((or "jobsets" "specifications") . rest)
      (respond-json (object->json-string
                     (list->vector (db-get-specifications)))))
-    (("build" build-id)
-     (let ((hydra-build (handle-build-request (string->number build-id))))
+    (("build" id)
+     (let ((hydra-build (handle-build-request
+                         (if (string-suffix? ".drv" id)
+                             (string-append (%store-prefix) "/" id)
+                             (string->number id)))))
        (if hydra-build
            (respond-json (object->json-string hydra-build))
-           (respond-build-not-found build-id))))
+           (respond-build-not-found id))))
     (("build" build-id "details")
      (let ((build (db-get-build (string->number build-id))))
        (if build
-- 
2.23.0

  reply	other threads:[~2019-10-02  7:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-29 18:15 [PATCH] http: Support fetching builds by derivation Christopher Baines via Development of GNU Guix and the GNU System distribution.
2019-10-01  9:25 ` Ludovic Courtès
2019-10-02  7:17   ` Christopher Baines via Development of GNU Guix and the GNU System distribution. [this message]
2019-10-02  7:26   ` Christopher Baines
2019-10-17 20:21     ` Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191002071757.4659-1-christopher.baines@digital.cabinet-office.gov.uk \
    --to=guix-devel@gnu.org \
    --cc=christopher.baines@digital.cabinet-office.gov.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).