guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu: u-boot: Use scandir.


From: Ludovic Courtès
Subject: Re: [PATCH] gnu: u-boot: Use scandir.
Date: Sat, 28 Jan 2017 00:42:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hi Danny,

Danny Milosavljevic <address@hidden> 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’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]