From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKMNz-0006WS-CS for guix-patches@gnu.org; Thu, 30 Nov 2017 05:48:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKMNv-0007tX-0K for guix-patches@gnu.org; Thu, 30 Nov 2017 05:48:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:57136) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eKMNu-0007sy-TA for guix-patches@gnu.org; Thu, 30 Nov 2017 05:48:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eKMNu-0002hn-Fh for guix-patches@gnu.org; Thu, 30 Nov 2017 05:48:02 -0500 Subject: [bug#29409] [PATCH] build: utils: Introduce dd. References: <877euhtjkj.fsf@gmail.com> In-Reply-To: <877euhtjkj.fsf@gmail.com> Resent-Message-ID: From: m.othacehe@gmail.com Date: Thu, 30 Nov 2017 11:47:08 +0100 Message-Id: <1512038828-10822-1-git-send-email-m.othacehe@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: 29409@debbugs.gnu.org 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". Thanks, Mathieu gnu/bootloader/extlinux.scm | 13 ++++--------- guix/build/utils.scm | 28 +++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm index 0db5598..b0b463e 100644 --- a/gnu/bootloader/extlinux.scm +++ b/gnu/bootloader/extlinux.scm @@ -85,14 +85,6 @@ TIMEOUT ~a~%" ;;; Install procedures. ;;; -(define dd - #~(lambda (bs count if of) - (zero? (system* "dd" - (string-append "bs=" (number->string bs)) - (string-append "count=" (number->string count)) - (string-append "if=" if) - (string-append "of=" of))))) - (define (install-extlinux mbr) #~(lambda (bootloader device mount-point) (let ((extlinux (string-append bootloader "/sbin/extlinux")) @@ -103,7 +95,10 @@ TIMEOUT ~a~%" (find-files syslinux-dir "\\.c32$")) (unless (and (zero? (system* extlinux "--install" install-dir)) - (#$dd 440 1 (string-append syslinux-dir "/" #$mbr) device)) + (zero? (dd (string-append syslinux-dir "/" #$mbr) + device + #:bs 440 + #:count 1))) (error "failed to install SYSLINUX"))))) (define install-extlinux-mbr diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 7391307..2ed5ddc 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2013 Andreas Enge ;;; Copyright © 2013 Nikita Karetnikov ;;; Copyright © 2015 Mark H Weaver +;;; Copyright © 2017 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -86,7 +87,8 @@ wrap-program invoke - locale-category->string)) + locale-category->string + dd)) ;;; @@ -1089,6 +1091,30 @@ returned." LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME))) + +;;; +;;; dd. +;;; + +(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 arguments to + be passed directly to dd." + (apply system* "dd" + (string-append "if=" input) + (string-append "of=" output) + (append + (if bs + `(,(string-append "bs=" (number->string bs))) + '()) + (if count + `(,(string-append "count=" (number->string count))) + '()) + (if seek + `(,(string-append "seek=" (number->string seek))) + '()) + extras))) + ;;; Local Variables: ;;; eval: (put 'call-with-output-file/atomic 'scheme-indent-function 1) ;;; eval: (put 'call-with-ascii-input-file 'scheme-indent-function 1) -- 2.7.4