gnu: u-boot: Use scandir.

* gnu/packages/u-boot.scm (make-u-boot-package): Modify.
This commit is contained in:
Danny Milosavljevic 2017-02-01 16:16:52 +01:00
parent 2d92eca154
commit 40c4e3bbda
No known key found for this signature in database
GPG Key ID: E71A35542C30BAA5
1 changed files with 10 additions and 9 deletions

View File

@ -93,7 +93,8 @@ also initializes the boards (RAM etc).")
("cross-binutils" ,(cross-binutils triplet))
,@(package-native-inputs u-boot)))
(arguments
`(#:test-target "test"
`(#:modules ((ice-9 ftw) (guix build utils) (guix build gnu-build-system))
#:test-target "test"
#:make-flags
(list "HOSTCC=gcc" (string-append "CROSS_COMPILE=" ,triplet "-"))
#:phases
@ -105,14 +106,14 @@ also initializes the boards (RAM etc).")
(zero? (apply system* "make" `(,@make-flags ,config-name)))
(begin
(display "Invalid board name. Valid board names are:")
(let ((dir (opendir "configs"))
(suffix-length (string-length "_defconfig")))
(do ((file-name (readdir dir) (readdir dir)))
((eof-object? file-name))
(let ((suffix-len (string-length "_defconfig")))
(scandir "configs"
(lambda (file-name)
(when (string-suffix? "_defconfig" file-name)
(format #t "- ~A\n"
(string-drop-right file-name suffix-length))))
(closedir dir))
(format #t
"- ~A\n"
(string-drop-right file-name
suffix-len))))))
#f)))))
(replace 'install
(lambda* (#:key outputs make-flags #:allow-other-keys)