From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eEu8IFvmfWBSXwAAgWs5BA (envelope-from ) for ; Mon, 19 Apr 2021 22:21:47 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id EPuIG1vmfWD9NwAAB5/wlQ (envelope-from ) for ; Mon, 19 Apr 2021 20:21: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 CD2F613B47 for ; Mon, 19 Apr 2021 22:21:46 +0200 (CEST) Received: from localhost ([::1]:45978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYaOv-0004lA-Il for larch@yhetil.org; Mon, 19 Apr 2021 16:21:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYaNd-00046M-Jp for guix-devel@gnu.org; Mon, 19 Apr 2021 16:20:25 -0400 Received: from mira.cbaines.net ([212.71.252.8]:56080) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYaNb-00018c-C0 for guix-devel@gnu.org; Mon, 19 Apr 2021 16:20:25 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 7BD2C27BC6C; Mon, 19 Apr 2021 21:20:21 +0100 (BST) Received: from capella (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 8cd42fc3; Mon, 19 Apr 2021 20:20:21 +0000 (UTC) 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> <87zgxvimbe.fsf@cbaines.net> <20210418161230.72ecae02@lubrito> <87r1j6ist6.fsf@cbaines.net> <20210419110425.7bd26e41@lubrito> User-agent: mu4e 1.4.15; emacs 27.1 From: Christopher Baines To: Luciana Lima Brito Subject: Re: Outreachy - Guix Data Service: implementing basic json output for derivation comparison page In-reply-to: <20210419110425.7bd26e41@lubrito> Date: Mon, 19 Apr 2021 21:20:18 +0100 Message-ID: <87k0oyhvr1.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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=1618863707; 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; bh=4wEDDs+QdtaFpMcippqlICeIkqwNY1wrtYpPBzWwsf0=; b=FksrRu4tYGxm5Imrnd+sjgSzQlgcjTXkCczswtGuqt8/zU3IF0Xu+lJkzIgQt1yIOmkrS4 tr8Ja/mAXR9bfs0e5a3HyL8LjTuTIElNp61B7t18SUHod0sTNU23OScXKHTAq1tfIdoJR+ MGBWimrVpXICA29cY192kML+nO3sApVmMrHuaQyAvHlZsy1PQIT1XiSJe1plorIahKIyA9 wa5lpOu1fCwTRWOzSnFHCXah+b6L3I1dVdtwCd44FunfFNc9zV2Wure6uJRjW2+IeIldNH r59Icxtfm2QPRD6oQjh8FB/uO0s0nZUl9jvzlM2kgwi3ayMBCks6RTprGVnKtw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618863707; a=rsa-sha256; cv=none; b=LKl5hsSxc93/XN9HB5zb74tG/KBcEvCJWom733oFypVJAjrxFF91hmfA/Bf244QETJENtE x+IGznKTBKH/mssrAiw/+tY/u1aQCV/gd3xIx3PXCSUlwJqST0DQ6N2tPRRkYM9jZ/eIva m9ZS0+8AI1Een52PseAQrcIgN4xcNQHDJYMeW5ZZ3A+aY5aveHJXqz6llkuu2upD0FwyBa MlJ32T/avDDJW5oF4g9jOkEjeqhn6QCbr2SIHUevDolhL0dgEqK8LRUUJVnOI28E3Yo72n 3RRahS2ob07gyG7xnywIW6Ssi16lkIMjSdPHfxqxrW84JZzIHER/6v6PjXtxrA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; 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: -0.54 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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: CD2F613B47 X-Spam-Score: -0.54 X-Migadu-Scanner: scn0.migadu.com X-TUID: xM8d9niPWwx0 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Luciana Lima Brito writes: > On Mon, 19 Apr 2021 09:26:13 +0100 > Christopher Baines wrote: > >> As an example, if you have this structure. >> >> '((foo . 1) >> (bar . 2)) >> >> and you want the numbers to be strings, you can do something like: >> >> (map (match-lambda >> ((name . number) >> (cons name (number->string number)))) >> data) >> >> and I think a similar approach for the transformation you're trying to >> perform to the arguments will more cleanly represent what you're >> trying to do. > > It helped a lot! > >> One different thing I noticed: >> >> ,@(if (not (string? hash-alg)) >> '() >> `((hash-algorithm . ,hash-alg))) >> >> I'd suggest simplifying this by flipping the different parts of the >> if, and removing the not. > > Done. Great, I've gone ahead and pushed this now. I tweaked the following things, it's mostly removing trailing whitespace, and I changed the way the alist was formatted, just so it's a bit more compact (how it was before is OK as well). @@ -617,7 +617,7 @@ (lambda (label items) (cons label (list->vector =2D (map=20 + (map (match-lambda ((derivation output) `((derivation . ,derivation) @@ -651,24 +651,18 @@ ((label args ...) `(,label . ,(list->vector args)))) (assq-ref data 'arguments)))) =2D=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 + (render-json =2D `((base =2D . ((derivation . ,base-derivation))) =2D (target =2D . ((derivation . ,target-derivation))) =2D (outputs =2D . ,outputs) =2D (inputs =2D . ,inputs) =2D (sources=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 =2D . ,sources) =2D (system =2D . ,(assq-ref data 'system)) =2D (builder =2D . ,(assq-ref data 'builder)) =2D (arguments . ,arguments) =2D (environment-variables . ,(assq-ref data 'environment-= variables))) + `((base . ((derivation . ,base-derivation= ))) + (target . ((derivation . ,target-derivati= on))) + (outputs . ,outputs) + (inputs . ,inputs) + (sources . ,sources) + (system . ,(assq-ref data 'system)) + (builder . ,(assq-ref data 'builder)) + (arguments . ,arguments) + (environment-variables . ,(assq-ref + data 'environment-variables))) #:extra-headers http-headers-for-unchanging-content))) (else (render-html In terms of what to do next, you could continue on this derivation comparison path. Some of the code you've got here could be used to make the data better right when the database is queried. Take the recursive field for outputs for example, it would be better to convert it to a boolean where the database query is made. Also, there's some admin to do in terms of recording a contribution, and starting to think about submitting the final application. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmB95gJfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XcB2xAAilCvVlwT5mfoJ34QuJc88t3P8/RLoEFN Z78qmFWKKezr/xgxCw21DsmpUqV3AqKMtRvIk2BaXA/9XBvGfcd517wR976NL9h+ rv4khKMWpdiFLLKyXMZmZMzepDC1b7634JBkbBaW2Gpzw7vvb/itgCUfgNAigtda Cin8c5sdoMJLB6gVwf9kZm9kio3sTLjr3vB3nMOveI4CIa4ITUZPwi2zAPwe0zbB eznB9eb9Bo0ouQnP6HVRvULyVuhvkY1EgP8Ch/oO8iFcscfbJKKYvJ6VOZZyP+eO ueejAkKsdrJG4MQeyC8MquAjqfvOCuFxxigvP8d7eUZRrmVns2crjKujsPzKkH7m M9sE/AiuRBG7nIuF/OFRVanrNf69nB+EpC7IEcrBkDeR4jVDO2rOXrPjRaVM6zGm i4pXam4pNCOMzDLAeNGEvawBWes0VOplp4u9f0eTTUAT72v0KgfKbULUAktCji/X KvYmgQSjet2E5HzphMTLrF6KFLnpCkW42dFwqTXw/tVs4Af/T9pOtV6bF0+dSYhy HS22JiAeJ9hvagMm60f9R3ueueVQwVrm0IikRzrBySjsU/YQUthBZNlKFt28lLjg Z7uG6UAg75ucEeuZtsvcgYkTvopEMG75rbboaza1x1SDVjmJIx3AGVCmfhEYYZ+F vH6vCLNgc/M= =uo4f -----END PGP SIGNATURE----- --=-=-=--