From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqjVC-0001QK-1G for guix-patches@gnu.org; Sat, 09 Sep 2017 13:25:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqjV8-0000lK-Tl for guix-patches@gnu.org; Sat, 09 Sep 2017 13:25:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:49080) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dqjV8-0000l0-Q0 for guix-patches@gnu.org; Sat, 09 Sep 2017 13:25:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dqjV8-0002Zy-AQ for guix-patches@gnu.org; Sat, 09 Sep 2017 13:25:02 -0400 Subject: [bug#28281] [PATCH] gnu: Add os-prober. Resent-Message-ID: Message-Id: <9ef18175.AEQAP00oGCsAAAAAAAAAAAPmNSgAAAACwQwAAAAAAAW9WABZtCPY@mailjet.com> MIME-Version: 1.0 From: Arun Isaac Date: Sat, 09 Sep 2017 22:54:27 +0530 In-reply-to: <20170909171635.7968-1-arunisaac@systemreboot.net> References: <20170909171635.7968-1-arunisaac@systemreboot.net> Content-Type: text/plain Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 28281@debbugs.gnu.org Here's an updated patch. > + (replace 'install > + (lambda* (#:key outputs #:allow-other-keys) > + (define (find-files-non-recursive directory) > + (find-files directory > + (lambda (file stat) > + (string-match (string-append "^" directory = "/[^/]*$") > + file)) > + #:directories? #t)) Do you think it would be a good idea to add a #:recursive? keyword argument to `find-files' in (guix build utils), instead of creating this `find-files-non-recursive-function' here? > + (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-probe= r")) > + (install-file "os-probes/mounted/powerpc/20macosx" > + (string-append lib "/os-probes/mounted")) > + (for-each > + (lambda (directory) > + (for-each > + (lambda (file) > + (let ((destination (string-append lib "/" directory > + "/" (basename fil= e)))) > + (mkdir-p (dirname destination)) > + (copy-recursively file destination))) > + (append (find-files-non-recursive (string-append dire= ctory "/common")) > + (find-files-non-recursive (string-append dire= ctory "/x86"))))) > + (list "os-probes" "os-probes/mounted" "os-probes/init" > + "linux-boot-probes" "linux-boot-probes/mounted")) > + #t)))))) I have used `find-files' instead of `ftw', as you suggested. The install procedure is clearer now. but still remains quite messy. It is not simple enough to separate the "candidate-files" and "install-file" logic. WDYT? Will the above code do? =