From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr1x1-0002q0-Uc for guix-patches@gnu.org; Sun, 10 Sep 2017 09:07:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dr1x0-0001bs-QY for guix-patches@gnu.org; Sun, 10 Sep 2017 09:07:03 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:49876) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dr1x0-0001bo-Mh for guix-patches@gnu.org; Sun, 10 Sep 2017 09:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dr1x0-0006m6-E2 for guix-patches@gnu.org; Sun, 10 Sep 2017 09:07:02 -0400 Subject: [bug#28281] [PATCH] gnu: Add os-prober. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170909171635.7968-1-arunisaac@systemreboot.net> Date: Sun, 10 Sep 2017 15:05:55 +0200 In-Reply-To: (Arun Isaac's message of "Sat, 09 Sep 2017 22:54:27 +0530") Message-ID: <874lsa900c.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 Heya, Arun Isaac skribis: > 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? Hmm I didn=E2=80=99t understand that it *had* to be non-recursive. Does it really make a difference? If it does, then =E2=80=98scandir=E2=80=99 from (ice-9 ftw) would be the th= ing. Sorry if I led you in the wrong direction. :-/ >> + (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-prob= er")) >> + (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 fi= le)))) >> + (mkdir-p (dirname destination)) >> + (copy-recursively file destination))) >> + (append (find-files-non-recursive (string-append dir= ectory "/common")) >> + (find-files-non-recursive (string-append dir= ectory "/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? Sure. I mean, we should try our best to make things clearer, while not losing our hairs on it. Sometimes it just has to be messy. Thanks, Ludo=E2=80=99.