* [PATCH] gnu: u-boot: Use scandir.
@ 2017-01-25 23:38 Danny Milosavljevic
2017-01-27 23:42 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Danny Milosavljevic @ 2017-01-25 23:38 UTC (permalink / raw)
To: guix-devel
* gnu/packages/u-boot.scm (make-u-boot-package): Modify.
---
gnu/packages/u-boot.scm | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/gnu/packages/u-boot.scm b/gnu/packages/u-boot.scm
index cdd52d874..6173e619a 100644
--- a/gnu/packages/u-boot.scm
+++ b/gnu/packages/u-boot.scm
@@ -99,19 +99,19 @@ also initializes the boards (RAM etc).")
(modify-phases %standard-phases
(replace 'configure
(lambda* (#:key outputs make-flags #:allow-other-keys)
+ (use-modules ((ice-9 ftw)))
(let ((config-name (string-append ,board "_defconfig")))
(if (file-exists? (string-append "configs/" config-name))
(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))
- (when (string-suffix? "_defconfig" file-name)
- (format #t "- ~A\n"
- (string-drop-right file-name suffix-length))))
- (closedir dir))
+ (let ((suffix-length (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))))))
#f)))))
(replace 'install
(lambda* (#:key outputs make-flags #:allow-other-keys)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gnu: u-boot: Use scandir.
2017-01-25 23:38 [PATCH] gnu: u-boot: Use scandir Danny Milosavljevic
@ 2017-01-27 23:42 ` Ludovic Courtès
2017-02-01 15:16 ` [PATCH v2] " Danny Milosavljevic
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2017-01-27 23:42 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
Hi Danny,
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> * gnu/packages/u-boot.scm (make-u-boot-package): Modify.
> (replace 'configure
> (lambda* (#:key outputs make-flags #:allow-other-keys)
> + (use-modules ((ice-9 ftw)))
> (let ((config-name (string-append ,board "_defconfig")))
> (if (file-exists? (string-append "configs/" config-name))
> (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))
> - (when (string-suffix? "_defconfig" file-name)
> - (format #t "- ~A\n"
> - (string-drop-right file-name suffix-length))))
> - (closedir dir))
> + (let ((suffix-length (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))))))
Using ‘scandir’ is a good idea.
Minor point: please write
(arguments
'(#:modules ((ice-9 ftw) …)
…))
instead of the inner ‘use-modules’ form (which is not guaranteed to work
with future Guile versions.)
Also the second argument to ‘scandir’ should be aligned with the first.
:-)
OK with these changes, thank you!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] gnu: u-boot: Use scandir.
2017-01-27 23:42 ` Ludovic Courtès
@ 2017-02-01 15:16 ` Danny Milosavljevic
2017-02-01 22:28 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Danny Milosavljevic @ 2017-02-01 15:16 UTC (permalink / raw)
To: guix-devel
* gnu/packages/u-boot.scm (make-u-boot-package): Modify.
---
gnu/packages/u-boot.scm | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/gnu/packages/u-boot.scm b/gnu/packages/u-boot.scm
index 3468fe5a7..e60e61db2 100644
--- a/gnu/packages/u-boot.scm
+++ b/gnu/packages/u-boot.scm
@@ -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,13 @@ 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))
- (when (string-suffix? "_defconfig" file-name)
- (format #t "- ~A\n"
- (string-drop-right file-name suffix-length))))
- (closedir dir))
+ (let ((suffix-length (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))))))
#f)))))
(replace 'install
(lambda* (#:key outputs make-flags #:allow-other-keys)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] gnu: u-boot: Use scandir.
2017-02-01 15:16 ` [PATCH v2] " Danny Milosavljevic
@ 2017-02-01 22:28 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2017-02-01 22:28 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> * gnu/packages/u-boot.scm (make-u-boot-package): Modify.
[...]
> + (scandir "configs"
> + (lambda (file-name)
> + (when (string-suffix? "_defconfig" file-name)
> + (format #t "- ~A\n"
> + (string-drop-right file-name
> + suffix-length))))))
There’s still the alignment issue but indent-code.el should be able to
fix it for you.
Otherwise LGTM, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-02-01 22:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-25 23:38 [PATCH] gnu: u-boot: Use scandir Danny Milosavljevic
2017-01-27 23:42 ` Ludovic Courtès
2017-02-01 15:16 ` [PATCH v2] " Danny Milosavljevic
2017-02-01 22:28 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).