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.
master
Ludovic Courtès 2017-09-01 10:26:27 +02:00
parent fe55199542
commit 5c5ae46c00
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 7 additions and 5 deletions

View File

@ -140,17 +140,19 @@ for system '~a'")
directory)) directory))
%load-path))) %load-path)))
(define (fold-packages proc init) (define* (fold-packages proc init
"Call (PROC PACKAGE RESULT) for each available package, using INIT as #:optional
the initial value of RESULT. It is guaranteed to never traverse the (modules (all-modules (%package-module-path))))
same package twice." "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) (fold-module-public-variables (lambda (object result)
(if (and (package? object) (if (and (package? object)
(not (hidden-package? object))) (not (hidden-package? object)))
(proc object result) (proc object result)
result)) result))
init init
(all-modules (%package-module-path)))) modules))
(define find-packages-by-name (define find-packages-by-name
(let ((packages (delay (let ((packages (delay