unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#47163] [PATCH] refresh: Add '--installed' option.
@ 2021-03-15 15:45 Xinglu Chen
  2021-03-15 20:38 ` Ludovic Courtès
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Xinglu Chen @ 2021-03-15 15:45 UTC (permalink / raw)
  To: 47163

This lets the user to only check for updates for packages installed in the
current profile.

If the user is using the imperative way to install packages, or uses
multiple manifests, this is a quick way to check for updates for the
installed packages.

* guix/scripts/refresh.scm (%options): Add '--installed' option.
* guix.texi (Invoking guix refresh): Document it.
---
 doc/guix.texi            |  5 +++++
 guix/scripts/refresh.scm | 14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 3e7ffc81bc..c778a877d8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -11657,6 +11657,11 @@
 Select all the packages from the manifest in @var{file}.  This is useful to
 check if any packages of the user manifest can be updated.
 
+@item --installed
+@itemx -i
+Select all the packages installed in the current profile.  This is
+useful to check if any of the packages the user is using can be updated.
+
 @item --type=@var{updater}
 @itemx -t @var{updater}
 Select only packages handled by @var{updater} (may be a comma-separated
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index fb6c52a567..c1c672dc0b 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -86,6 +86,9 @@
         (option '(#\m "manifest") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'manifest arg result)))
+        (option '(#\i "installed") #f #f
+                (lambda (opt name arg result)
+                  (alist-cons 'installed #t result)))
         (option '(#\e "expression") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'expression arg result)))
@@ -156,6 +159,9 @@ specified with `--select'.\n"))
   (display (G_ "
   -m, --manifest=FILE    select all the packages from the manifest in FILE"))
   (display (G_ "
+  -i  --installed        select all the packages installed in the current
+                         profile"))
+  (display (G_ "
   -t, --type=UPDATER,... restrict to updates from the specified updaters
                          (e.g., 'gnu')"))
   (display (G_ "
@@ -253,7 +259,13 @@ update would trigger a complete rebuild."
 
   (define packages
     (match (assoc-ref opts 'manifest)
-      (#f args-packages)
+      (#f (if (assoc-ref opts 'installed)
+              ;; All packages installed in current profile
+              (manifest->packages
+               (match (manifest->code (profile-manifest %current-profile))
+                 (('begin expr) (eval expr
+                                      (make-user-module '((gnu packages)))))))
+              args-packages))
       ((? string? file) (packages-from-manifest file))))
 
   (if (assoc-ref opts 'recursive?)

base-commit: 266d55dc3080475544bf45e72359c9b9bbcecd53
-- 
2.30.2






^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-03-26 17:20 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 15:45 [bug#47163] [PATCH] refresh: Add '--installed' option Xinglu Chen
2021-03-15 20:38 ` Ludovic Courtès
2021-03-15 21:14   ` Xinglu Chen
2021-03-16  9:08     ` Ludovic Courtès
2021-03-16  9:16       ` Léo Le Bouter via Guix-patches via
2021-03-16 12:58         ` zimoun
2021-03-16 13:10           ` Léo Le Bouter via Guix-patches via
2021-03-16 16:05       ` Xinglu Chen
2021-03-16 16:44       ` [bug#47163] Using package transformations declaratively (was: [bug#47163] [PATCH] refresh: Add '--installed' option.) Xinglu Chen
     [not found]         ` <CAJ3okZ1OWCT07n17Wo0c_Par3gO1mEE6_Y_Zy=eFnTJZ5Ec2sw@mail.gmail.com>
2021-03-16 18:35           ` Xinglu Chen
2021-03-16 16:19 ` [bug#47163] [PATCH] doc: Add snippet for running 'guix refresh' on installed packages Xinglu Chen
2021-03-16 18:06   ` Ludovic Courtès
2021-03-16 18:34     ` Xinglu Chen
2021-03-18  9:31       ` Ludovic Courtès
2021-03-17 12:23   ` [bug#47213] [PATCH v2] doc: Add snippet for running 'guix refresh' on installed Xinglu Chen
2021-03-25 16:15     ` Xinglu Chen
2021-03-25 23:21     ` bug#47213: " Ludovic Courtès
2021-03-26 17:18 ` bug#47163: [PATCH] refresh: Add '--installed' option Xinglu Chen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).