From patchwork Fri Jun 12 21:42:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janneke Nieuwenhuizen X-Patchwork-Id: 22690 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E433427BBE3; Fri, 12 Jun 2020 22:43:08 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 831B927BBE1 for ; Fri, 12 Jun 2020 22:43:08 +0100 (BST) Received: from localhost ([::1]:43482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjrS8-0006gm-1r for patchwork@mira.cbaines.net; Fri, 12 Jun 2020 17:43:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjrS2-0006gY-NY for guix-patches@gnu.org; Fri, 12 Jun 2020 17:43:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57335) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jjrS2-0007tb-El for guix-patches@gnu.org; Fri, 12 Jun 2020 17:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jjrS2-0000ju-De for guix-patches@gnu.org; Fri, 12 Jun 2020 17:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41785] [PATCH v3 1/2] image: Make 'find-image' non-monadic. References: <20200610085441.890-1-janneke@gnu.org> In-Reply-To: <20200610085441.890-1-janneke@gnu.org> Resent-From: "Jan (janneke) Nieuwenhuizen" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 12 Jun 2020 21:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41785 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41785@debbugs.gnu.org, Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe Received: via spool by 41785-submit@debbugs.gnu.org id=B41785.15919981542801 (code B ref 41785); Fri, 12 Jun 2020 21:43:02 +0000 Received: (at 41785) by debbugs.gnu.org; 12 Jun 2020 21:42:34 +0000 Received: from localhost ([127.0.0.1]:40646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjrRS-0000iy-Py for submit@debbugs.gnu.org; Fri, 12 Jun 2020 17:42:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjrRR-0000ic-85 for 41785@debbugs.gnu.org; Fri, 12 Jun 2020 17:42:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45597) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjrRJ-0007ap-H5; Fri, 12 Jun 2020 17:42:17 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=33506 helo=dundal.fritz.box) by fencepost.gnu.org with esmtpa (Exim 4.82) (envelope-from ) id 1jjrRH-00040W-QZ; Fri, 12 Jun 2020 17:42:16 -0400 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 12 Jun 2020 23:42:13 +0200 Message-Id: <20200612214214.14112-1-janneke@gnu.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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 +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; 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 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 ;;; Copyright © 2020 Mathieu Othacehe ;;; Copyright © 2020 Danny Milosavljevic +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; 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 ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2019 Christopher Baines +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; 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