summaryrefslogtreecommitdiff
path: root/guix/build/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-09-15 23:20:16 +0200
committerLudovic Courtès <ludo@gnu.org>2013-09-15 23:21:30 +0200
commit66018f1c338375796a8a2d5130bae5cdb9a48b5f (patch)
treedcc11051aefcc31be1ed0152d959ccdc7b0131ce /guix/build/utils.scm
parent8ce3104e0e290b603599ec2e1b86bb82497c2665 (diff)
utils: 'find-files' returns a sorted list.
* guix/build/utils.scm (find-files): Sort the result lexicographically. * guix/scripts/pull.scm (unpack): Don't sort the result of 'find-files'.
Diffstat (limited to 'guix/build/utils.scm')
-rw-r--r--guix/build/utils.scm39
1 files changed, 21 insertions, 18 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 06e88b1ff8..8cc9c1ee1f 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -185,29 +185,32 @@ but ignore errors."
lstat))
(define (find-files dir regexp)
- "Return the list of files under DIR whose basename matches REGEXP."
+ "Return the lexicographically sorted list of files under DIR whose basename
+matches REGEXP."
(define file-rx
(if (regexp? regexp)
regexp
(make-regexp regexp)))
- (file-system-fold (const #t)
- (lambda (file stat result) ; leaf
- (if (regexp-exec file-rx (basename file))
- (cons file result)
- result))
- (lambda (dir stat result) ; down
- result)
- (lambda (dir stat result) ; up
- result)
- (lambda (file stat result) ; skip
- result)
- (lambda (file stat errno result)
- (format (current-error-port) "find-files: ~a: ~a~%"
- file (strerror errno))
- #f)
- '()
- dir))
+ ;; Sort the result to get deterministic results.
+ (sort (file-system-fold (const #t)
+ (lambda (file stat result) ; leaf
+ (if (regexp-exec file-rx (basename file))
+ (cons file result)
+ result))
+ (lambda (dir stat result) ; down
+ result)
+ (lambda (dir stat result) ; up
+ result)
+ (lambda (file stat result) ; skip
+ result)
+ (lambda (file stat errno result)
+ (format (current-error-port) "find-files: ~a: ~a~%"
+ file (strerror errno))
+ #f)
+ '()
+ dir)
+ string<?))
;;;