[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Christopher Baines |
Date: |
Thu, 17 Oct 2019 16:21:28 -0400 (EDT) |
branch: master
commit 9acb0aa55b5787edef885bb812e2ee66d4401e80
Author: Christopher Baines <address@hidden>
Date: Sun Sep 29 19:13:02 2019 +0100
http: Support fetching builds by derivation.
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