unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: iyzsong--- via Guix-patches via <guix-patches@gnu.org>
To: 62577@debbugs.gnu.org
Cc: 宋文武 <iyzsong@member.fsf.org>
Subject: [bug#62577] [PATCH] refresh: Support select packages SUBSET by module name.
Date: Sat,  1 Apr 2023 11:59:30 +0800	[thread overview]
Message-ID: <20230401035930.3877-1-iyzsong@envs.net> (raw)

From: 宋文武 <iyzsong@member.fsf.org>

* guix/scripts/refresh.scm (%options): Support '--select module:NAME'.
(show-help): Adjust accordingly.
(options->update-specs): Honor the module passed by '--select'.
---
 guix/scripts/refresh.scm | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index bc6c24967a..d6ac574b1f 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -32,6 +32,7 @@ (define-module (guix scripts refresh)
   #:use-module ((guix scripts build) #:select (%standard-build-options))
   #:use-module (guix store)
   #:use-module (guix utils)
+  #:use-module (guix discovery)
   #:use-module (guix packages)
   #:use-module (guix profiles)
   #:use-module (guix upstream)
@@ -71,8 +72,15 @@ (define %options
                     ((or "core" "non-core")
                      (alist-cons 'select (string->symbol arg)
                                  result))
+                    ((? (cut string-prefix? "module:" <>))
+                     (alist-cons 'select
+                                 (cons 'module
+                                       (string->symbol
+                                        (string-drop
+                                         arg (string-length "module:"))))
+                                 result))
                     (x
-                     (leave (G_ "~a: invalid selection; expected `core' or `non-core'~%")
+                     (leave (G_ "~a: invalid selection; expected `core', `non-core' or `module:NAME'~%")
                             arg)))))
         (option '(#\t "type") #t #f
                 (lambda (opt name arg result)
@@ -141,8 +149,8 @@ (define (show-help)
   (display (G_ "
   -u, --update           update source files in place"))
   (display (G_ "
-  -s, --select=SUBSET    select all the packages in SUBSET, one of
-                         `core' or `non-core'"))
+  -s, --select=SUBSET    select all the packages in SUBSET, one of `core`,
+                         `non-core' or `module:NAME' (eg: module:guile)"))
   (display (G_ "
   -m, --manifest=FILE    select all the packages from the manifest in FILE"))
   (display (G_ "
@@ -257,13 +265,20 @@ (define update-specs
        (let ((select? (match (assoc-ref opts 'select)
                         ('core core-package?)
                         ('non-core (negate core-package?))
-                        (_ (const #t)))))
+                        (_ (const #t))))
+             (modules (match (assoc-ref opts 'select)
+                         (('module . mod)
+                          (list (resolve-interface `(gnu packages ,mod))))
+                         (_ (all-modules (%package-module-path)
+                                         #:warn
+                                         warn-about-load-error)))))
          (map update-spec
               (fold-packages (lambda (package result)
                                (if (select? package)
                                    (keep-newest package result)
                                    result))
-                             '()))))
+                             '()
+                             modules))))
       (some                                       ;user-specified packages
        some)))
 

base-commit: 1c6238794b0058003fa6c827ca0d039764ebe699
-- 
2.39.2





             reply	other threads:[~2023-04-01  4:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01  3:59 iyzsong--- via Guix-patches via [this message]
2023-04-08 21:27 ` [bug#62577] [PATCH] refresh: Support select packages SUBSET by module name Ludovic Courtès
2023-04-09  4:46   ` 宋文武 via Guix-patches via
2023-04-09  4:43 ` [bug#62577] [PATCH v2] " iyzsong--- via Guix-patches via
2023-04-20 10:18   ` Ludovic Courtès
2023-04-23  7:36     ` bug#62577: [PATCH] " 宋文武 via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230401035930.3877-1-iyzsong@envs.net \
    --to=guix-patches@gnu.org \
    --cc=62577@debbugs.gnu.org \
    --cc=iyzsong@envs.net \
    --cc=iyzsong@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).