summaryrefslogtreecommitdiff
path: root/guix/scripts/refresh.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2017-05-04 09:14:02 +0200
committerMathieu Othacehe <m.othacehe@gmail.com>2017-06-04 09:07:43 +0200
commit1335ac31415d6a043b1637faf5d8105febbefbf5 (patch)
tree74b7493f015642b9059854d21f9b13165a3517e2 /guix/scripts/refresh.scm
parentd5cb2ac7f96c7f4caa16334f098221c18115f2eb (diff)
scripts: refresh: Add -m manifest option.
* guix/scripts/refresh.scm (%options): Add -m option, (show-help): document it, (packages-from-manifest): new procedure, (guix-refresh): use packages from manifest if specified, otherwise keep the previous behaviour. * doc/guix.texi (Invoking guix refresh): document new option.
Diffstat (limited to 'guix/scripts/refresh.scm')
-rw-r--r--guix/scripts/refresh.scm34
1 files changed, 31 insertions, 3 deletions
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index f85d6e5101..dd93e7d3e7 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,6 +28,7 @@
#:use-module (guix store)
#:use-module (guix utils)
#:use-module (guix packages)
+ #:use-module (guix profiles)
#:use-module (guix upstream)
#:use-module (guix discovery)
#:use-module (guix graph)
@@ -79,6 +81,9 @@
(option '(#\L "list-updaters") #f #f
(lambda args
(list-updaters-and-exit)))
+ (option '(#\m "manifest") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'manifest arg result)))
(option '(#\e "expression") #t #f
(lambda (opt name arg result)
(alist-cons 'expression arg result)))
@@ -125,6 +130,8 @@ specified with `--select'.\n"))
-s, --select=SUBSET select all the packages in SUBSET, one of
`core' or `non-core'"))
(display (G_ "
+ -m, --manifest=FILE select all the packages from the manifest in FILE"))
+ (display (G_ "
-t, --type=UPDATER,... restrict to updates from the specified updaters
(e.g., 'gnu')"))
(display (G_ "
@@ -308,6 +315,24 @@ dependent packages are rebuilt: ~{~a~^ ~}~%"
;;;
+;;; Manifest.
+;;;
+
+(define (manifest->packages manifest)
+ "Return the list of packages in MANIFEST."
+ (filter-map (lambda (entry)
+ (let ((item (manifest-entry-item entry)))
+ (if (package? item) item #f)))
+ (manifest-entries manifest)))
+
+(define (packages-from-manifest manifest)
+ "Return the list of packages in loaded MANIFEST."
+ (let* ((user-module (make-user-module '((guix profiles) (gnu))))
+ (manifest (load* manifest user-module)))
+ (manifest->packages manifest)))
+
+
+;;;
;;; Entry point.
;;;
@@ -378,8 +403,7 @@ update would trigger a complete rebuild."
;; the command line.
(warn? (or (assoc-ref opts 'argument)
(assoc-ref opts 'expression)))
-
- (packages
+ (args-packages
(match (filter-map (match-lambda
(('argument . spec)
;; Take either the specified version or the
@@ -400,7 +424,11 @@ update would trigger a complete rebuild."
result))
'())))
(some ; user-specified packages
- some))))
+ some)))
+ (packages
+ (match (assoc-ref opts 'manifest)
+ (#f args-packages)
+ ((? string? file) (packages-from-manifest file)))))
(with-error-handling
(with-store store
(run-with-store store