summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorAndreas Enge <andreas@enge.fr>2023-04-23 22:21:00 +0200
committerAndreas Enge <andreas@enge.fr>2023-04-23 22:21:00 +0200
commitd7ec2805fbb7fe39e2c66588baef0454aeb42548 (patch)
tree132e79661fd9b3c1dbe146537b00bd1412cb55cb /guix/scripts
parent480a125bde4c1a568c2b1254136a00bc20a0e399 (diff)
parent74e96c4cb171b17949f638d8b452d047a8f2dc6f (diff)
Merge remote-tracking branch 'origin/master' into core-updates
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/refresh.scm36
1 files changed, 31 insertions, 5 deletions
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index bc6c24967a..47c4d55ec4 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -32,6 +32,7 @@
#: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)
@@ -44,6 +45,7 @@
#:use-module ((gnu packages commencement) #:select (%final-inputs))
#:use-module (ice-9 match)
#:use-module (ice-9 format)
+ #:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-26)
@@ -71,8 +73,23 @@
((or "core" "non-core")
(alist-cons 'select (string->symbol arg)
result))
+ ((? (cut string-prefix? "module:" <>))
+ (let ((mod (cond
+ ;; Shorthand name: "module:guile".
+ ((string-match "module:([^\( ]+)$" arg) =>
+ (lambda (m)
+ `(gnu packages ,(string->symbol
+ (match:substring m 1)))))
+ ;; Full name : "module:(gnu packages guile)".
+ ((string-match "module:\\(([^)]+)\\)$" arg) =>
+ (lambda (m)
+ (map string->symbol
+ (string-split
+ (match:substring m 1) #\space))))
+ (else (leave (G_ "invalid module: ~a~%") arg)))))
+ (alist-cons 'select (cons 'module mod) 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 +158,10 @@ specified with `--select'.\n"))
(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)
+ the module can also be fully specified as
+ 'module:(gnu packages guile)'"))
(display (G_ "
-m, --manifest=FILE select all the packages from the manifest in FILE"))
(display (G_ "
@@ -257,13 +276,20 @@ update would trigger a complete rebuild."
(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 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)))