From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 aCwBOHxLzWK7JgAAbAwnHQ (envelope-from ) for ; Tue, 12 Jul 2022 12:22:52 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 2AL3N3xLzWK+NAAAauVa8A (envelope-from ) for ; Tue, 12 Jul 2022 12:22:52 +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 920102F832 for ; Tue, 12 Jul 2022 12:22:52 +0200 (CEST) Received: from localhost ([::1]:40280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBD2Z-0005mi-6o for larch@yhetil.org; Tue, 12 Jul 2022 06:22:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBCv2-0007IP-RQ for guix-patches@gnu.org; Tue, 12 Jul 2022 06:15:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47821) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oBCv0-0000VP-4L for guix-patches@gnu.org; Tue, 12 Jul 2022 06:15:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oBCuz-0000pM-SW for guix-patches@gnu.org; Tue, 12 Jul 2022 06:15: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: Tue, 12 Jul 2022 10:15: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.16576208553103 (code B ref 56428); Tue, 12 Jul 2022 10:15:01 +0000 Received: (at 56428) by debbugs.gnu.org; 12 Jul 2022 10:14:15 +0000 Received: from localhost ([127.0.0.1]:41715 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oBCuA-0000no-Hn for submit@debbugs.gnu.org; Tue, 12 Jul 2022 06:14:15 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:36129) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oBCu7-0000nC-Tr for 56428@debbugs.gnu.org; Tue, 12 Jul 2022 06:14:09 -0400 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id CE15B1C0005; Tue, 12 Jul 2022 10:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1657620841; 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=8tevDj4bUO1bsXCL1ZqVXmiOoFmYY12y0V5qC9fh9lA=; b=Wzq2LRBHjp/WQYhid1Mytru640LoD5w1yMOrVKoXrbi+LeA+fbiku+7RopESi8b/mbDVjz LwHak85xS7D+b+RsUnr0LTa7q3svRtowZAp3Oqbe+NyEZVPhWPk9X2YN0AdK4ZIhlVP476 UCs+/D0WvmzZEwcO75pcVkOnOtAYbYwu+CXCKCl5vtX4XhbZMjfXfbtPnYWEf4/emdDYk0 ZBlyAQMNtM4glvGwavAwdT8K/OANAjoKHi7zAgl428kgYC5ho7P/qT4erTQz3KEBN1u9ca F4ZBDeG+d0vOOhrATNEcMArjysAKRdHxOZeZX0OBGy/T+uzI7oHcx839U1pSFQ== From: Andrew Tropin In-Reply-To: <20220707150644.2349-1-antero@mailbox.org> References: <20220706191311.14662-1-antero@mailbox.org> <20220707150644.2349-1-antero@mailbox.org> Date: Tue, 12 Jul 2022 13:13:57 +0300 Message-ID: <87o7xu1vve.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=1657621372; 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=8tevDj4bUO1bsXCL1ZqVXmiOoFmYY12y0V5qC9fh9lA=; b=KGstDhLVbeKbgegofKaNA2liQSYfYDzaTPVkQIj+P5B/QK8o184UdeoPY5VvojT43ZFoSh 1upaNC+tyy2ckncTHbZOHZoQa4FSAA1PcEcvaRBZU7JqzidKAXCO3gzjmDZsnksfrMZr5n wd23oSlZdFnfo8zNNYqKs8kVjuU+E03DjW39TNpncFs6fq8xVzVO/t00L92zcs94IiOpH4 1fc5lDcTiguAKEhQQfcO9plwb0R5QzrQPAMfMz+vB7D2malPg1o1a+xBL6UMdmDpo8oNNw si8QVkyKwph0YAoTiX8zir4hDLX+XZo0NlRtRVrNlCjFagFPB9pY8GZ4nw5FuA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657621372; a=rsa-sha256; cv=none; b=ebsUSC8kqgdIqD3TkxPJ/yJdoQUZH5wnTErrXc2uLTKYAoL0OEEFlbTVYCYg0o+Cwp+XTv uQZFAqXyIqV68VQ+9YGqaVaNz63jdUA/ZD1zbWeT3m0oTnEaajz5mLAVbLZc19REz4eIZx DF9iOxp6Ezcb0swmut1shlDXoN8/XPG6yWzs2/FeoZ7tTLoXV0EaoAxiTFRzSZv/kzWxKr U56RVFxZv0mJBr6mzVwao7OtvzAltOHnEaeQcJpjtI8ZbC5PPrqs1q9mAWeYrdHY0SVboY XcmGfUetCfQCBQyxXL7QpQFLd5JmuBDjjnQx/5jH/xk9z5L67nZqkltz/Xm80Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=Wzq2LRBH; 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.45 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=Wzq2LRBH; 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: 920102F832 X-Spam-Score: -1.45 X-Migadu-Scanner: scn0.migadu.com X-TUID: NeNec7T7Ot4j --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2022-07-07 15:06, Antero Mejr via Guix-patches via wrote: Hi Antero, this is a good addition, thank you very much! A hint: use reroll-count when generating new revision of the patch and subject will become [PATCH v2], [PATCH v3] etc. > * guix/scripts/package.scm (list-installed): New procedure. > * guix/scripts/home.scm: Use it. > --- > Remove extra (reverse...) from last patch. > > guix/scripts/home.scm | 12 ++++++++++++ > guix/scripts/package.scm | 30 +++++++++++++++++------------- > 2 files changed, 29 insertions(+), 13 deletions(-) > > diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm > index 0f5c3388a1..b0b8412d8c 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")) 1. guix home/system and guix package has slightly different cli: guix package --list-generations vs guix home/system list-generations I think that later is more apropriate, because: `guix package --remove=3Dhtop --list-installed` is possible, but doesn't make too much sense, and `guix home reconfigure ./he.scm list-installed` is not possible, because only one action at time can be specicified. Implementing this functionality as --argument makes it possible to type `guix home reconfigure ./he.scm --list-installed`, which again doesn't make much sense as in the example above. I advice either implement list-installed as a separate action or as an additional --argument to describe/list-generations action. 2. Would be good to mention it in doc/guix.texi. 3. It would be nice to implement the same for guix system. > + (newline) > + (display (G_ " > -h, --help display this help and exit")) > (display (G_ " > -V, --version display version information and exit")) > @@ -183,6 +188,13 @@ (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 > + (list-installed (or arg "") > + (list > + (string-append %guix-home "/profile= ")))) > + (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..02e91a0ee1 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,20 @@ (define absolute >=20=20 > (add-indirect-root store absolute)) >=20=20 > +(define-public (list-installed regexp profiles) To make it consistent with the rest of the module, I think it will better to use define and explicitly export list-installed in module definition at the top of the file. > + (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))) > + rows)))) > + > > ;;; > ;;; Queries and actions. > @@ -824,19 +839,8 @@ (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))))) > + ;; Show most recently installed packages last. > + (pretty-print-table (reverse (list-installed regexp profiles))) > #t) >=20=20 > (('list-available regexp) Tested the patch, guix package -I, guix home -I filter-regex works good, but see my comments above. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmLNSWUACgkQIgjSCVjB 3rBUGA/8CEASxPKUccYwJNNO5vC6L2MewwKCrB7SbTJEQURaii79yqcKAiO9CIus A6u/S+7v7zM23v2HVym8BsCk2JOqoIJM1kL3DJmqZ4fsRqHWSdnyX43eQ4mdtp6J /JziR+tZvFLtljtPMs1V1tMeiLKd25XioNysId4zBHOArEEymE5tLhcnvocaDX6/ bl4Rx2tsOwL2R8J/+lOFnGEbphI+yp5W2U+kt+QGlx3lMBM/PO7ol+BmJLflP5Od qQEDIZ8D4j5zPccNNvfw9ojUmi/RKXyMJpkFDNaHFQt2gT0mWjMPhH+c4sqnU5xw AF7gdizJzNCUzdsMx7YluZ5rPhtPsYZU4MNMoBTGbQac+YkgEhTypcVb4o1gnxHd I6hXbCIRSavtoGHthfgwmjk21TpP9b08e55ItWiA5s4BDIBMvTwHJguJVWTCqfc3 1uacjhwuXt2GAxoGptM2/cYW8vOyjISi/mnY8RRz6Ajohw5X5pcBHgrvFhS9pgqP l+LKc/amihCqSMF9Kcb+0cPu/iIYnn0jVnkfV24DqUBzKP5rmaozXw/vXDB4hxFs KbIWtWHz195apUN7yzUfOpJk1fxmKyPDg51+1JOFYoD9iunivPLhULDmlvhNKQvf dwAd2w0/ndn/TaTKOD5gN7CSUlzkagLqTSqtxDex/RJRlAD6zhs= =8wb9 -----END PGP SIGNATURE----- --=-=-=--