From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mCHnMasB/WETWAAAgWs5BA (envelope-from ) for ; Fri, 04 Feb 2022 11:36:27 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id MPQzL6sB/WHejQAA9RJhRA (envelope-from ) for ; Fri, 04 Feb 2022 11:36:27 +0100 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 6876221F49 for ; Fri, 4 Feb 2022 11:36:27 +0100 (CET) Received: from localhost ([::1]:32800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nFvx4-0000un-6b for larch@yhetil.org; Fri, 04 Feb 2022 05:36:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFvvs-0000sh-Au for guix-devel@gnu.org; Fri, 04 Feb 2022 05:35:12 -0500 Received: from mira.cbaines.net ([212.71.252.8]:36294) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nFvvp-0005kP-Jr for guix-devel@gnu.org; Fri, 04 Feb 2022 05:35:11 -0500 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 7350127BBE9; Fri, 4 Feb 2022 10:34:45 +0000 (GMT) Received: from capella (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id aec43ca5; Fri, 4 Feb 2022 10:34:45 +0000 (UTC) References: <87czs7ypb4.fsf@inria.fr> User-agent: mu4e 1.6.10; emacs 27.2 From: Christopher Baines To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: Guix Data Service client module Date: Fri, 04 Feb 2022 10:14:05 +0000 In-reply-to: <87czs7ypb4.fsf@inria.fr> Message-ID: <87zgn6gbst.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 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 Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643970987; 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=FehbNTft7koXuQ3uTHgoNg5LubcEQojyATwIT4mDO40=; b=M+FYa5Knxix/UFmKowAvf46OeLBMo4VSx21Qp+8pz46mzQHz0c6Kvmf4+a0PAvPMJ7cOpk K0je+JcopKR3NEHUlTXs2P3ag0TR+lY7gtDcwSNE16LWnw6rPua8aW/QsY6i0unf6+IO+h ickC/5FarO8A7PO2nPgPc6rGEVL+2XOjdxrPDK+CwUjoxGu9hmliSBhk6GCVVb9sWBAftv Ks/mcAO6ddhCoTqMDI5NJ6XZcLgCPqNHpQB6U1wG1EP/uxuezhAY1iicVLEVIxpIb4MsqA GBZej0X4FvpzkDOqrhzD/q517g9el4ka3w+uqaQWU5eOyV2JpbHZNp8Itt7+kg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643970987; a=rsa-sha256; cv=none; b=Byc49pEnlx3HBPxU85SWMkdcgJ5k2ozu4gYsww99ZQIqiJGfyht79l+eR94x9v/F7GBluc 3OrAl4FDBT6Yha0IAJWQZtHcP79+/yMSAamrWRfsokms3WgFuLwiD3evausXe8FXB3w8jC pW7npQ1DUvABJ511hlVTZ5+hCAE3YfITgjkq4AHOliYJjs+xSlRWYr9EmLVAgHQSr5c9xd SiPCeVi1vIiScljRKE/7G1mS9QYuVVUtxQRP0mI2Gylmyk9/fcczC/37BGeWFbpv9fLq/0 w0fgtiPGZsorOcyhOhpT6p5R3KNS5TIiahHU9+5ZUtQL0LWVky3w44X+ORC6gA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.83 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 6876221F49 X-Spam-Score: -5.83 X-Migadu-Scanner: scn0.migadu.com X-TUID: PQU/ksyF0kVk --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Hello Guix! > > Here=E2=80=99s a client module for the Guix Data Service, allowing you to= access > a subset of the Guix Data Service interfaces from the comfort of your > REPL. > > I had it sitting in my source tree for a while and Chris sent me an > impressive shell one-liner that made me want to try from Scheme: > > wget > "https://data.guix-patches.cbaines.net/revision/47f85c53d954f857b45cebefe= e27ec512d917484/lint-warnings.json?locale=3Den_US.UTF-8&linter=3Dinput-labe= ls&field=3Dlinter&field=3Dmessage&field=3Dlocation" > -O - | jq -r '.lint_warnings | .[] | .package.name' | sort | uniq | wc > -l > > Turns out we can do the same in two long lines of Scheme! > > scheme@(guix data-service)> (define s (open-data-service "https://data.gu= ix-patches.cbaines.net")) > scheme@(guix data-service)> (length (delete-duplicates (map lint-warning-= package (revision-lint-warnings s "47f85c53d954f857b45cebefee27ec512d917484= " "input-labels")))) > $6 =3D 3560 > > > (That counts the number of packages at that revision that have one or > more warnings from the new =E2=80=98input-labels=E2=80=99 lint checker.) > > We can do other things, such as browsing package versions: > > scheme@(guix data-service)> (define s (open-data-service "https://data.gu= ix.gnu.org")) > scheme@(guix data-service)> (package-version-branches (car (package-versi= ons (lookup-package s "emacs")))) > $9 =3D (#< name: "master" repository-id: 1>) > scheme@(guix data-service)> (package-version-history s (car $9) "emacs") > $10 =3D (#< version: "27.2" first-revision: #< commit: "cc33f50d0e2a7835e99913226cb4c4b0e9e961ae" date: #> last-revision: #< commit: "364b56124b88398c199aacbfd4f= dfc9a1583e634" date: #>> #< versi= on: "27.1" first-revision: #< commit: "36a09d185343375a5cba370431= 870f9c4435d623" date: #> last-revision: #< comm= it: "ac29d37e2ffd7a85adfcac9be4d5bce018289bec" date: #>> = #< version: "26.3" first-revision: #< comm= it: "43412ab967ee00789fe933f916d804aed9961c57" date: #> l= ast-revision: #< commit: "bf19d5e4b26a2e38fe93a45f9341e14476ea5f8= 2" date: #>> #< version: "26.2" f= irst-revision: #< commit: "5069baedb8a902c3b1ea9656c11471658a1de5= 6b" date: #> last-revision: #< commit: "02c6127= 8f1327d403f072f42e6b92a1dc62fc93a" date: #>> #< version: "26.1" first-revision: #< commit: "897f303= d2fa61497a931cf5fcb43349eb5f44c14" date: #> last-revision:= #< commit: "ee6c4b62b88640f3828cf73a30377124e16cb95f" date: #>>) > > Now all we need to do is plug it into the right tools and enjoy! Thanks for writing this Ludo, sorry it's taken so long for me to have a look. I've had a little play around with it locally, and it seems to work well. I added some exports (included below) so that I could more easily use the module. Maybe open-data-service could have the url default to "https://data.guix.gnu.org". The only thing I can see that's required before merging though is the exports. I'm now thinking about this kind of thing (getting data out of the data service) in the context of patch/branch review. Thanks, Chris #:export (repository? repository-id repository-label repository-url repository-branches branch? branch-name branch-repository-id package-version? package-version-string package-version-branches package? package-name package-versions revision? revision-commit revision-date build? build-server-id build-id build-time channel-instance? channel-instance-system channel-instance-derivation channel-instance-builds lint-warning? lint-warning-package lint-warning-package-version lint-warning-message lint-warning-location open-data-service lookup-package lookup-repository package-version-history revision-channel-instances revision-lint-warnings)) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmH9AUJfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XfCSRAAlLK65H7aYJ9XpOTEpHXnc4lzVJOQjzfR D+HFNG5diAM8q0DtCicfvUtVrK2Jlvwu+Yo+iKKHDtd/1ZSepZye1rIYuha7ySV9 S2wZhjw5i1X7zgbYDB2/fTslVlewjGFJYhgooslwAvdIfwEUDB3A7c4xWxfN7emE 0C571izDWSkGnvh0L4yPV24jaSIRMYeeg+oCCjbC7Cw709+nTH7jJMQR+gQH8HVQ RJwH1kHQFlEil50XXCk8bHHdvtTOuaK4BjNWn1/M89acLsijpgpXPfIEnzveuKu7 k0lGg0pA2Lg909lddqziJ7ezoi20bEdrh5LRYha114MZgPJfjbzirTs8JW1+PE7A pVJJHzvuFIj87pcQHNNXMpl7SIbu499SeUSPVceoclOP2+fxpjfb8vZSb5qPicPt dV7y/+dgE+PhTbM6Dt1y4Z7nGBRr75y0NJ+dZn5a8sVLogRG5jfwGwSRu/LV0k+l mWIHonXSgCcKDwokZ8/SKceDcABjVvXRN36/itwRW7kcV7jEIDqQeFHj8dcfi7Ie idr3yF4NK14EfP0w6gbIKtxgH5yVTPR67arnk2bpkOT4Ya9wn+jgTHGLAmUugD3s FfNz3qkVWkJua5u0ZEYL/bF2QJ1mNS8Z6LT1WqOv9hkBiKS5+6u8hoN/NJHYKE/h Wak6pPE+TNQ= =ZTrZ -----END PGP SIGNATURE----- --=-=-=--