GNU bug report logs - #28281
[PATCH] gnu: Add os-prober.

Previous Next

Package: guix-patches;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Tue, 29 Aug 2017 19:08:02 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 28281 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 28281 <at> debbugs.gnu.org
Subject: Re: [bug#28281] [PATCH] gnu: Add os-prober.
Date: Thu, 31 Aug 2017 15:25:48 +0200
Hi!

Arun Isaac <arunisaac <at> systemreboot.net> skribis:

> * gnu/packages/bootloaders.scm (os-prober): New variable.

[...]

> +         (replace 'install
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out"))
> +                    (bin (string-append out "/bin"))
> +                    (lib (string-append out "/lib"))
> +                    (share (string-append out "/share")))
> +               (for-each (cut install-file <> bin)
> +                         (list "linux-boot-prober" "os-prober"))
> +               (install-file "newns" (string-append lib "/os-prober"))
> +               (install-file "common.sh" (string-append share "/os-prober"))
> +               (install-file "os-probes/mounted/powerpc/20macosx"
> +                             (string-append lib "/os-probes/mounted"))
> +               (for-each
> +                (lambda (directory)
> +                  (ftw directory
> +                       (lambda (file stat flag)
> +                         (when (eq? flag 'regular)
> +                           (and-let* ((result (or (string-match "/common/" file)
> +                                                  (string-match "/x86/" file))))
> +                             (install-file
> +                              file (dirname
> +                                    (string-append
> +                                     lib "/" (substring file 0 (match:start result 0))
> +                                     (substring file (1- (match:end result 0))))))))
> +                         #t)))

For clarity, what about (1) using ‘find-files’ instead of ‘ftw’, and (2)
separating code that builds the list of files from code that calls
‘install-file’?

So something like:

  (define (candidate-files directory)
    (find-files directory
                (lambda (file stat)
                  (and (eq? (stat:kind stat) 'regular)
                       …))))

  (for-each (lambda (file)
              (install-file file …))
            (append-map candidate-files
                        (list "os-probes" "linux-boot-probes")))

WDYT?

Ludo’.




This bug report was last modified 7 years and 253 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.