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 CFAKL+P2xmIeEAAAbAwnHQ (envelope-from ) for ; Thu, 07 Jul 2022 17:08:19 +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 sPP/LuP2xmL8kgAAauVa8A (envelope-from ) for ; Thu, 07 Jul 2022 17:08:19 +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 9A2BBC8EA for ; Thu, 7 Jul 2022 17:08:16 +0200 (CEST) Received: from localhost ([::1]:39370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9T71-0001c6-4x for larch@yhetil.org; Thu, 07 Jul 2022 11:08:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9T6o-0001aE-O1 for guix-patches@gnu.org; Thu, 07 Jul 2022 11:08:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35478) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9T6o-0004R6-FC for guix-patches@gnu.org; Thu, 07 Jul 2022 11:08:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o9T6o-0005tG-A2 for guix-patches@gnu.org; Thu, 07 Jul 2022 11:08:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56428] [PATCH] home: Add -I, --list-installed option. References: <20220706191311.14662-1-antero@mailbox.org> In-Reply-To: <20220706191311.14662-1-antero@mailbox.org> Resent-From: Antero Mejr Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 07 Jul 2022 15:08:02 +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: 56428@debbugs.gnu.org Received: via spool by 56428-submit@debbugs.gnu.org id=B56428.165720642722577 (code B ref 56428); Thu, 07 Jul 2022 15:08:02 +0000 Received: (at 56428) by debbugs.gnu.org; 7 Jul 2022 15:07:07 +0000 Received: from localhost ([127.0.0.1]:57608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o9T5r-0005s2-PS for submit@debbugs.gnu.org; Thu, 07 Jul 2022 11:07:07 -0400 Received: from mout-p-202.mailbox.org ([80.241.56.172]:59624) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o9T5o-0005rV-Iz for 56428@debbugs.gnu.org; Thu, 07 Jul 2022 11:07:02 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4Lf0B44yr8z9sQH for <56428@debbugs.gnu.org>; Thu, 7 Jul 2022 17:06:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1657206412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jmep6v4PGCpPVb4Gv6lVxdwlrYL9kcrWf5hBUAVTm8A=; b=fi+rypgSTDw5QcipP5NLniaZHKSrJujB1f0cx+CCiA2kGBfWcDhVoctlTwdfDRyhwA+WgV K4RauK24tAWXfZ/LnzI5bqGbAO2V6FYweUHmRwTBO0frAVyp9jrjV+oIPz9nBlgMYlSe+z 5Om0xBPruNRpOwQ+rMsIeOhLPndzkPaLvCbjGFlLNaRt+yGS2UASKDcmnswhxCvz/Fby7R RaBE8wvMWxhRstvm2/s/LPVRF5k+2dCNhBNOF18PZPswdjNF47ZRfNiWqLkVn41uxhryHz +9/VpIlgoEmCto1GgEmuveH8TLT8XMVak7hlejpajUkU3sYCfayUpOPBrBn+hg== Date: Thu, 7 Jul 2022 15:06:44 +0000 Message-Id: <20220707150644.2349-1-antero@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MBO-RS-ID: 6692bf84f6fdb5e8f7a X-MBO-RS-META: 61kogsarh5aqg51qfg9wi7zgs4uyz4wu X-Rspamd-Queue-Id: 4Lf0B44yr8z9sQH 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" Reply-to: Antero Mejr X-ACL-Warn: , Antero Mejr via Guix-patches From: Antero Mejr via Guix-patches via 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=1657206496; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: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=jmep6v4PGCpPVb4Gv6lVxdwlrYL9kcrWf5hBUAVTm8A=; b=aL2HsV9t4vvYzNsBJp3SgMYY9sSKjlcSTo1WMdrkVaQ4W+U+i3xakWso07YCWWR/Q7IK5U gxwbjENRxYBkzVnEyp9YlNt0syIaFKcT+cQtYbz7KnwBzs+P30l/z8lLoWuRTAydzxI8x9 5PKaFCML26fQdi1AGk1BFBIGS59FTTAAbytXascmXQDoUref4aYYjpD1M0KA2HkDUEyAQo KCut3hBtkRs0ane52fVjlQXeJ6Zdf/XhmvaaB9JjZ6xuqZreh71xLOFpmdyuaXBWDKZhV+ wVgBJDEVHOEEVXWklJHV2RJmSnJ9cZ6qW3f+WkcEoEA+9X2Ht1san+DqM7fMzw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657206496; a=rsa-sha256; cv=none; b=DgTsaqjO+uiOXBIzLGs0ewIwnlUUXFQ8p3iOchncQsvMEjTXUt8sukgFvog8HieBmVJ/gz IYivLPaMuFz7fQJKttMCjnoE6GJF5s8T2d4Of3dU0ZH7YkSTQwy9P4ZAkZC0QZTiKdaYpO G8S5peOHDTp56zaMvdpt/o74/apguXckgRXZ+miuWjTovXTW5/JsXPazLgyspojrCN6tPO qxP131Jgb1PcjlI9xNqV474WQk32+S5s3qWuC0bwhCSgYrlVF6DWsqy1tFm4hTtUOf2f65 GbrONJ60pLyRxYjmWu47LTS24acFXVvtbfxDECcY7zFI6Zj3b9RuV5w48NCqZA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mailbox.org header.s=mail20150812 header.b=fi+rypgS; dmarc=pass (policy=none) header.from=gnu.org; 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: -3.15 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mailbox.org header.s=mail20150812 header.b=fi+rypgS; dmarc=pass (policy=none) header.from=gnu.org; 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: 9A2BBC8EA X-Spam-Score: -3.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6kwHmqAHESPH * 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 © 2021 Pierre Langlois ;;; Copyright © 2021 Oleg Pykhalov ;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 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[=REGEXP] + 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,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))) ;; 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 © 2020 Simon Tournier ;;; Copyright © 2018 Steve Sprang ;;; Copyright © 2022 Josselin Poiret +;;; Copyright © 2022 Antero Mejr ;;; ;;; This file is part of GNU Guix. ;;; @@ -773,6 +774,20 @@ (define absolute (add-indirect-root store absolute)) +(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))) + rows)))) + ;;; ;;; Queries and actions. @@ -824,19 +839,8 @@ (define (diff-profiles profile numbers) #t) (('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) (('list-available regexp) -- 2.36.1