guix_mirror_bot pushed a commit to branch misc-world-rebuild
in repository guix.

commit b06a2c4952bf1723b827413275370a1656d15dfe
Author: Brice Waegeneire <[email protected]>
AuthorDate: Mon Jun 23 21:36:30 2025 +0200

    build: utils: Add #:enter? parameter to 'find-files'.
    
    * guix/utils.scm (find-files): Add #:enter? parameter.
    
    Change-Id: I610284f7860318e4613ddf77285cc0f9b9a3f439
    Reviewed-by: Hilton Chain <[email protected]>
    Reviewed-by: Florian Pelz <[email protected]>
    Signed-off-by: Nguyễn Gia Phong <[email protected]>
---
 guix/build/utils.scm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 7003d8262f..19203dc36a 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2021, 2022 Maxime Devos <[email protected]>
 ;;; Copyright © 2021 Brendan Tildesley <[email protected]>
 ;;; Copyright © 2023 Carlo Zancanaro <[email protected]>
+;;; Copyright © 2025 Brice Waegeneire <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -534,19 +535,21 @@ name matches REGEXP."
 (define* (find-files dir #:optional (pred (const #t))
                      #:key (stat lstat)
                      directories?
-                     fail-on-error?)
+                     fail-on-error?
+                     (enter? (const #t)))
   "Return the lexicographically sorted list of files under DIR for which PRED
 returns true.  PRED is passed two arguments: the absolute file name, and its
 stat buffer; the default predicate always returns true.  PRED can also be a
 regular expression, in which case it is equivalent to (file-name-predicate
 PRED).  STAT is used to obtain file information; using 'lstat' means that
-symlinks are not followed.  If DIRECTORIES? is true, then directories will
-also be included.  If FAIL-ON-ERROR? is true, raise an exception upon error."
+symlinks are not followed.  If DIRECTORIES? is true, then directories will also
+be included.  If FAIL-ON-ERROR? is true, raise an exception upon error.  Enter
+sub-directories only when (ENTER? path stat result) returns true."
   (let ((pred (if (procedure? pred)
                   pred
                   (file-name-predicate pred))))
     ;; Sort the result to get deterministic results.
-    (sort (file-system-fold (const #t)
+    (sort (file-system-fold enter?
                             (lambda (file stat result) ; leaf
                               (if (pred file stat)
                                   (cons file result)

Reply via email to