guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/05: packages: 'fold-packages' takes an optional 'modules' parameter.


From: Ludovic Courtès
Subject: 02/05: packages: 'fold-packages' takes an optional 'modules' parameter.
Date: Fri, 1 Sep 2017 04:40:20 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 5c5ae46c00fd553c6fd23aeba1961e201f6555c7
Author: Ludovic Courtès <address@hidden>
Date:   Fri Sep 1 10:26:27 2017 +0200

    packages: 'fold-packages' takes an optional 'modules' parameter.
    
    Suggested by Christopher Baines <address@hidden>.
    
    * gnu/packages.scm (fold-packages): Add optional 'modules' parameter and
    honor it.
---
 gnu/packages.scm | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/gnu/packages.scm b/gnu/packages.scm
index 5629061..b4ac666 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]