From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKkje-0008Ja-7Z for guix-patches@gnu.org; Fri, 01 Dec 2017 07:48:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKkja-0006FF-2x for guix-patches@gnu.org; Fri, 01 Dec 2017 07:48:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:58721) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eKkjZ-0006F1-V4 for guix-patches@gnu.org; Fri, 01 Dec 2017 07:48:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eKkjZ-0005k5-Lc for guix-patches@gnu.org; Fri, 01 Dec 2017 07:48:01 -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> Date: Fri, 01 Dec 2017 13:47:49 +0100 In-Reply-To: <1512038828-10822-1-git-send-email-m.othacehe@gmail.com> (m. othacehe's message of "Thu, 30 Nov 2017 11:47:08 +0100") Message-ID: <87609qhax6.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: m.othacehe@gmail.com Cc: 29409@debbugs.gnu.org Hello, m.othacehe@gmail.com skribis: > From: Mathieu Othacehe > > * guix/build/utils.scm (dd): New exported procedure. > * gnu/bootloader/extlinux.scm (dd): Remove it, > (install-extlinux): replace gexp dd with dd added above. > --- > Hi, > > dd will be used in different bootloader related gexp. So it may be > good to add it to (guix build utils). The problem is that > it triggers a big rebuild. I was able to test this path with > "installed-extlinux-os". Yes, changing (guix build utils) triggers a full rebuild because everything depends on it. > +(define* (dd input output #:key bs count seek (extras '())) > + "Call dd command with provided INPUT and OUTPUT arguments. BS, COUNT, = SEEK > + and EXTRAS parameters are optional. EXTRAS is a list of string argumen= ts to > + be passed directly to dd." > + (apply system* "dd" > + (string-append "if=3D" input) > + (string-append "of=3D" output) > + (append > + (if bs > + `(,(string-append "bs=3D" (number->string bs))) > + '()) > + (if count > + `(,(string-append "count=3D" (number->string count))) > + '()) > + (if seek > + `(,(string-append "seek=3D" (number->string seek))) > + '()) > + extras))) I=E2=80=99m not quite convinced. :-) It seems to me that it doesn=E2=80= =99t buy us much to have it in (guix build utils), because we don=E2=80=99t need it very often anyway, and secondly, I think we can use =E2=80=98dump-port=E2=80=99 = or other I/O procedures instead. Namely: + (zero? (dd (string-append syslinux-dir "/" #$mbr) + device + #:bs 440 + #:count 1))) would become: (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)))) Granted, that=E2=80=99s a bit more verbose, but it=E2=80=99s also very ligh= tweight compared to using =E2=80=98dd=E2=80=99. WDYT? Ludo=E2=80=99.