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: ludo <at> gnu.org (Ludovic Courtès)
To: m.othacehe <at> gmail.com
Cc: 29409 <at> debbugs.gnu.org
Subject: [bug#29409] [PATCH] build: utils: Introduce dd.
Date: Fri, 01 Dec 2017 13:47:49 +0100
Hello,

m.othacehe <at> gmail.com skribis:

> 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".

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 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)))

I’m not quite convinced.  :-)  It seems to me that it doesn’t buy us
much to have it in (guix build utils), because we don’t need it very
often anyway, and secondly, I think we can use ‘dump-port’ 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’s a bit more verbose, but it’s also very lightweight
compared to using ‘dd’.

WDYT?

Ludo’.




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.