From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uNGQIT7gxWIRrQAAbAwnHQ (envelope-from ) for ; Wed, 06 Jul 2022 21:19:26 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id UIR9IT7gxWKfyQAAauVa8A (envelope-from ) for ; Wed, 06 Jul 2022 21:19:26 +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 3BB3C3B504 for ; Wed, 6 Jul 2022 21:19:24 +0200 (CEST) Received: from localhost ([::1]:55890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9AYV-0002ZS-8l for larch@yhetil.org; Wed, 06 Jul 2022 15:19:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9AUJ-0000Dy-Qr for guix-patches@gnu.org; Wed, 06 Jul 2022 15:15:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33073) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9AUI-0002GM-CA for guix-patches@gnu.org; Wed, 06 Jul 2022 15:15:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o9AUI-0001if-2O for guix-patches@gnu.org; Wed, 06 Jul 2022 15:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56428] [PATCH] home: Add -I, --list-installed option. Resent-From: Antero Mejr Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Jul 2022 19:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56428 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56428@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16571348416502 (code B ref -1); Wed, 06 Jul 2022 19:15:01 +0000 Received: (at submit) by debbugs.gnu.org; 6 Jul 2022 19:14:01 +0000 Received: from localhost ([127.0.0.1]:55202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o9ATF-0001gW-0Z for submit@debbugs.gnu.org; Wed, 06 Jul 2022 15:14:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:49144) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o9ATC-0001gO-7z for submit@debbugs.gnu.org; Wed, 06 Jul 2022 15:13:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9ATB-0007kj-Be for guix-patches@gnu.org; Wed, 06 Jul 2022 15:13:53 -0400 Received: from mout-p-102.mailbox.org ([2001:67c:2050:0:465::102]:44864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1o9AT7-00007Y-MC for guix-patches@gnu.org; Wed, 06 Jul 2022 15:13:53 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (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-102.mailbox.org (Postfix) with ESMTPS id 4LdTjG5nqMz9sQD for ; Wed, 6 Jul 2022 21:13:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1657134818; 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=gQ0kUq1xRu0HEkTmEvE+5Xs0oCdzDovfDNP0gwRaT9Q=; b=DIh8qhHPje9p0+bSXPT0uYQAN2cy8Tgc8ksLDaLESc2Qb9abISbmI1kom+eAygP+K6Sq8Q yM2/gvRp0Oak+PsZpubGxqNQ7+MzV6X0hYdqN+mayCiBLDjX+VSVE/5IAO+7ZCWduosBMr OxBp4oNJuOvHQHKyS4qFMTrxW6OVTHftxOsNW9mwCWkj9APuK2eKQDAd14yche7qAPkNxu frNQgW2I1/m1t3qzddicxm3sPkjREhga1qOAb7Zvy4VGEzsmKd/ae4sMxhaHarwCwwY/Ye J6FwOMJswLc3/YhuwMSym+W2pX230j1qJII9WX6d6Gl5yynYHjFUYss7adVxjw== Date: Wed, 6 Jul 2022 19:13:11 +0000 Message-Id: <20220706191311.14662-1-antero@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MBO-RS-ID: d6b8cddc3b3e81a9d59 X-MBO-RS-META: 5nyr9hggws9c7n18u65qecgrq99imktc X-Rspamd-Queue-Id: 4LdTjG5nqMz9sQD Received-SPF: pass client-ip=2001:67c:2050:0:465::102; envelope-from=antero@mailbox.org; helo=mout-p-102.mailbox.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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=1657135166; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=gQ0kUq1xRu0HEkTmEvE+5Xs0oCdzDovfDNP0gwRaT9Q=; b=R/6KqQUVRI6xLNrcOANBBIksdEjWPRau0e5LyeAVFwqciW7jR83rnPWoJVAauc0WrT6Mva h5Te6PY0dSfYJZ98Aq7IRMCzbg7D/RMTt5Phg58mdFFMwe5h1forCNKigiikjvn+M6WC7q rByFp4LxnoF2OEYEMg1+PfGZ6ylRhCe3OWdmVXSZ7Qkuek0nhmkyA5T1PKrkmS9xfIULEU TXph+xXZa7tPITf/H/5UoLebDc0UQylcAXojehHfy8KTFFG4OO1wQi6MKgkNh9t/8zCkNA oarEG3k4HErdba61FOrEEQNZF9zWYHKx/ukEGc3YSY7GugOI/sagr2y9Pxiziw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657135166; a=rsa-sha256; cv=none; b=drtba+ibcaGpqhyxeQ4+v9Emb3LEc+Y7dgvtzO2cAkP21uN3fTKsEYWuNNW30uhx/cDR9r hOxiYWLZfz9wxpoOaU31aSdFAgbVREiC9tjUCBNw1FXn44cgJ1xbDJkWwcZiJ3xMH7PLi9 gu8u95SHJKgrxbr5OErANPXJeJk8KX4ArXrc0DW3Gj7x5yqq+SEj0h9NhXZ84oO6nS0SGB u08YeRfExFfuc2xwVvc2L41lPjGY8g3dr6zaBfjr0mvB58VAiwOg2Fzj91fbaTnw3Qxd2+ W8unE/UCILZ26yaEEiT5hPUUlUK10Q8ymdV2+JZVBgrp3royWql0gsilNG7ekA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mailbox.org header.s=mail20150812 header.b=DIh8qhHP; 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.75 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mailbox.org header.s=mail20150812 header.b=DIh8qhHP; 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: 3BB3C3B504 X-Spam-Score: -3.75 X-Migadu-Scanner: scn1.migadu.com X-TUID: a7WwNLZZU36A * 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 © 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,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 "/profile"))))) + (exit 0))) ;; 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 © 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,21 @@ (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))) + ;; Show most recently installed packages last. + (reverse rows))))) + ;;; ;;; Queries and actions. @@ -824,19 +840,7 @@ (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))))) + (pretty-print-table (list-installed regexp profiles)) #t) (('list-available regexp) -- 2.36.1