From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnPUw-0008Lr-Sp for guix-patches@gnu.org; Thu, 31 Aug 2017 09:27:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dnPUt-00052z-P8 for guix-patches@gnu.org; Thu, 31 Aug 2017 09:27:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:56090) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dnPUt-00052t-La for guix-patches@gnu.org; Thu, 31 Aug 2017 09:27:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dnPUt-0000tv-9r for guix-patches@gnu.org; Thu, 31 Aug 2017 09:27:03 -0400 Subject: [bug#28281] [PATCH] gnu: Add os-prober. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: Date: Thu, 31 Aug 2017 15:25:48 +0200 In-Reply-To: (Arun Isaac's message of "Wed, 30 Aug 2017 00:36:28 +0530") Message-ID: <87lglzrhr7.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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: Arun Isaac Cc: 28281@debbugs.gnu.org Hi! Arun Isaac 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-probe= r")) > + (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:st= art result 0)) > + (substring file (1- (match:end resu= lt 0)))))))) > + #t))) For clarity, what about (1) using =E2=80=98find-files=E2=80=99 instead of = =E2=80=98ftw=E2=80=99, and (2) separating code that builds the list of files from code that calls =E2=80=98install-file=E2=80=99? So something like: (define (candidate-files directory) (find-files directory (lambda (file stat) (and (eq? (stat:kind stat) 'regular) =E2=80=A6)))) (for-each (lambda (file) (install-file file =E2=80=A6)) (append-map candidate-files (list "os-probes" "linux-boot-probes"))) WDYT? Ludo=E2=80=99.