mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
packages: Sort Scheme file lists used by 'fold-packages'.
* gnu/packages.scm (scheme-files): Call 'sort' on result.
This commit is contained in:
parent
ce44657aab
commit
d95523fb8b
1 changed files with 23 additions and 18 deletions
|
@ -105,24 +105,29 @@ (define %package-module-path
|
|||
(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 #\/))))
|
||||
|
|
Loading…
Reference in a new issue