GNU bug report logs - #56428
[PATCH] home: Add -I, --list-installed option.

Previous Next

Package: guix-patches;

Reported by: Antero Mejr <antero <at> mailbox.org>

Date: Wed, 6 Jul 2022 19:15:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Antero Mejr <antero <at> mailbox.org>
Subject: bug#56428: closed (Re: bug#56428: [PATCH] home: Add -I,
 --list-installed option.)
Date: Mon, 18 Jul 2022 13:22:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#56428: [PATCH] home: Add -I, --list-installed option.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 56428 <at> debbugs.gnu.org.

-- 
56428: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56428
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Antero Mejr <antero <at> mailbox.org>
Cc: 56428-done <at> debbugs.gnu.org, andrew <at> trop.in
Subject: Re: bug#56428: [PATCH] home: Add -I, --list-installed option.
Date: Mon, 18 Jul 2022 15:21:03 +0200
Hi,

Antero Mejr <antero <at> mailbox.org> skribis:

> * guix/scripts/package.scm (list-installed): New procedure.
> * guix/scripts/home.scm: Use it.
> * guix/scripts/utils.scm (pretty-print-table): New argument "left-pad".
> * doc/guix.texi (Invoking Guix Home): Add information and example for
> --list-installed flag.

I tweaked the wording in the manual, added a docstring to
‘list-installed’ (info "(guix) Formatting Code"), adjusted that of
‘pretty-print-table’, tweaked the commit log to list all the changes,
and committed.

Thanks!

Ludo’.

[Message part 3 (message/rfc822, inline)]
From: Antero Mejr <antero <at> mailbox.org>
To: guix-patches <at> gnu.org
Subject: [PATCH] home: Add -I, --list-installed option.
Date: Wed,  6 Jul 2022 19:13:11 +0000
* 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 <pierre.langlois <at> gmx.com>
 ;;; Copyright © 2021 Oleg Pykhalov <go.wigust <at> gmail.com>
 ;;; Copyright © 2022 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2022 Antero Mejr <antero <at> mailbox.org>
 ;;;
 ;;; 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 <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2018 Steve Sprang <scs <at> stevesprang.com>
 ;;; Copyright © 2022 Josselin Poiret <dev <at> jpoiret.xyz>
+;;; Copyright © 2022 Antero Mejr <antero <at> mailbox.org>
 ;;;
 ;;; 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
+                    (($ <manifest-entry> 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
-                         (($ <manifest-entry> 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




This bug report was last modified 2 years and 285 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.