From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Baines via "Development of GNU Guix and the GNU System distribution." Subject: [PATCH] http: Support fetching builds by derivation. Date: Wed, 2 Oct 2019 08:17:57 +0100 Message-ID: <20191002071757.4659-1-christopher.baines@digital.cabinet-office.gov.uk> References: <87sgocrf4r.fsf@gnu.org> Reply-To: Christopher Baines Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56482) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFYtk-0001VF-Am for guix-devel@gnu.org; Wed, 02 Oct 2019 03:18:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFYtf-000407-Gx for guix-devel@gnu.org; Wed, 02 Oct 2019 03:18:06 -0400 Received: from mira.cbaines.net ([2a01:7e00::f03c:91ff:fe69:8da9]:58570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iFYtf-0003uG-By for guix-devel@gnu.org; Wed, 02 Oct 2019 03:18:03 -0400 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 155041742F for ; Wed, 2 Oct 2019 08:17:59 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id dd46f6c1 for ; Wed, 2 Oct 2019 07:17:57 +0000 (UTC) In-Reply-To: <87sgocrf4r.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@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 ge= tting 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)) =20 @@ -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 --=20 2.23.0