From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6D3KN/MxfGCcHQAAgWs5BA (envelope-from ) for ; Sun, 18 Apr 2021 15:19:47 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id CJ9NM/MxfGDDJwAAB5/wlQ (envelope-from ) for ; Sun, 18 Apr 2021 13:19:47 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8CCD817430 for ; Sun, 18 Apr 2021 15:19:47 +0200 (CEST) Received: from localhost ([::1]:56832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lY7L0-0004eY-9D for larch@yhetil.org; Sun, 18 Apr 2021 09:19:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lY7Kr-0004eS-6u for guix-devel@gnu.org; Sun, 18 Apr 2021 09:19:37 -0400 Received: from mout01.posteo.de ([185.67.36.65]:58747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lY7Ko-0006cD-Sq for guix-devel@gnu.org; Sun, 18 Apr 2021 09:19:36 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id EB3EB240029 for ; Sun, 18 Apr 2021 15:19:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1618751972; bh=v8haj9+8YTKEjI4CvCyIsbxy/ffNpbesUJoyB3j9DRY=; h=Date:From:To:Cc:Subject:From; b=llqJUL4uuHSwIVaZJu1ZITpVzSaWnB7ZMVAOtfUaObY+LVC0bOFDf+aNFgdzhQpFP OpZ98ATHk2gaaWbErvTlOmY3qjTBxG67ouTZ6gNZuoCT19JqGU40xjLfRV4q/wwyX1 YjCYSw9YHAyYLTUvflxYA7dB8OPqEyhjh8aD5Tr+iemrAipBrues6BgFqrMXTl5bDJ tgVZqhvBwydDF10yrQnkWHEWKx+wTz8QTaiDbNLAd0H7p/NuAnBe2Xv2Out2PLCfHg pHoFk60mRE7+qDwiCriikloPW3HXaJQbc8IHgD+VyD0/BnLLkwcRRaTXnNfI4Dscr2 zBA9T4tpf4Arg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FNVsY4VVNz6tmG; Sun, 18 Apr 2021 15:19:29 +0200 (CEST) Date: Sun, 18 Apr 2021 13:19:21 +0000 From: Luciana Lima Brito To: Christopher Baines Subject: Re: Outreachy - Guix Data Service: implementing basic json output for derivation comparison page Message-ID: <20210418101921.473873a2@lubrito> In-Reply-To: <20210418101207.3ad239ae@lubrito> References: <20210414164859.7acc631f@lubrito> <87wnt4x7e3.fsf@cbaines.net> <20210415130947.7387a546@lubrito> <87o8efxhil.fsf@cbaines.net> <20210416120740.05a819ca@lubrito> <87czuuxmdd.fsf@cbaines.net> <20210416154600.62c4a97d@lubrito> <87a6pyxcme.fsf@cbaines.net> <20210416194735.0f4ccaed@lubrito> <877dl1xq15.fsf@cbaines.net> <20210417094857.14599c72@lubrito> <87bladjbsm.fsf@cbaines.net> <20210417110829.03ed516d@lubrito> <875z0kkdp1.fsf@cbaines.net> <20210418101207.3ad239ae@lubrito> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/daiwVUxf.4z6RHLrgjtIaHb" Received-SPF: pass client-ip=185.67.36.65; envelope-from=lubrito@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_FMBLA_NEWDOM=1.499, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618751987; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=I36tgBuw2kocoK9t/I+t77TMVRqU2ZVYDr/DjZ4FeYk=; b=QtcvjTzQ8DmYviJbbFfXh4PrxagYuiTea+5xcWL4klrLTIld7cBC8DWz1+FfvB149rt/oG OdDGksi9wWtyg58x0LYSguZl/eW3dMkZD2JssUBD+Tb4oAk07xqV+oPUh4V3tfDMhIeI0z pkF8CGkfg4YVEHLhIU7bx0FkylixZ9j5/8XYGsJ1xsCzrlXlfotiAdk7RcUEyvc3C0wWIZ IO4v0Uwn2IYF2EE87kAugrP8XU6aJN0aImwhBb+rrqNDJT8PAHQWPEiGehmJbspSNK+jiX 0i4ZPcTfUxoJyEGXYEae4rXlU6pLNGhXfK3pTuDcghfyGz2sTAeFiXVNGBuMdQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618751987; a=rsa-sha256; cv=none; b=qXOpBoje2PWWyapdyxziPj8TFvSuZ+XciFmGVVVW7IE5rHbn3xXnG8ppqjN1qcjP9gIP5h d/Afv8QXHrIG/zuMgrFg0DXJwIhul1kMA+P4NfaEwZROGAv0LhBMp46exgp68l2w0UIz6/ QK3482u+6y/idGqHxzGenB/x/0BpRH7YFqpWl0DvAub62x1z0oi6qlDx3+vxPNOeUZiV1D Zw7UGDxZVxitz+r4NmZB9qS5T2hJGXDF6DPN9YGXrpjLAIYNrTDbTWwU5MfwxfEPtpUdki 5YeuFXEipse5HiyM9wi3zs48i2Rky/2KDT9h3qnN57QOPE7DYdukFd4PHs1/mQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=llqJUL4u; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -2.64 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=llqJUL4u; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 8CCD817430 X-Spam-Score: -2.64 X-Migadu-Scanner: scn0.migadu.com X-TUID: Vbl/etyyCZ0s --MP_/daiwVUxf.4z6RHLrgjtIaHb Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sun, 18 Apr 2021 13:12:07 +0000 Luciana Lima Brito wrote: > Hi, > > On Sat, 17 Apr 2021 18:45:14 +0100 > Christopher Baines wrote: > > > Some more things to think about: > > > > - Variable naming, what does the "matched" in matched outputs mean? > > (same goes for the other "matched" things) > > The name matched would refer to the match function, but I changed to > *-values. The names I wanted were "outputs", "inputs" > and "sources", but I already used them. If you have anything in mind, > please let me know. > > > - (if (null? ...), I'm unsure if all of those checks are > > necessary, I believe some fields at least will never be "null?". > > I revised it, I think now it's better. > About the "recursive" field, apparently it assumes a string value "t" > or "f", and I convert this to a boolean. Are there other values > possible? > > > - Builder and arguments grouping, I think this makes sense on the > > HTML page, as they're connected, but does it make sense in the > > JSON? > > indeed, I separated them. > > > I think you're getting close to something that's ready to merge > > though. > > > One last thing, I see that on the html the commom inputs are ommited. > Does this make sense for the json too? > The last patch had a few misaligned parens, please disregard. This one is fixed. -- Best Regards, Luciana Lima Brito MSc. in Computer Science --MP_/daiwVUxf.4z6RHLrgjtIaHb Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-Implement-basic-json-output-for-the-derivation-compa.patch >From ff348cb5ce7db9ce9f08a6f0827356faa6465877 Mon Sep 17 00:00:00 2001 From: Luciana Brito Date: Sun, 11 Apr 2021 11:06:06 -0300 Subject: [PATCH] Implement basic json output for the derivation comparison page --- guix-data-service/web/compare/controller.scm | 83 +++++++++++++++++++- 1 file changed, 80 insertions(+), 3 deletions(-) diff --git a/guix-data-service/web/compare/controller.scm b/guix-data-service/web/compare/controller.scm index a6aa198..2ff7a40 100644 --- a/guix-data-service/web/compare/controller.scm +++ b/guix-data-service/web/compare/controller.scm @@ -588,9 +588,86 @@ '(application/json text/html) mime-types) ((application/json) - (render-json - '((error . "unimplemented")) ; TODO - #:extra-headers http-headers-for-unchanging-content)) + (let* ((outputs (assq-ref data 'outputs)) + (output-values + (map + (lambda (label items) + (cons label + (list->vector + (map + (match-lambda + ((name path hash-alg hash recursive) + `((name . ,name) + (path . ,path) + ,@(if (not (string? hash-alg)) + '() + `((hash-algorithm . ,hash-alg))) + ,@(if (not (string? hash)) + '() + `((hash . ,hash))) + (recursive . ,(string=? recursive "t"))))) + (or items '()))))) + '(base target common) + (list (assq-ref outputs 'base) + (assq-ref outputs 'target) + (assq-ref outputs 'common)))) + + (inputs (assq-ref data 'inputs)) + (input-values + (map + (lambda (label items) + (cons label + (list->vector + (map + (match-lambda + ((derivation output) + `((derivation . ,derivation) + (output . ,output)))) + (or items '()))))) + '(base target common) + (list (assq-ref inputs 'base) + (assq-ref inputs 'target)))) + + (sources (assq-ref data 'sources)) + (source-values + (map + (lambda (label items) + (cons label + (list->vector + (map + (match-lambda + ((derivation) + `((derivation . ,derivation)))) + (or items '()))))) + '(base target common) + (list (assq-ref sources 'base) + (assq-ref sources 'target) + (assq-ref sources 'common)))) + + (args (assq-ref data 'arguments)) + (base-args (list->vector (assq-ref args 'base))) + (target-args (list->vector (assq-ref args 'target)))) + + (render-json + `((base + . ((derivation . ,base-derivation))) + (target + . ((derivation . ,target-derivation))) + (outputs + . ,output-values) + (inputs + . ,input-values) + (sources + . ,source-values) + (system + . ,(assq-ref data 'system)) + (builder + . ,(assq-ref data 'builder)) + (arguments + . ((base . ,base-args) + (target . ,target-args))) + (environment-variables . ,(assq-ref data 'environment-variables))) + #:extra-headers http-headers-for-unchanging-content))) (else (render-html #:sxml (compare/derivation -- 2.30.2 --MP_/daiwVUxf.4z6RHLrgjtIaHb--