aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-09-01 10:26:27 +0200
committerLudovic Courtès <ludo@gnu.org>2017-09-01 10:29:39 +0200
commit5c5ae46c00fd553c6fd23aeba1961e201f6555c7 (patch)
tree0038399c8d264e2e629afa8e8afe669da2ac3207
parentfe55199542590d16aa6ca6a8bfa0fda27903db5c (diff)
downloadguix-5c5ae46c00fd553c6fd23aeba1961e201f6555c7.tar.gz
guix-5c5ae46c00fd553c6fd23aeba1961e201f6555c7.zip
packages: 'fold-packages' takes an optional 'modules' parameter.
Suggested by Christopher Baines <mail@cbaines.net>. * gnu/packages.scm (fold-packages): Add optional 'modules' parameter and honor it.
-rw-r--r--gnu/packages.scm12
1 files changed, 7 insertions, 5 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 5629061788..b4ac6661ca 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -140,17 +140,19 @@ for system '~a'")
directory))
%load-path)))
-(define (fold-packages proc init)
- "Call (PROC PACKAGE RESULT) for each available package, using INIT as
-the initial value of RESULT. It is guaranteed to never traverse the
-same package twice."
+(define* (fold-packages proc init
+ #:optional
+ (modules (all-modules (%package-module-path))))
+ "Call (PROC PACKAGE RESULT) for each available package defined in one of
+MODULES, using INIT as the initial value of RESULT. It is guaranteed to never
+traverse the same package twice."
(fold-module-public-variables (lambda (object result)
(if (and (package? object)
(not (hidden-package? object)))
(proc object result)
result))
init
- (all-modules (%package-module-path))))
+ modules))
(define find-packages-by-name
(let ((packages (delay