From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLryY-0006s8-NX for guix-patches@gnu.org; Mon, 04 Dec 2017 09:44:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eLryU-0002I9-Mt for guix-patches@gnu.org; Mon, 04 Dec 2017 09:44:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:35808) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eLryU-0002Hz-GO for guix-patches@gnu.org; Mon, 04 Dec 2017 09:44:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eLryU-0000EJ-3w for guix-patches@gnu.org; Mon, 04 Dec 2017 09:44:02 -0500 Subject: [bug#29409] [PATCH] build: utils: Introduce dd. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <877euhtjkj.fsf@gmail.com> <1512038828-10822-1-git-send-email-m.othacehe@gmail.com> <87609qhax6.fsf@gnu.org> <87609m5zu5.fsf@gmail.com> Date: Mon, 04 Dec 2017 15:43:39 +0100 In-Reply-To: <87609m5zu5.fsf@gmail.com> (Mathieu Othacehe's message of "Mon, 04 Dec 2017 15:31:46 +0100") Message-ID: <871skao8o4.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: Mathieu Othacehe Cc: 29409@debbugs.gnu.org Mathieu Othacehe skribis: >> Granted, that=E2=80=99s a bit more verbose, but it=E2=80=99s also very l= ightweight >> compared to using =E2=80=98dd=E2=80=99. > > Here's a new implementation, using your snippet. I tested it with > "installed-extlinux-os", it seems ok. > > Mathieu > > From 742662ceec2a40d664520f01977ddc4cbe64d369 Mon Sep 17 00:00:00 2001 > From: Mathieu Othacehe > Date: Fri, 1 Dec 2017 14:09:38 +0100 > Subject: [PATCH] bootloader: extlinux: Stop using dd binary. > > * gnu/bootloader/extlinux.scm (dd): Remove it, > (install-extlinux): replace dd call by Guile I/O procedures. > * gnu/system/vm.scm (qemu-image): Add (ice-9 binary-ports) to module-clos= ure > and used-modules list to provide "get-bytevector-n" and "put-bytevector". > * guix/scripts/system.scm (bootloader-installer-derivation): Ditto. Nice! > + (unless > + (and (zero? (system* extlinux "--install" install-dir)) > + (call-with-input-file (string-append syslinux-dir "/" #= $mbr) > + (lambda (input) > + (let ((bv (get-bytevector-n input 440)) > + (output (open-file device "wb0"))) > + (put-bytevector output bv) > + (close-port output))))) I think you can use =E2=80=98call-with-output-file=E2=80=99 for DEVICE no? > --- a/gnu/system/vm.scm > +++ b/gnu/system/vm.scm > @@ -274,11 +274,13 @@ the image." > (expression->derivation-in-linux-vm > name > (with-imported-modules (source-module-closure '((gnu build vm) > - (guix build utils))) > + (guix build utils) > + (ice-9 binary-ports))) No: this would import the host Guile=E2=80=99s (ice-9 binary-ports) module = into the guest, thereby making the result dependent on the Guile version being used =E2=80=9Coutside=E2=80=9D. > #~(begin > (use-modules (gnu build vm) > (guix build utils) > - (srfi srfi-26)) > + (srfi srfi-26) > + (ice-9 binary-ports)) This yes. > (let ((inputs > '#$(append (list qemu parted e2fsprogs dosfstools) > diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm > index 91d151d..5116b82 100644 > --- a/guix/scripts/system.scm > +++ b/guix/scripts/system.scm > @@ -674,9 +674,11 @@ any, are available. Raise an error if they're not." > and TARGET arguments." > (with-monad %store-monad > (gexp->file "bootloader-installer" > - (with-imported-modules '((guix build utils)) > + (with-imported-modules '((guix build utils) > + (ice-9 binary-ports)) No. > #~(begin > - (use-modules (guix build utils)) > + (use-modules (guix build utils) > + (ice-9 binary-ports)) OK. Could you send an updated patch? Thanks! Ludo=E2=80=99.