guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: image: Make 'find-image' non-monadic.


From: guix-commits
Subject: branch master updated: image: Make 'find-image' non-monadic.
Date: Sat, 13 Jun 2020 09:04:30 -0400

This is an automated email from the git hooks/post-receive script.

janneke pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 7ca533c  image: Make 'find-image' non-monadic.
7ca533c is described below

commit 7ca533c7237622d70b423033c4506217d9ce4014
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Thu Jun 11 22:52:12 2020 +0200

    image: Make 'find-image' non-monadic.
    
    * 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    | 28 +++++++++++++---------------
 gnu/tests/install.scm   |  9 ++++++---
 guix/scripts/system.scm |  4 +++-
 3 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 6c45735..be8b6e6 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.
 ;;;
@@ -556,20 +557,17 @@ image, depending on IMAGE format."
         #:grub-mkrescue-environment
         '(("MKRESCUE_SED_MODE" . "mbr_only")))))))
 
-(define (find-image file-system-type)
-  "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))))))))
+(define (find-image file-system-type target)
+  "Find and return an image built that could match the given FILE-SYSTEM-TYPE,
+built for TARGET.  This is useful to adapt to interfaces written before the
+addition of the <image> record."
+  (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 6bd8c7d..db355b8 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.
 ;;;
@@ -227,15 +228,17 @@ 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))
+                       (target (current-target-system))
+                       (base-image -> (find-image
+                                       installation-disk-image-file-system-type
+                                       target))
 
                        ;; Since the installation system has no network access,
                        ;; we cheat a little bit by adding TARGET to its GC
                        ;; roots.  This way, we know 'guix system init' will
                        ;; succeed.  Also add guile-final, which is pulled in
                        ;; through provenance.drv and may not always be present.
+                       (target (operating-system-derivation target-os))
                        (image ->
                         (system-image
                          (image
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 3d7aa77..6769a60 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,8 @@ static checks."
       (check-initrd-modules os)))
 
   (mlet* %store-monad
-      ((image     (find-image file-system-type))
+      ((target    (current-target-system))
+       (image ->  (find-image file-system-type target))
        (sys       (system-derivation-for-action os image action
                                                 #:file-system-type 
file-system-type
                                                 #:image-size image-size



reply via email to

[Prev in Thread] Current Thread [Next in Thread]