GNU bug report logs - #29409
GuixSD ARM port.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <m.othacehe <at> gmail.com>

Date: Thu, 23 Nov 2017 09:46:01 UTC

Severity: normal

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: m.othacehe <at> gmail.com
To: 29409 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: [bug#29409] [PATCH] build: utils: Introduce dd.
Date: Thu, 30 Nov 2017 11:47:08 +0100
From: Mathieu Othacehe <m.othacehe <at> gmail.com>

* 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 <andreas <at> enge.fr>
 ;;; Copyright © 2013 Nikita Karetnikov <nikita <at> karetnikov.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw <at> netris.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;;
 ;;; 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





This bug report was last modified 7 years and 108 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.