unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
To: 41785@debbugs.gnu.org, "Ludovic Courtès" <ludo@gnu.org>,
	"Mathieu Othacehe" <othacehe@gnu.org>
Subject: [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic.
Date: Fri, 12 Jun 2020 23:42:13 +0200	[thread overview]
Message-ID: <20200612214214.14112-1-janneke@gnu.org> (raw)
In-Reply-To: <20200610085441.890-1-janneke@gnu.org>

* gnu/system/image.scm (find-image): Make non-monadic.  Add 'target'
parameter.
* gnu/tests/install.scm (run-install): Update caller,
passing (%current-target-system).
* guix/scripts/system.scm (perform-action): Likewise.
---
 gnu/system/image.scm    | 22 ++++++++++------------
 gnu/tests/install.scm   |  6 ++++--
 guix/scripts/system.scm |  3 ++-
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index a0e6bf31f1..ac55301a60 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -547,20 +548,17 @@ image, depending on IMAGE format."
                              #:grub-mkrescue-environment
                              '(("MKRESCUE_SED_MODE" . "mbr_hfs")))))))
 
-(define (find-image file-system-type)
+(define (find-image file-system-type target)
   "Find and return an image that could match the given FILE-SYSTEM-TYPE.  This
 is useful to adapt to interfaces written before the addition of the <image>
 record."
-  (mlet %store-monad ((target (current-target-system)))
-    (mbegin %store-monad
-      (return
-       (match file-system-type
-         ("iso9660" iso9660-image)
-         (_ (cond
-             ((and target
-                   (hurd-triplet? target))
-              hurd-disk-image)
-             (else
-              efi-disk-image))))))))
+  (match file-system-type
+    ("iso9660" iso9660-image)
+    (_ (cond
+        ((and target
+              (hurd-triplet? target))
+         hurd-disk-image)
+        (else
+         efi-disk-image)))))
 
 ;;; image.scm ends here
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 6bd8c7d3d2..82098290f7 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -228,8 +229,9 @@ packages defined in installation-os."
   (mlet* %store-monad ((_      (set-grafting #f))
                        (system (current-system))
                        (target (operating-system-derivation target-os))
-                       (base-image (find-image
-                                    installation-disk-image-file-system-type))
+                       (base-image -> (find-image
+                                       installation-disk-image-file-system-type
+                                       (%current-target-system)))
 
                        ;; Since the installation system has no network access,
                        ;; we cheat a little bit by adding TARGET to its GC
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 3d7aa77cb7..6f3880cc34 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -801,7 +802,7 @@ static checks."
       (check-initrd-modules os)))
 
   (mlet* %store-monad
-      ((image     (find-image file-system-type))
+      ((image ->  (find-image file-system-type (%current-target-system)))
        (sys       (system-derivation-for-action os image action
                                                 #:file-system-type file-system-type
                                                 #:image-size image-size
-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com





  parent reply	other threads:[~2020-06-12 21:43 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10  8:54 [bug#41785] [PATCH] DRAFT services: Add 'hurd-in-vm service-type' Jan (janneke) Nieuwenhuizen
2020-06-10 11:34 ` Mathieu Othacehe
2020-06-11 19:43   ` Ludovic Courtès
2020-06-11 19:59     ` Jan Nieuwenhuizen
2020-06-11 20:01   ` Marius Bakke
2020-06-12  6:39     ` Jan Nieuwenhuizen
2020-06-12 10:51       ` Diego Nicola Barbato
2020-06-13  7:30         ` Jan Nieuwenhuizen
2020-06-11 19:59 ` Ludovic Courtès
2020-06-11 21:57   ` Jan Nieuwenhuizen
2020-06-12  6:46     ` Jan Nieuwenhuizen
2020-06-12 14:45     ` Ludovic Courtès
2020-06-12 21:33       ` Jan Nieuwenhuizen
2020-06-12 15:04     ` Mathieu Othacehe
2020-06-12 21:33       ` Jan Nieuwenhuizen
2020-06-14 12:10         ` [bug#41785] [PATCH v4] " Jan Nieuwenhuizen
2020-06-14 12:44           ` Mathieu Othacehe
2020-06-14 13:18             ` Jan Nieuwenhuizen
2020-06-14 15:52               ` Mathieu Othacehe
2020-06-14 16:22                 ` Mathieu Othacehe
2020-06-14 16:42                 ` bug#41785: " Jan Nieuwenhuizen
2020-06-12 14:42   ` [bug#41785] [PATCH] DRAFT " Mathieu Othacehe
2020-06-12 15:39     ` Ludovic Courtès
2020-06-12 21:42 ` Jan (janneke) Nieuwenhuizen [this message]
2020-06-12 21:42   ` [bug#41785] [PATCH v3 2/2] services: Add 'hurd-vm service-type' Jan (janneke) Nieuwenhuizen
2020-06-13 12:49     ` Mathieu Othacehe
2020-06-13 13:10       ` Jan Nieuwenhuizen
2020-06-13 14:35       ` Ludovic Courtès
2020-06-13 15:01         ` Mathieu Othacehe
2020-06-13 10:56   ` [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic Mathieu Othacehe
2020-06-13 13:05     ` Jan Nieuwenhuizen
2020-06-14 12:37       ` Mathieu Othacehe
2020-06-14 13:12         ` Jan Nieuwenhuizen
2020-06-14 13:32           ` Jan Nieuwenhuizen
2020-06-14 15:44             ` Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200612214214.14112-1-janneke@gnu.org \
    --to=janneke@gnu.org \
    --cc=41785@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=othacehe@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).