From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CMH8Bwu17GKLJQEAbAwnHQ (envelope-from ) for ; Fri, 05 Aug 2022 08:13:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id qEcEBwu17GIOnAAAG6o9tA (envelope-from ) for ; Fri, 05 Aug 2022 08:13:31 +0200 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 BF5CD293E1 for ; Fri, 5 Aug 2022 08:13:30 +0200 (CEST) Received: from localhost ([::1]:49622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJqaP-0002h8-Ml for larch@yhetil.org; Fri, 05 Aug 2022 02:13:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJqZy-0002gk-5W for guix-patches@gnu.org; Fri, 05 Aug 2022 02:13:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37800) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oJqZx-0001qO-TJ for guix-patches@gnu.org; Fri, 05 Aug 2022 02:13:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oJqZx-0004Fx-PQ for guix-patches@gnu.org; Fri, 05 Aug 2022 02:13:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56428] [PATCH] home: Add -I, --list-installed option. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 05 Aug 2022 06:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56428 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Antero Mejr , 56428@debbugs.gnu.org Received: via spool by 56428-submit@debbugs.gnu.org id=B56428.165967994116309 (code B ref 56428); Fri, 05 Aug 2022 06:13:01 +0000 Received: (at 56428) by debbugs.gnu.org; 5 Aug 2022 06:12:21 +0000 Received: from localhost ([127.0.0.1]:55782 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJqZJ-0004Ex-79 for submit@debbugs.gnu.org; Fri, 05 Aug 2022 02:12:21 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:40523) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJqZG-0004Eg-Iv for 56428@debbugs.gnu.org; Fri, 05 Aug 2022 02:12:19 -0400 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id 4C11B40003; Fri, 5 Aug 2022 06:12:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1659679931; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XJhD04gDVHKeTQ2CiBVn6wWurJg7UuikD2dZ6z/puW4=; b=H80ObxwptvHxfq+w4Lq8Of2hvA76wD21FRyvISr7jvlXVH2zOHnurVHEgCOkqZ6S6t4wEV Ss5m2drHUYYHCfowfxdxQePRcxyEbn4c+DNXXzkwcUjLMJXfTn5Q1PoCUY9UpMhtrqfGnr /uBfp65c6T2c1z91ZvnT8dk09MGXKFhprZWBD5EPUkTuO3zn55YMV3fTR7ci7Uj5ca2+oV OqZNC/yTAGinKv1DnxLxzvj71ochGaOB71klGeaODEOy5e8vhhROYd937kPL6bDYyNV6Bx VD3bil7qIjWPo9pwUekXZiMER0yahFSLAWwXqkWdmyhqV0JUBD/6n6gWSSqbew== From: Andrew Tropin In-Reply-To: <20220706191311.14662-1-antero@mailbox.org> References: <20220706191311.14662-1-antero@mailbox.org> Date: Fri, 05 Aug 2022 09:12:06 +0300 Message-ID: <87fsibb4nd.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659680010; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=XJhD04gDVHKeTQ2CiBVn6wWurJg7UuikD2dZ6z/puW4=; b=FKikDI4qvLh62FiIbE4vWVZZ2j7Fl4CTUG2gxnC3mfCONwcwG1pxn6P7selFzLbo8vsrpk 9KnjISoreZWjYBzh/MK1MzSPCeglOvSVbHdTJH+SN29iqZZLZdsTbRA22CGCG24lQqx71W OahNTpU0HFahPr/rssMzd1MbqSS4+2hwUBVC1U76ByJLLBEXjYOxVf9IAXJSdExYySYfzb CtOcHqCUpM7ZUVMArb5QzOMzWALvqd48HuFjCVJUQHcUn4VtWaDYaO+54bBSqzl2he+OPi xpm71RtN91NrRZ5Q0LLYgxg5bH3f0oNlzx8O5EhRtVATEyAGQgSaU5akHjGQqA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659680010; a=rsa-sha256; cv=none; b=SCpT88+TiplDQJ//QL7vqZ9esvrNbLVy7VLhC/3szzaofjgjitfoLK3cPLOPZ+Nf1JdMZk VtoWXegHgD0QvtReq8lOHYvDpeWrefIxT9h9k9/nzrHGzG5i9HwXPjhBJNA16R1lyIuKh2 xWkATTlrFO5qmfsPZ/mhPR+IpPO1XI4x3splulii4SGwwFPzTZVNftCB6rvKC8XbLG+5Nd mN4yM3cNEjNz4mrxkPeqBkJLLRFaOqZ1Zz2RybEYUXF4IkVR2OQiqt+iM5uy5BUfRKM1Cq SI+HUqRXt2ykjQKKwQF9PKGaaOeZi9BpkjJ4s8nv/ZFfwt7Djckolv58Vl9Qgg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=H80Obxwp; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=H80Obxwp; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: BF5CD293E1 X-Spam-Score: -1.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: yEw2zflKyCIk --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2022-07-06 19:13, Antero Mejr via Guix-patches via wrote: > * guix/scripts/package.scm (list-installed): New procedure. > * guix/scripts/home.scm: Use it. > --- > guix/scripts/home.scm | 13 +++++++++++++ > guix/scripts/package.scm | 30 +++++++++++++++++------------- > 2 files changed, 30 insertions(+), 13 deletions(-) > > diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm > index 0f5c3388a1..7a5078fe3b 100644 > --- a/guix/scripts/home.scm > +++ b/guix/scripts/home.scm > @@ -4,6 +4,7 @@ > ;;; Copyright =C2=A9 2021 Pierre Langlois > ;;; Copyright =C2=A9 2021 Oleg Pykhalov > ;;; Copyright =C2=A9 2022 Ludovic Court=C3=A8s > +;;; Copyright =C2=A9 2022 Antero Mejr > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -143,6 +144,10 @@ (define (show-help) > use BACKEND for 'extension-graph' and 'shepherd= -graph'")) > (newline) > (display (G_ " > + -I, --list-installed[=3DREGEXP] > + list installed packages matching REGEXP")) > + (newline) > + (display (G_ " > -h, --help display this help and exit")) > (display (G_ " > -V, --version display version information and exit")) > @@ -183,6 +188,14 @@ (define %options > (option '("graph-backend") #t #f > (lambda (opt name arg result) > (alist-cons 'graph-backend arg result))) > + (option '(#\I "list-installed") #f #t > + (lambda (opt name arg result) > + (pretty-print-table > + (reverse > + (list-installed (or arg "") > + (list > + (string-append %guix-home "/profil= e"))))) > + (exit 0))) >=20=20 > ;; Container options. > (option '(#\N "network") #f #f > diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm > index 99a6cfaa29..144d18a626 100644 > --- a/guix/scripts/package.scm > +++ b/guix/scripts/package.scm > @@ -11,6 +11,7 @@ > ;;; Copyright =C2=A9 2020 Simon Tournier > ;;; Copyright =C2=A9 2018 Steve Sprang > ;;; Copyright =C2=A9 2022 Josselin Poiret > +;;; Copyright =C2=A9 2022 Antero Mejr > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -773,6 +774,21 @@ (define absolute >=20=20 > (add-indirect-root store absolute)) >=20=20 > +(define-public (list-installed regexp profiles) > + (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) > + (manifest (concatenate-manifests > + (map profile-manifest profiles))) > + (installed (manifest-entries manifest))) > + (leave-on-EPIPE > + (let ((rows (filter-map > + (match-lambda > + (($ name version output path _) > + (and (regexp-exec regexp name) > + (list name (or version "?") output path)))) > + installed))) > + ;; Show most recently installed packages last. > + (reverse rows))))) > + > > ;;; > ;;; Queries and actions. > @@ -824,19 +840,7 @@ (define (diff-profiles profile numbers) > #t) >=20=20 > (('list-installed regexp) > - (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) > - (manifest (concatenate-manifests > - (map profile-manifest profiles))) > - (installed (manifest-entries manifest))) > - (leave-on-EPIPE > - (let ((rows (filter-map > - (match-lambda > - (($ name version output path _) > - (and (regexp-exec regexp name) > - (list name (or version "?") output path))= )) > - installed))) > - ;; Show most recently installed packages last. > - (pretty-print-table (reverse rows))))) > + (pretty-print-table (list-installed regexp profiles)) > #t) >=20=20 > (('list-available regexp) =2DI --list-installed works great, thank you. Just a thought for future: Maybe it would be useful to have another option to list all the packages in profile, including propagated. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmLstLYACgkQIgjSCVjB 3rBnGw/6AyqaI/udt2cu9CYmo0f1WMs4RF0e1tGY/t1OnP0fIE2x9vP+b+7c/OHv Nt+bCAWJw4DSoPXNYdezxYUFaCfbx8i4/cOt0e2s607Q4FcpZ4Y3zbUIhjURfUsV 6iYrnj0HeycGxrZHu5v9qwKfCubRJsCaCumYkSzhmfYY237Igx+OlHFXTSitu4/Z zhnsqSNJERG5tCXJtB2N98iRPhJOm94g58xyNI4LGwUtvKJv15bGpU+MZitEQ7z+ 5EaXLeTco6/CVfcUvBQ3+nCbNi9AlirjT7gLFyjjYrDgClBzUsNq9FEYQUnE+LlD Xm4cz3budmoFZZVEKzYCSl1k1Tn5XFtgdR2RUghHBWi6sXQJecDUifOm1JM0Z6yo zg+0zhtC9K97vpV+g04BkTcAxAIfzDTGgVrgi+YPEaUUu+sPL+fUaZ0IH9PSUNH0 DE81cwhSIM0UZ8Mn5yK+6S5BDiXBRpuUs0SVGMVqmnTORZqYpvDCfOB7QhXEwOEu mKD08W0dsp3HupnlnO27+hpBlvIJ8zSytxgZhQh0UOdfLvzoy4jdFjcsF5LvWUzi 5kiEA42OGxWZFfYwiaydFdnLhdADktw6mnJcUD1WtbAKxXM1bvQSJrw3Wc+t46qe I47qnRYIRkKO7yy+pgt7JoCeCntTyPYlVsG8rIcGVMqUuej1pIc= =mGZe -----END PGP SIGNATURE----- --=-=-=--