aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-12-21 12:28:10 +0100
committerLudovic Courtès <ludo@gnu.org>2014-12-21 12:29:14 +0100
commitd95523fb8b437565226a1dc445bd883b434ca612 (patch)
tree0dd164ed092cf5fadf32402ec1d80181e6466c7e /gnu/packages.scm
parentce44657aab50dd4ab9bdb7570729fc99ee33275a (diff)
downloadpatches-d95523fb8b437565226a1dc445bd883b434ca612.tar
patches-d95523fb8b437565226a1dc445bd883b434ca612.tar.gz
packages: Sort Scheme file lists used by 'fold-packages'.
* gnu/packages.scm (scheme-files): Call 'sort' on result.
Diffstat (limited to 'gnu/packages.scm')
-rw-r--r--gnu/packages.scm41
1 files changed, 23 insertions, 18 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm
index c9efd0d691..6109d1f896 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -105,24 +105,29 @@
(append environment `((,%distro-root-directory . "gnu/packages"))))))
(define* (scheme-files directory)
- "Return the list of Scheme files found under DIRECTORY."
- (file-system-fold (const #t) ; enter?
- (lambda (path stat result) ; leaf
- (if (string-suffix? ".scm" path)
- (cons path result)
- result))
- (lambda (path stat result) ; down
- result)
- (lambda (path stat result) ; up
- result)
- (const #f) ; skip
- (lambda (path stat errno result)
- (warning (_ "cannot access `~a': ~a~%")
- path (strerror errno))
- result)
- '()
- directory
- stat))
+ "Return the list of Scheme files found under DIRECTORY, recursively. The
+returned list is sorted in alphabetical order."
+
+ ;; Sort entries so that 'fold-packages' works in a deterministic fashion
+ ;; regardless of details of the underlying file system.
+ (sort (file-system-fold (const #t) ; enter?
+ (lambda (path stat result) ; leaf
+ (if (string-suffix? ".scm" path)
+ (cons path result)
+ result))
+ (lambda (path stat result) ; down
+ result)
+ (lambda (path stat result) ; up
+ result)
+ (const #f) ; skip
+ (lambda (path stat errno result)
+ (warning (_ "cannot access `~a': ~a~%")
+ path (strerror errno))
+ result)
+ '()
+ directory
+ stat)
+ string<?))
(define file-name->module-name
(let ((not-slash (char-set-complement (char-set #\/))))