From patchwork Thu Sep 26 10:08:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31493 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 C43E027BBEB; Thu, 26 Sep 2024 11:12:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C662827BBE2 for ; Thu, 26 Sep 2024 11:12:08 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTF-0002wx-2i; Thu, 26 Sep 2024 06:11:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTD-0002wJ-Q0 for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:35 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTD-0007P6-Gh for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=jrFz+Po8w18tytchy7+aNDboMOw/I/Oi+JJ7tveG/1k=; b=sYNu21iXLyBn6BrAWHPhmdR/rv09Nummu0XNzn4ublgEsnqft+3ZF2yLTq/NFyVCgVKtbI08jijdFUjsekREYsSvaMQrR1vRx1RUEIwrJ8ASVGXMgqVSGJO2fsruSj3hXyyWGnqSgtnjTIM4fx409ytJS3drsuS8CZzH90e6WcHd+ihjGWsQ25somtOSwlj5SmtWsX/RPTOVWedUm0JVeNknNRRdkcdeJCHD+G46fvYJsE8NOBvHK3EolVO+5h9hmfS8SRgyB7IWQyqqGQd70kybCBGlrDfs7kpR4HzUbMN5IJoByw582jeEp+U9NTKD4FGMwqw+oy/sWF8yrRUG4g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTe-0003Tp-E7; Thu, 26 Sep 2024 06:12:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 01/14] gnu: bootloader: Remove deprecated bootloader-configuration field. References: <20240912165818.21580-1-herman@rimm.ee> In-Reply-To: <20240912165818.21580-1-herman@rimm.ee> Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: lilah@lunabee.space, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter , Lilah Tascheter X-Debbugs-Original-Xcc: Lilah Tascheter Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734547713133 (code B ref 73202); Thu, 26 Sep 2024 10:12:02 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:17 +0000 Received: from localhost ([127.0.0.1]:55462 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSv-0003Pb-65 for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:17 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39475 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSt-0003PA-2M for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jrFz+Po8w18tytchy7+aNDboMOw/I/Oi+JJ7tveG/1k=; b=jGIrM9kqkitygQ0qtlWM75n2MmXzYgdUh/9TgmchtsPOpEgYxED7647OnkPRumg15xS/Wt MAeRBT4NZrhPsmK9aUQ4TKQMxYeOftJur0BvQ3E9cR8lbmBZqvnmT52eVdowhXAUdNjur4 8jnAJ6cH8uOkBeBKnN769ekoNLJwqfi40PC6nBek7Q0Ka4TsTpHLuVBt3zJ2wd3mW61qnj B15V/8yr6DmOuKo6cgbRVgjsG6CFVI8UZHZvNxauIMmk7pBExxiVSqux//55Itsl06sd4/ 0+LLxVzc7dCCOKK+MnRiphF1fkS4afrEwwcTd4FQLBzCMdRDRLm6cmmEmDQwEA== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 785e15c2 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:34 +0000 (UTC) Date: Thu, 26 Sep 2024 12:08:58 +0200 Message-ID: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter * gnu/bootloader.scm (warn-target-field-deprecation): Delete sanitizer. (bootloader-configuration)[target]: Remove deprecated field. (bootloader-configuration-target): Delete procedure. (bootloader-configuration-targets): Do not use target field. Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739 --- gnu/bootloader.scm | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) base-commit: db3ec7f65bd04741f1d97a9a3bbd3d96f12caa52 diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index f32e90e79d..865521e6e5 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -66,7 +66,6 @@ (define-module (gnu bootloader) bootloader-configuration bootloader-configuration? bootloader-configuration-bootloader - bootloader-configuration-target ;deprecated bootloader-configuration-targets bootloader-configuration-menu-entries bootloader-configuration-default-entry @@ -244,24 +243,14 @@ (define-record-type* ;; The record contains bootloader independant ;; configuration used to fill bootloader configuration file. -(define-with-syntax-properties (warn-target-field-deprecation - (value properties)) - (when value - (warning (source-properties->location properties) - (G_ "the 'target' field is deprecated, please use 'targets' \ -instead~%"))) - value) (define-record-type* bootloader-configuration make-bootloader-configuration bootloader-configuration? (bootloader - bootloader-configuration-bootloader) ; + bootloader-configuration-bootloader) ; (targets %bootloader-configuration-targets (default #f)) ;list of strings - (target %bootloader-configuration-target ;deprecated - (default #f) - (sanitize warn-target-field-deprecation)) (menu-entries bootloader-configuration-menu-entries (default '())) ;list of (default-entry bootloader-configuration-default-entry @@ -285,14 +274,9 @@ (define-record-type* (extra-initrd bootloader-configuration-extra-initrd (default #f))) ;string | #f -(define-deprecated (bootloader-configuration-target config) - bootloader-configuration-targets - (%bootloader-configuration-target config)) (define (bootloader-configuration-targets config) (or (%bootloader-configuration-targets config) - ;; TODO: Remove after the deprecated 'target' field is removed. - (list (%bootloader-configuration-target config)) ;; XXX: At least the GRUB installer (see (gnu bootloader grub)) has this ;; peculiar behavior of installing fonts and GRUB modules when DEVICE is #f, ;; hence the default value of '(#f) rather than '(). From patchwork Thu Sep 26 10:08:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31494 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 C76CB27BBE9; Thu, 26 Sep 2024 11:12:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D369B27BBE2 for ; Thu, 26 Sep 2024 11:12:10 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTF-0002x0-Mr; Thu, 26 Sep 2024 06:11:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTE-0002wR-8X for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:36 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTD-0007PC-VY for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=OXeZhAHSAvOKs7eTZmyPsqKOyWfNWR41xD+pV5vSCnE=; b=EH9hLoEpLqeugTkqo0DJl+OA8FWKsnxlQvoYFrrdtu/6Pd8ZalKPRVXglTLooHheN5ovcP+/rROog99RxZJbSW40JOs2c0EGRbtgR5pgqWbf7DlePSCHBK8tN3o0idK01Vsx8xY5iHJmlLTZjg5FdBUEbtpFOUi8J+Hmgf/p0wPuC6PqohccxDVIHrj8C9Hs2ZrhTNhPFEBOeVDO5sso2M3Ac9dkPgexxfAOHL1YGWms1voMYxlZPMzLxMB5o3/LdnPEfjB4SGU9NEFf7smka3IXQB4ohBbTaOXpybkvu83FKZBEakW1vjIi+3XgQMgB3Bfcq5k4uRZzqGfgn8EQ/g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTe-0003Tx-TX for guix-patches@gnu.org; Thu, 26 Sep 2024 06:12:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 02/14] gnu: system: Remove useless boot parameters. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734548213178 (code B ref 73202); Thu, 26 Sep 2024 10:12:02 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:22 +0000 Received: from localhost ([127.0.0.1]:55472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSz-0003QT-Hq for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:22 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39475 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSu-0003PA-D7 for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OXeZhAHSAvOKs7eTZmyPsqKOyWfNWR41xD+pV5vSCnE=; b=nPLQrP3JqCtoz5a/o9EqlgfZjjPoucqXbKu32tM7Ku5qpDkSimKgMw4kWxiNPB1d5bJmWG +206kaj1S3ZQzEdHBUmF+Psw/bvt2B4kOul5PTs/ezBBES1+yCb+yAC4n13dS4GuhYsX8J Vz/rcFJydz+KioLoFMUkaHrGXChWQNZtXmxIAyGSmuVfrMZ403fdMti+qxfKXPUEgOz1bT FL6HWHUlNot48jIOYMBiQU3O42GXAV+rDSgHgHR+0P/KiXJ2vO3kKV67MaCBg50EnarROM HRloARXi8IBo60NDhWLB4T+hH4YEhJvAnESNagziNooyTEeMZ5+mHCEWac+BZA== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id a542de37 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:35 +0000 (UTC) Date: Thu, 26 Sep 2024 12:08:59 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter * gnu/system.scm (operating-system-boot-parameters, operating-system-boot-parameters-file): Delete bootloader-menu-entries. * gnu/system/boot.scm (boot-parameters)[bootloader-menu-entries]: Delete field. (read-boot-parameters): Don't read bootloader-menu-entries. * tests/boot-parameters.scm (%grub-boot-parameters, test-read-boot-parameters, test-read-boot-parameters): Don't include bootloader-menu-entries. ("read, bootloader-menu-entries, default value"): Delete test. Change-Id: I46d9cff4604dbfcf654b0820fdb77e72aecffbb4 --- gnu/system.scm | 7 ------- gnu/system/boot.scm | 8 -------- tests/boot-parameters.scm | 18 +++++------------- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index 25afa96295..a3eee5aa24 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1298,8 +1298,6 @@ (define* (operating-system-boot-parameters os root-device (initrd initrd) (multiboot-modules multiboot-modules) (bootloader-name bootloader-name) - (bootloader-menu-entries - (bootloader-configuration-menu-entries (operating-system-bootloader os))) (locale locale) (store-device (ensure-not-/dev (file-system-device store))) (store-directory-prefix (btrfs-store-subvolume-file-name file-systems)) @@ -1341,11 +1339,6 @@ (define* (operating-system-boot-parameters-file os) #$(boot-parameters-multiboot-modules params))) #~()) (bootloader-name #$(boot-parameters-bootloader-name params)) - (bootloader-menu-entries - #$(map menu-entry->sexp - (or (and=> (operating-system-bootloader os) - bootloader-configuration-menu-entries) - '()))) (locale #$(boot-parameters-locale params)) (store (device diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index de312c7208..54e5673a54 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -51,7 +51,6 @@ (define-module (gnu system boot) boot-parameters-label boot-parameters-root-device boot-parameters-bootloader-name - boot-parameters-bootloader-menu-entries boot-parameters-store-crypto-devices boot-parameters-store-device boot-parameters-store-directory-prefix @@ -110,8 +109,6 @@ (define-record-type* ;; partition. (root-device boot-parameters-root-device) (bootloader-name boot-parameters-bootloader-name) - (bootloader-menu-entries ;list of - boot-parameters-bootloader-menu-entries) (store-device boot-parameters-store-device) (store-mount-point boot-parameters-store-mount-point) (store-directory-prefix boot-parameters-store-directory-prefix) @@ -172,11 +169,6 @@ (define (read-boot-parameters port) ((_ args) args) (#f 'grub))) ; for compatibility reasons. - (bootloader-menu-entries - (match (assq 'bootloader-menu-entries rest) - ((_ entries) (map sexp->menu-entry entries)) - (#f '()))) - ;; In the past, we would store the directory name of linux instead of ;; the absolute file name of its image. Detect that and correct it. (kernel (if (string=? kernel (direct-store-path kernel)) diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm index 2e7976aa6c..e1dc4620c3 100644 --- a/tests/boot-parameters.scm +++ b/tests/boot-parameters.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas ;;; Copyright © 2022 Josselin Poiret +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -34,6 +35,7 @@ (define-module (test-boot-parameters) #:use-module (guix gexp) #:use-module (guix store) #:use-module (guix tests) + #:use-module (ice-9 format) #:use-module (srfi srfi-34) #:use-module (srfi srfi-64) #:use-module (rnrs bytevectors)) @@ -64,7 +66,6 @@ (define %root-path "/") (define %grub-boot-parameters (boot-parameters (bootloader-name 'grub) - (bootloader-menu-entries '()) (root-device %default-root-device) (label %default-label) (kernel %default-kernel) @@ -107,7 +108,6 @@ (define* (test-read-boot-parameters #:key (version %boot-parameters-version) (bootloader-name 'grub) - (bootloader-menu-entries '()) (label %default-label) (root-device (quote-uuid %default-root-device)) (kernel %default-kernel) @@ -127,7 +127,7 @@ (define* (test-read-boot-parameters (cond ((eq? 'false val) (format #false fmt #false)) (val (format #false fmt val)) (else ""))) - (format #false "(boot-parameters~a~a~a~a~a~a~a~a~a~a)" + (format #f "(boot-parameters~@{~a~})" (sexp-or-nothing " (version ~S)" version) (sexp-or-nothing " (label ~S)" label) (sexp-or-nothing " (root-device ~S)" root-device) @@ -135,7 +135,7 @@ (define* (test-read-boot-parameters (sexp-or-nothing " (kernel-arguments ~S)" kernel-arguments) (sexp-or-nothing " (initrd ~S)" initrd) (if with-store - (format #false " (store~a~a~a~a)" + (format #f " (store~@{~a~})" (sexp-or-nothing " (device ~S)" store-device) (sexp-or-nothing " (mount-point ~S)" store-mount-point) @@ -145,9 +145,7 @@ (define* (test-read-boot-parameters store-crypto-devices)) "") (sexp-or-nothing " (locale ~S)" locale) - (sexp-or-nothing " (bootloader-name ~a)" bootloader-name) - (sexp-or-nothing " (bootloader-menu-entries ~S)" - bootloader-menu-entries))) + (sexp-or-nothing " (bootloader-name ~a)" bootloader-name))) (let ((str (generate-boot-parameters))) (call-with-input-string str read-boot-parameters))) @@ -170,7 +168,6 @@ (define* (test-read-boot-parameters (test-assert "read, construction, optional fields" (and (test-read-boot-parameters #:bootloader-name #false) - (test-read-boot-parameters #:bootloader-menu-entries #false) (test-read-boot-parameters #:kernel-arguments #false) (test-read-boot-parameters #:with-store #false) (test-read-boot-parameters #:store-device #false) @@ -223,11 +220,6 @@ (define* (test-read-boot-parameters (boot-parameters-bootloader-name (test-read-boot-parameters #:bootloader-name #false))) -(test-eq "read, bootloader-menu-entries, default value" - '() - (boot-parameters-bootloader-menu-entries - (test-read-boot-parameters #:bootloader-menu-entries #false))) - (test-eq "read, kernel-arguments, default value" '() (boot-parameters-kernel-arguments From patchwork Thu Sep 26 10:09:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31501 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 09D3627BBEB; Thu, 26 Sep 2024 11:12:53 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9D30327BBE9 for ; Thu, 26 Sep 2024 11:12:52 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTI-0002xa-2k; Thu, 26 Sep 2024 06:11:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTE-0002wo-P2 for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:36 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTE-0007PH-Ev for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=ovim1EBaCAE1MVZajqRxcRakZdmW0ZG41AR3OZD7f5g=; b=eKZT5xbwHiUcOajFjRek00PpBtwCnUvpFmQivk1H8x/wFMaEtxcdzse/w/pUA8o/fNDnAO5XZc7wWZ1CIUEB1i6JU8Mx7RPvxLuWNQRx3oT9lCZUmWs6QFO9mh2cMtRzrNiB9YxRKBnCkg2dKShq7LL1CE0XCEAhSX60dHxTnSzNRYkDimvn/o2yI0qAyIkuB0uz1gXqkKhgr5YBVn7TuKmTknp7kfqkNnKTgf2zpX5M0FD42Yq6B6qtzxnSTaejJ2+PRGzhEjvZY10gbXODPA5TAEd9F47r3dxubS4aYMHTjARiYtj4cTdzHIz+xXP9IquRa3ykJzUVJBsx6Odt5Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTf-0003U5-D2 for guix-patches@gnu.org; Thu, 26 Sep 2024 06:12:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 03/14] gnu: tests: reconfigure: Remove bootloader install test. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734548413201 (code B ref 73202); Thu, 26 Sep 2024 10:12:03 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:24 +0000 Received: from localhost ([127.0.0.1]:55475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT0-0003Qa-9A for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:23 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39475 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSv-0003PA-He for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ovim1EBaCAE1MVZajqRxcRakZdmW0ZG41AR3OZD7f5g=; b=euJ+NUU0YStGlgJ6WjnA+kHeJFqK0Fwm9iTGEjCLEXdEAr2zb0nDm4pGY2sr65qkzu16uU /RyBnbPl9IC97/hsOh/b+ub6lidYH5s0GeCb5rKNZafQ7gJ5XWcmDGla9EmhcFN4CHNb/Q fWWeiMK5utEHTVkcFTZqyWHnjByT942zdah+2NEuL7nzBgd/uuF8iNxDxpuU501Pih7P7K 6mib50llwrSHIBCBPpA4eWcvOvdhRlROd6ubC+OYM9nrh6/Oc/MEja7a31py88SsNKUE/L CbFCAydrhjVYp+L0rI2yHZD1pty3ZZg3UcxlJlnyYUkef6dynCBvYHlZnF3blg== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id eaaee76b (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:37 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:00 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter * gnu/tests/reconfigure.scm (%test-install-bootloader): Delete variable. (run-install-bootloader-test): Delete procedure. Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739 --- gnu/tests/reconfigure.scm | 86 +-------------------------------------- 1 file changed, 1 insertion(+), 85 deletions(-) diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm index bcc7645fa3..8aa5311171 100644 --- a/gnu/tests/reconfigure.scm +++ b/gnu/tests/reconfigure.scm @@ -30,8 +30,7 @@ (define-module (gnu tests reconfigure) #:use-module (guix scripts system reconfigure) #:use-module (guix store) #:export (%test-switch-to-system - %test-upgrade-services - %test-install-bootloader)) + %test-upgrade-services)) ;;; Commentary: ;;; @@ -178,83 +177,6 @@ (define* (run-upgrade-services-test) (disable (upgrade-services-program '() '() '(dummy) '()))) (test enable disable)))) -(define* (run-install-bootloader-test) - "Run a test of an OS running INSTALL-BOOTLOADER-PROGRAM, which installs a -bootloader's configuration file." - (define os - (marionette-operating-system - (simple-operating-system) - #:imported-modules '((gnu services herd) - (guix combinators)))) - - (define vm (virtual-machine - (operating-system os) - (volatile? #f))) - - (define (test script) - (with-imported-modules '((gnu build marionette)) - #~(begin - (use-modules (gnu build marionette) - (ice-9 regex) - (srfi srfi-1) - (srfi srfi-64)) - - (define marionette - (make-marionette (list #$vm))) - - ;; Return the system generation paths that have GRUB menu entries. - (define (generations-in-grub-cfg marionette) - (let ((grub-cfg (marionette-eval - '(begin - (use-modules (rnrs io ports)) - (call-with-input-file "/boot/grub/grub.cfg" - get-string-all)) - marionette))) - (map (lambda (parameter) - (second (string-split (match:substring parameter) #\=))) - (list-matches "system=[^ ]*" grub-cfg)))) - - (test-runner-current (system-test-runner #$output)) - (test-begin "install-bootloader") - - (test-assert "no prior menu entry for system generation" - (not (member #$os (generations-in-grub-cfg marionette)))) - - (test-assert "script successfully evaluated" - (marionette-eval - '(primitive-load #$script) - marionette)) - - (test-assert "menu entry created for system generation" - (member #$os (generations-in-grub-cfg marionette))) - - (test-end)))) - - (let* ((bootloader ((compose bootloader-configuration-bootloader - operating-system-bootloader) - os)) - ;; The typical use-case for 'install-bootloader-program' is to read - ;; the boot parameters for the existing menu entries on the system, - ;; parse them with 'boot-parameters->menu-entry', and pass the - ;; results to 'operating-system-bootcfg'. However, to obtain boot - ;; parameters, we would need to start the marionette, which we should - ;; ideally avoid doing outside of the 'test' G-Expression. Thus, we - ;; generate a bootloader configuration for the script as if there - ;; were no existing menu entries. In the grand scheme of things, this - ;; matters little -- these tests should not make assertions about the - ;; behavior of 'operating-system-bootcfg'. - (bootcfg (operating-system-bootcfg os '())) - (bootcfg-file (bootloader-configuration-file bootloader))) - (gexp->derivation - "install-bootloader" - ;; Due to the read-only nature of the virtual machines used in the system - ;; test suite, the bootloader installer script is omitted. 'grub-install' - ;; would attempt to write directly to the virtual disk if the - ;; installation script were run. - (test - (install-bootloader-program #f #f #f bootcfg bootcfg-file '(#f) "/"))))) - - (define %test-switch-to-system (system-test (name "switch-to-system") @@ -267,9 +189,3 @@ (define %test-upgrade-services (description "Upgrade the Shepherd by unloading obsolete services and loading new services.") (value (run-upgrade-services-test)))) - -(define %test-install-bootloader - (system-test - (name "install-bootloader") - (description "Install a bootloader and its configuration file.") - (value (run-install-bootloader-test)))) From patchwork Thu Sep 26 10:09:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31505 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 6933C27BBEA; Thu, 26 Sep 2024 11:13:02 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2846627BBE2 for ; Thu, 26 Sep 2024 11:13:02 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTK-0002zZ-N7; Thu, 26 Sep 2024 06:11:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTI-0002xo-BG for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:40 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTI-0007Q2-08; Thu, 26 Sep 2024 06:11:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=3I+yfSwWj9UyTUe0RKzr9e7/82nPpeF/ED4ioJMhm4w=; b=pVg79OJhm1bRDbu2IBRsjMf5sykN9o++R0FALTiE6ORlGVFq8N4uLx+DxnAKcfIHkOADstJBJZRsknXkzzzg8/NERd7wkCquqkrg3ijGszhn18aeb4Ko5zXW1JTb8x4RKVEPE05D5xG04P5n9a9Wwu69z43GFRLOeWg6MSbztIIllfHLPYP2KDj8xNhFvkmu1Cwr/X1XjILahjtZke09xCKKPAwRkZNsQf5wScjGOhuWOs3X8xbK4jxXU3f4lOYypm7TcstsTAaFGBE7JaDM5CKSh2zdqK8i+z5H01BvKK2c7M3OXcvuHjgoNDy3QMphnvl5pu858gepNONtMG6Frw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTf-0003UC-Qs; Thu, 26 Sep 2024 06:12:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 04/14] guix: scripts: Remove unused code. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734548613230 (code B ref 73202); Thu, 26 Sep 2024 10:12:03 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:26 +0000 Received: from localhost ([127.0.0.1]:55485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT3-0003R5-1d for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:26 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39475 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSw-0003PA-Ly for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3I+yfSwWj9UyTUe0RKzr9e7/82nPpeF/ED4ioJMhm4w=; b=uyqSTkUSdO2LgsIkyjmgQTZPrb/wmG5rcuq8/Xm52dO6mlGaR/9QFGLl2nygsGALSlOTQD SEXijftCcSpMM8epHvzLgGYpQ39pEumk3T5h1Md87ey3Kk3p3ZP1O0YsORgNugCWCNs1CX BaniqyEbV4qFLDjpfA1htzGiIOMnKYQ63kCguC7792S50GyhN5zVoZz7Dc5VHkOb6l8UN/ gPE4Ta8+ea2TkRr1JZJM7aDltjDjdJyXwQmkCguDI1E3ot1EG6DLkhGEqTP4e2mFtTyuVu IFs3hpMbZ8dDQGl+aJ5S1lWJvmS+fO4XPMJsQH68/r9MwdwADrtdi0dVKdrl3g== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 6bf0b552 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:38 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:01 +0200 Message-ID: <219bd42a8b9bdb6c8c2c6181538c2e06d5c2c8f6.1727345067.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter * guix/scripts/system.scm (bootloader-installer-script): Delete. Change-Id: Ic1e0a523c814e4f1bf44b2721f5658f00066b0ab --- guix/scripts/system.scm | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 0fd153a278..881f2de104 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -754,28 +754,6 @@ (define (maybe-suggest-running-guix-pull) (warning (G_ "Consider running 'guix pull' before 'reconfigure'.~%")) (warning (G_ "Failing to do that may downgrade your system!~%")))) -(define (bootloader-installer-script installer - bootloader device target) - "Return a file calling INSTALLER gexp with given BOOTLOADER, DEVICE -and TARGET arguments." - (scheme-file "bootloader-installer" - (with-imported-modules '((gnu build bootloader) - (guix build utils)) - #~(begin - (use-modules (gnu build bootloader) - (guix build utils) - (ice-9 binary-ports) - (srfi srfi-34) - (srfi srfi-35)) - - (guard (c ((message-condition? c) ;XXX: i18n - (format (current-error-port) "error: ~a~%" - (condition-message c)) - (exit 1))) - (#$installer #$bootloader #$device #$target) - (info (G_ "bootloader successfully installed on '~a'~%") - #$device)))))) - (define (local-eval exp) "Evaluate EXP, a G-Expression, in-place." (mlet* %store-monad ((lowered (lower-gexp exp)) From patchwork Thu Sep 26 10:09:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31503 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 DFF3F27BBEA; Thu, 26 Sep 2024 11:12:57 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 19BE527BBE2 for ; Thu, 26 Sep 2024 11:12:57 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTK-0002zY-E6; Thu, 26 Sep 2024 06:11:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTI-0002xi-98 for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:40 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTH-0007Py-V6; Thu, 26 Sep 2024 06:11:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=v7VVD5foO2RJuxpQG7l1R01iBFyTtg7SBPGm/0Lk4fo=; b=cN/M54jmm2OHZtFdhnGHdDwDKyObA6bOfgXv10ggYTO+TM7ESqo9jdgBVp3MCe1Gswl+T2Ixbl1k2jWjPB0cd7nwNN6jSeT7iYJ/BpNmKJ9R0GI6OdsqSGFzE4t/vksMf6mB53nlqzq8FllCthba4UADtvYNP//ljPtThIRIH1hFFQLctMtWNIecy8mjtdPL+0O2MbH0dc9Jik9tBbTRJdR6xTGrTCi1WGMf92z7pttdIEZmMZQh+N2Gb45yGJYz7P0q6y65q0kjOGH2CkA3G/T9KK9pLcNWc/5XpQV89ey3uVKEXylSFrZivIP6FNdGDDUOBmHgoQweKNMJipGrQA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTg-0003UI-9H; Thu, 26 Sep 2024 06:12:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 05/14] guix: scripts: Rewrite reinstall-bootloader to use provenance data. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, lilah@lunabee.space, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter , Christopher Baines , Josselin Poiret , Lilah Tascheter , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Lilah Tascheter , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734548713252 (code B ref 73202); Thu, 26 Sep 2024 10:12:04 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:27 +0000 Received: from localhost ([127.0.0.1]:55489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT4-0003RL-37 for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:27 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39475 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSx-0003PA-Bw for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TIV9r0fR/7ADV2dR0dxOhiTkX2HwIVGBAggUOpD02gY=; b=KhpQrnMlDW+ZfZcC2yXGB2DerVGgdFHFKscIlveBRNe//Ce47XdFbPiyocZwScjw6aNCUy yRWUBMouxPEZurAh8M43a831M6+8nIVZ/2bI/2fygEZQsQKOyYy9g0DRyI8WxmGtff8iJv uVJlh967E0CZ/pzzDqpO83sB1J4ltIthLqiuoa8ZkGRv1s08zoBfGoUNix4IjKX7uuPirt bUZ3IdyljNwimoOHbG0hTk+pKQor0tLRUd+u5/PP4uyXdkEigFql76KVgCgh20XukXOcPF yb4eQS9Xu/PkzEys1zKYhshyv9I9xizZPL1dDQxnb+E1BoTiKkmwTpLdFXs9oQ== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 30ea07c1 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:38 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:02 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter Looking up bootloaders by name is broken because (extlinux) bootloaders share a name. Also, bootloader-configuration data is significant to bootloader installation, so it shouldn't just use the default values. Installation can rely on the provenance service instead, which should be present for the vast majority of systems. * gnu/bootloader.scm (%bootloaders): Delete variable. (lookup-bootloader-by-name, bootloader-modules): Delete procedures. * guix/scripts/system.scm (install-bootloader-from-os, install-bootloader-from-provenance): Add procedures. (reinstall-bootloader): Remove procedure. (switch-to-system-generation, process-command): Use install-bootloader-from-provenance. Change-Id: I5713a43ad4f9f32a129d980db06d70de16b03f27 --- gnu/bootloader.scm | 26 --------------- guix/scripts/system.scm | 73 ++++++++++++++++------------------------- 2 files changed, 28 insertions(+), 71 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 865521e6e5..3ea50a4004 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -26,7 +26,6 @@ (define-module (gnu bootloader) #:use-module (gnu system file-systems) #:use-module (gnu system uuid) - #:use-module (guix discovery) #:use-module (guix gexp) #:use-module (guix profiles) #:use-module (guix records) @@ -79,8 +78,6 @@ (define-module (gnu bootloader) bootloader-configuration-device-tree-support? bootloader-configuration-extra-initrd - %bootloaders - lookup-bootloader-by-name efi-bootloader-chain)) @@ -287,29 +284,6 @@ (define (bootloader-configuration-targets config) ;;; Bootloaders. ;;; -(define (bootloader-modules) - "Return the list of bootloader modules." - (all-modules (map (lambda (entry) - `(,entry . "gnu/bootloader")) - %load-path) - #:warn warn-about-load-error)) - -(define %bootloaders - ;; The list of publically-known bootloaders. - (delay (fold-module-public-variables (lambda (obj result) - (if (bootloader? obj) - (cons obj result) - result)) - '() - (bootloader-modules)))) - -(define (lookup-bootloader-by-name name) - "Return the bootloader called NAME." - (or (find (lambda (bootloader) - (eq? name (bootloader-name bootloader))) - (force %bootloaders)) - (leave (G_ "~a: no such bootloader~%") name))) - (define (efi-bootloader-profile packages files hooks) "Creates a profile from the lists of PACKAGES and FILES from the store. This profile is meant to be used by the bootloader-installer. diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 881f2de104..6b6bb46975 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -11,6 +11,8 @@ ;;; Copyright © 2021 Brice Waegeneire ;;; Copyright © 2021 Simon Tournier ;;; Copyright © 2022 Tobias Geerinckx-Rice +;;; Copyright © 2024 Lilah Tascheter +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -88,6 +90,7 @@ (define-module (guix scripts system) #:use-module (srfi srfi-37) #:use-module (ice-9 format) #:use-module (ice-9 match) + #:use-module (ice-9 receive) #:use-module (rnrs bytevectors) #:export (guix-system read-operating-system @@ -375,60 +378,39 @@ (define (switch-to-system-generation store spec) (activate (string-append generation "/activate"))) (if number (begin - (reinstall-bootloader store number) + (install-bootloader-from-provenance store number) (switch-to-generation* %system-profile number) (unless-file-not-found (primitive-load activate))) (leave (G_ "cannot switch to system generation '~a'~%") spec)))) -(define* (system-bootloader-name #:optional (system %system-profile)) - "Return the bootloader name stored in SYSTEM's \"parameters\" file." - (let ((params (unless-file-not-found - (read-boot-parameters-file system)))) - (boot-parameters-bootloader-name params))) - -(define (reinstall-bootloader store number) - "Re-install bootloader for existing system profile generation NUMBER. -STORE is an open connection to the store." - (let* ((generation (generation-file-name %system-profile number)) - ;; Detect the bootloader used in %system-profile. - (bootloader (lookup-bootloader-by-name (system-bootloader-name))) - - ;; Use the detected bootloader with default configuration. - ;; It will be enough to allow the system to boot. - (bootloader-config (bootloader-configuration - (bootloader bootloader))) - - ;; Make the specified system generation the default entry. - (chosen-alternative (generation->boot-alternative - %system-profile number)) - (params (boot-alternative-parameters chosen-alternative)) - (locale (boot-parameters-locale params)) - (store-crypto-devices (boot-parameters-store-crypto-devices params)) - (store-directory-prefix - (boot-parameters-store-directory-prefix params)) - (old-generations - (delv number (reverse (generation-numbers %system-profile)))) - (previous-boot-alternatives (profile->boot-alternatives - %system-profile old-generations)) - (entries (list (boot-parameters->menu-entry params))) - (old-entries (map boot-alternative->menu-entry - previous-boot-alternatives))) +(define (install-bootloader-from-os store number os) + "Re-install an old bootloader defined in record OS, +for system profile generation NUMBER, with store STORE." + (let* ((os (read-operating-system os)) + (bootloader-config (operating-system-bootloader os)) + (numbers (generation-numbers %system-profile)) + (numbers (delv number (reverse numbers))) + (old (profile->boot-alternatives %system-profile numbers)) + (bootcfg (operating-system-bootcfg os old))) (run-with-store store - (mlet* %store-monad - ((bootcfg (lower-object - ((bootloader-configuration-file-generator bootloader) - bootloader-config entries - #:locale locale - #:store-crypto-devices store-crypto-devices - #:store-directory-prefix store-directory-prefix - #:old-entries old-entries))) - (drvs -> (list bootcfg))) + (mlet* %store-monad ((bootcfg (lower-object bootcfg)) + (drvs -> (list bootcfg))) (mbegin %store-monad (built-derivations drvs) ;; Only install bootloader configuration file. (install-bootloader local-eval bootloader-config bootcfg #:run-installer? #f)))))) +(define (install-bootloader-from-provenance store number) + "Re-install an old bootloader using provenance data for system profile +generation NUMBER with store STORE." + (receive (_ os) + (system-provenance (generation-file-name %system-profile number)) + (if os + (install-bootloader-from-os store number os) + (leave (G_ "cannot rollback to generation '~a': no provenance~%") + number)))) + ;;; ;;; Graphs. @@ -1387,10 +1369,11 @@ (define (process-command command args opts) (let ((pattern (match args (() #f) ((pattern) pattern) - (x (leave (G_ "wrong number of arguments~%")))))) + (_ (leave (G_ "wrong number of arguments~%"))))) + (number (generation-number %system-profile))) (with-store* store (delete-matching-generations store %system-profile pattern) - (reinstall-bootloader store (generation-number %system-profile))))) + (install-bootloader-from-provenance store number)))) ((switch-generation) (let ((pattern (match args ((pattern) pattern) From patchwork Thu Sep 26 10:09:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31504 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 3DE6827BBEA; Thu, 26 Sep 2024 11:12:59 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C4BED27BBE2 for ; Thu, 26 Sep 2024 11:12:58 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTK-0002za-NA; Thu, 26 Sep 2024 06:11:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTH-0002xU-Sq for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:39 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTH-0007Pj-GU; Thu, 26 Sep 2024 06:11:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=WHUatHCEKa7jz6Gfk1bYsIZYqcMbf7e0yhQ/cl/jGpE=; b=OwzAEQJNQSGBH/IvXNgwukX1UapW3qxtwYhgGhMrAGXOQCsgjBGyRTZZaqFZ6mrDF2FkQEv4x+y+IYMX9vjXYXEkVZMZuy9ZCqs5zAP/k+vUgNxrW/5rkg4V0nBIwlnPKZYuxYZ2O/j32T7VSeSCQw3S4SoW1VjfXWZ8lCJif2fU+jilMCYN0TOpeqkcXtEP5//Ycz0RlnftLlgKnx28nfyjtI61whxnXn0ND33ikHV+Skndtdn/4Iueh2mFZvU+LjbA1ocxzAmyvO9URtD5q3lWUxtadCm/MWyCe2N7wSbdipvqE4b2VS/pkfibe78dAobfuZng2XmUDP/LqGHl8w==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTg-0003UP-PF; Thu, 26 Sep 2024 06:12:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 06/14] guix: utils: Add flatten and flat-map from haunt. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734548813259 (code B ref 73202); Thu, 26 Sep 2024 10:12:04 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:28 +0000 Received: from localhost ([127.0.0.1]:55493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT5-0003Rg-Jp for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:27 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:53171 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSy-0003PN-Av for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WHUatHCEKa7jz6Gfk1bYsIZYqcMbf7e0yhQ/cl/jGpE=; b=jA2rOqcgFQ8XX0jzW8cUH4iuSav+kEPsioL9/L8t/FpAJtwimJJHuVJPVhLa1Rl3Ej1zlU K6tIKhdyXsGOvb7wVy93FziPNLeVeYBY0HeqgT0YB/cmPo0k6iOyKrdn364J6iolonahN9 CRKQ1+2PjfB8Cex7gH2uaqaJ85IBuJk2edEMPLZLYgvP1C82594pt5Jg/PyErpZ8VU27pP keNrugRrwP0yTFjwKJhu0g8uRcj1LcCC1b9a6NfaHCVGvsZBIBPkcR4xwGxPmBra1xxsM1 j5nI+1H7h/GuxD/dhpPXoAcIdYDcTt0LdQV3iEmn9U8GOagcQPTJv3RJe06i6Q== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 972bb699 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <73202@debbugs.gnu.org>; Thu, 26 Sep 2024 10:10:39 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:03 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/utils.scm (flatten, flat-map): Add procedures. Change-Id: I1d7d49fd02115e3de09ed69bcf5f55a10423162e --- guix/utils.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/guix/utils.scm b/guix/utils.scm index f161cb4ef3..2740552a75 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -139,6 +139,9 @@ (define-module (guix utils) with-environment-variables arguments-from-environment-variable + flatten + flat-map + config-directory cache-directory @@ -1028,6 +1031,29 @@ (define (with-atomic-file-output file proc) (false-if-exception (delete-file template)) (close-port out))))) +;; TODO: bring over other utility procedures from (haunt utils). +(define* (flatten lst #:optional depth) + "Return a list that recursively concatenates the sub-lists of LST, +up to DEPTH levels deep. When DEPTH is #f, the entire tree is +flattened." + (if (and (number? depth) (zero? depth)) + lst + (fold-right (match-lambda* + (((sub-list ...) memo) + (append (flatten sub-list (and depth (1- depth))) + memo)) + ((elem memo) + (cons elem memo))) + '() + lst))) + +(define (flat-map proc . lsts) + "Apply PROC to each element of each list in LSTS and return a new +list in which nested lists are concatenated into the result. + +For example, the list (1 2 (3)) would be flattened to (1 2 3)." + (flatten (apply map proc lsts) 1)) + (define* (xdg-directory variable suffix #:key (ensure? #t)) "Return the name of the XDG directory that matches VARIABLE and SUFFIX, after making sure that it exists if ENSURE? is true. VARIABLE is an From patchwork Thu Sep 26 10:09:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31498 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 F103127BBEA; Thu, 26 Sep 2024 11:12:47 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 656A527BBE2 for ; Thu, 26 Sep 2024 11:12:47 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTL-0002zj-GG; Thu, 26 Sep 2024 06:11:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTI-0002xk-A0 for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:40 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTH-0007Pz-Vy; Thu, 26 Sep 2024 06:11:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=Ksd+i868hihOoO9MvHLHSaGEWwZMK+WYjJjURZIdch0=; b=HXK0MXymK7g3VF7pV9tvi8/9lyF09ILjkiK4EC6yFNdv307G/olS2YEWREfRQwe/0eNPAHdac12tW0kEIVVLD407Fg2HHaxAE/ehXnqW9wpsxb3J/DF7JWeIkn40VI1EngIGRfpLxD7xTFA8/BTTan+9K72yNKolVlxSeROHYxxUBF0XYPsvLAhUQQM0WUEgEP+LPck6N2gqFCtMpQnb5gZkiSEq4cZQMoCHpRuk74EaN/wjMS0fPC22De1iQqOYVjoinzZFc35tNrwCDU0SPZ5TM9aBzFdcPaSni6uHwidU8ksrLN+o5wY0DmJIePL6ZJEgZjcblvmkcIELWS2VKw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTh-0003Uc-86; Thu, 26 Sep 2024 06:12:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 07/14] guix: records: Add wrap-element procedure. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734548813265 (code B ref 73202); Thu, 26 Sep 2024 10:12:05 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:28 +0000 Received: from localhost ([127.0.0.1]:55495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT6-0003Rp-2w for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:28 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39475 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSy-0003PA-Mq for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ncPhGvvLij3mJW3Pl60KSTuVhclk2lIYNppvNs/WgWk=; b=QHT2qpjnwJh4I5ULA9c4aYGuJIVl1+Q5oYar3Yv0gHGE0/3/lXBk3HD2UxfilBPuXqCnkB s3FlxA3r0xC2huFPsrWfSbpBokNBhWICtkQx4hUCgi5lkdlOGLByGJEbWydVnAsWsJfaQL dntFX2zxv4RxRxsiq9y5WbJAgx6acG8lUIkYhN9tqi8OpCVU6Wnqvii4A/ALKGKQuNICg3 9fliJ+JL8h5f7QhchUesQDy1FF3KPny9aUQiSJfsqF7OmShZh5NBIMOAaIit7Uu7k9LjCo 7PeG7wW3jCOvqEi2agt3PgUT9OnkEQVXE1GGaEleIEUODyGDgKNlYVCdvJcHhQ== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 1a999e53 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <73202@debbugs.gnu.org>; Thu, 26 Sep 2024 10:10:39 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:04 +0200 Message-ID: <016d2352f78fa879b32d3794f74082fadfe89285.1727345067.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/records.scm (wrap-element): Add procedure. Change-Id: If121c5d856e815776830282a0701a73e5ae2a7e7 --- guix/records.scm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/guix/records.scm b/guix/records.scm index c084441441..b521a59257 100644 --- a/guix/records.scm +++ b/guix/records.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012-2024 Ludovic Courtès ;;; Copyright © 2018 Mark H Weaver +;;; Copyright © 2024 Lilah Tascheter ;;; ;;; This file is part of GNU Guix. ;;; @@ -31,6 +32,8 @@ (define-module (guix records) alist->record object->fields recutils->alist + wrap-element + match-record match-record-lambda)) @@ -606,6 +609,10 @@ (define (recutils->alist port) (else (error "unmatched line" line)))))))) +(define (wrap-element x) + "Sanitize a record field value X to a list." + (if (list? x) x (list x))) + ;;; ;;; Pattern matching. From patchwork Thu Sep 26 10:09:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31500 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 E0AE827BBEA; Thu, 26 Sep 2024 11:12:49 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CFF5627BBE2 for ; Thu, 26 Sep 2024 11:12:48 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTI-0002xr-EC; Thu, 26 Sep 2024 06:11:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTH-0002xI-5i for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:39 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTG-0007PT-SS; Thu, 26 Sep 2024 06:11:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=l5rNuJOD6zluhgdl6fBRO8pUfoQpElxldvIzeyjEXkY=; b=u/s7wcsoPSoQaFN2V1/6hbgFyRuOkX1jmUuTbRqdwFNNMkOv3gL0J3BDUu3mvOVvPBdZxPlH4V/EPxctFSCtgJhxGIISJ62J2Fa7zDHNbIUZ9DtO3qCs0ioIMfOu5oIauFUCin88qsOQ6OcAfmYWDafmOMxzH1B+0XqEuivPChZ5+k3px1nU3EgE765IUHgixFbF7nXvncQ4bMDABND1Ibj5vd2ZZUQnxnRT15Yq01gC/fKWSboGeUqO03xa4m+YdQQomUmr1HAE0Fp2YKFsB9DWNdGE0yFFG4qTclHUOiXGArAHWOy6XHziPd35+n8IpJMIgXdUMkzbBWqLffYRvQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTh-0003Un-Px; Thu, 26 Sep 2024 06:12:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 08/14] gnu: bootloader: Add bootloader-target record and infastructure. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, lilah@lunabee.space, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter , Christopher Baines , Josselin Poiret , Lilah Tascheter , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Lilah Tascheter , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734550513303 (code B ref 73202); Thu, 26 Sep 2024 10:12:05 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:45 +0000 Received: from localhost ([127.0.0.1]:55498 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlTM-0003ST-GT for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:45 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:53171 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSz-0003PN-3Q for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uo7S4ucruDPB9WMbXGJxtKmL+muhmw/dHd4Iz8LonXI=; b=nqtLLVHw7MEsJMktcC1FVDCFandxYnFiAOcNsej9p5aiEkRmaevEj8g7TlPwIyY8m8Ufep HXrEpJef54ToX3BNw07dHJaC3zrrTsSAbFpRQ03x2I2BjrVZaPNpceePFGBk6a9CyYAMMI Q6T1rWhDXcjp8Y4dv2r0iW58wUTeAKI1eSVjozcnPxZDdPLg3EMf77XEifviJL7VDRAsPf MaqJQyAbc0XmWbrx3ToWmbW4qcXoGy8hjsizVUR21jGm/dHIHRHt9rxUOSv1TmOYEtyyDy sLydgDcWspMUmb3D5A8l/Cu4NthQFvqFXTKCA8+FC8A4ccujl+thLHd3xuld0A== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id b097df94 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:40 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:05 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter * gnu/bootloader.scm (bootloader-target): New record. (&target-error): New condition. (pathcat, get-target-of-type, parent-of, unfold-pathcat, target-base?, type-major?, ensure, ensure-target-types, ensure-majors, gbegin): New procedures. (define-literal, with-targets, :path, :devpath, :device, :fs, :label, :uuid): New macros. * guix/ui.scm (call-with-error-handling)[target-error?]: Handle target-errors. Change-Id: I3f07c9096dd8b91c04449b6360b3b7d21640da14 --- gnu/bootloader.scm | 229 ++++++++++++++++++++++++++++++++++++++++++++- guix/ui.scm | 9 ++ 2 files changed, 233 insertions(+), 5 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 3ea50a4004..0c24996205 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2022 Josselin Poiret ;;; Copyright © 2022 Reza Alizadeh Majd ;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz> +;;; Copyright © 2024 Lilah Tascheter ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,19 +25,28 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu bootloader) + #:autoload (gnu build file-systems) + (read-partition-label read-partition-uuid + find-partition-by-label find-partition-by-uuid) #:use-module (gnu system file-systems) #:use-module (gnu system uuid) - #:use-module (guix gexp) - #:use-module (guix profiles) - #:use-module (guix records) + #:autoload (guix build syscalls) + (mounts mount-source mount-point mount-type) #:use-module (guix deprecation) - #:use-module ((guix ui) #:select (warn-about-load-error)) #:use-module (guix diagnostics) + #:use-module (guix gexp) #:use-module (guix i18n) + #:use-module (guix modules) + #:use-module (guix profiles) + #:use-module (guix records) + #:use-module (guix utils) + #:use-module (ice-9 match) + #:use-module (ice-9 receive) + #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) - #:use-module (ice-9 match) #:export (menu-entry menu-entry? menu-entry-label @@ -62,6 +72,25 @@ (define-module (gnu bootloader) bootloader-configuration-file bootloader-configuration-file-generator + bootloader-target + bootloader-target? + bootloader-target-type + bootloader-target-expected? + bootloader-target-path + bootloader-target-offset + bootloader-target-device + bootloader-target-file-system + bootloader-target-label + bootloader-target-uuid + + target-error? + target-error-type + target-error-targets + + gbegin + :path :devpath :device :fs :label :uuid + with-targets + bootloader-configuration bootloader-configuration? bootloader-configuration-bootloader @@ -232,6 +261,196 @@ (define-record-type* (configuration-file bootloader-configuration-file) (configuration-file-generator bootloader-configuration-file-generator)) + +;;; +;;; Bootloader target record. +;;; + +;; represents different kinds of targets in a +;; normalized form. + +(define-record-type* + bootloader-target make-bootloader-target bootloader-target? + (type bootloader-target-type) ; symbol + (expected? bootloader-target-expected? (default #f)) ; bool + + (path bootloader-target-path (default #f)) ; string|#f + (offset bootloader-target-offset (thunked) ; symbol|#f + (default (and (bootloader-target-path this-record) + (not (eq? (bootloader-target-type this-record) 'root)) + 'root))) + (device bootloader-target-device (default #f)) ; string|#f + (file-system bootloader-target-file-system (default #f)) ; string|#f + (label bootloader-target-label (default #f)) ; string|#f + (uuid bootloader-target-uuid (default #f))) ; uuid|#f + +(define-condition-type &target-error &error target-error? + (type target-error-type) + (targets target-error-targets)) + +(define (pathcat p1 p2) + (string-append (string-trim-right p1 #\/) "/" (string-trim p2 #\/))) + +(define* (get-target-of-type type targets #:optional require?) + "Finds a target in TARGETS of type TYPE, returns REQUIRE? if #false, +or provides an error otherwise." + (define (type? target) + (eq? type (bootloader-target-type target))) + (match (filter type? targets) + ((target _ ...) target) + (_ (and require? + (raise + (condition + (&message (message (G_ "required, but not provided"))) + (&target-error (type type) (targets targets)))))))) + +(define (parent-of target targets) + "Resolve the parent of TARGET in TARGETS, return #f if orphan." + (and=> (bootloader-target-offset target) + (cut get-target-of-type <> targets #t))) + +(define (unfold-pathcat target targets) + "Find the full VFS path of TARGET." + (let ((quit (lambda (t) (not (and=> t bootloader-target-path)))) + (parent-of (cut parent-of <> targets))) + (reduce pathcat #f + (unfold quit bootloader-target-path parent-of target)))) + +(define (target-base? t) + (or (not t) (match-record t + (expected? offset device label uuid) + (or device label uuid (not offset) expected?)))) + +(define (type-major? target) (memq target '(root esp disk))) + +(define (ensure types targets end) + (let* ((used-in (cute unfold end identity (cut parent-of <> targets) <>)) + (cons-in (lambda (t) (cons t (used-in t)))) + (ensure (map (cut get-target-of-type <> targets #t) types))) + (filter identity (apply append (map cons-in ensure))))) + +(define* (ensure-target-types types targets #:optional (base? #f)) + "Ensures all TYPES are provided in TARGETS. Returns #t iff every ensured +target and its requirements are fully provided. Errors out when a required TYPE +isn't provided. When BASE?, only ensure path requirements up to a device." + (not (any bootloader-target-expected? + (ensure types targets (if base? target-base? not))))) + +(define (ensure-majors types targets) + "Errors out when a required TYPE isn't provided, or when use of multiple major +targets is detected." + (let* ((all (map bootloader-target-type (ensure types targets target-base?))) + (majors (delete-duplicates (filter type-major? all) eq?))) + (if (< (length majors) 2) #t + (raise (condition (&message (message (G_ "multiple major targets used"))) + (&target-error (type majors) (targets targets))))))) + + + +(define (gbegin . gex) + "Sequence provided g-expressions." + (case (length gex) ((0) #f) ((1) (car gex)) (else #~(begin #$@gex)))) + +;; syntax matching on free literals breaks easily, so bind them +(define-syntax-rule (define-literal id) (define-syntax id (syntax-rules ()))) +(define-literal :path) +(define-literal :devpath) +(define-literal :device) +(define-literal :fs) +(define-literal :label) +(define-literal :uuid) + +(define-syntax with-targets + (cut syntax-case <> () + ((_ targets-expr block ...) + (let* ((genvars (compose generate-temporaries make-list)) + (targets (car (genvars 1)))) + (define (resolve in target base) + (with-syntax ((target target) (base base) (targets targets)) + (syntax-case in + (:path :devpath :device :fs :label :uuid) + ((name _) (not (identifier? #'name)) + #`(_ (syntax-error "binds must be to identifiers" #,in))) + ((name :device) #'(name (bootloader-target-device base))) + ((name :label) #'(name (bootloader-target-label base))) + ((name :uuid) #'(name (bootloader-target-uuid base))) + ((name :fs) #'(name (bootloader-target-file-system base))) + ((name :path) #'(name (unfold-pathcat target targets))) + ((name :devpath) + #'(name (if (target-base? target) + "/" + (pathcat "/" (bootloader-target-path target))))) + (_ #`(_ (syntax-error "invalid binding spec" #,in)))))) + + (define (binds spec) + (syntax-case spec (=>) + ((type => binds ...) + (with-syntax (((target base) (genvars 2)) (targets targets)) + (append + #`((get (lambda (t) (get-target-of-type t targets #t))) + (target (get type)) + (base (if (target-base? target) + target + (get (bootloader-target-offset target))))) + (map (cut resolve <> #'target #'base) #'(binds ...))))) + (_ #f))) + + (define blocks + (cut syntax-case <> () + ((spec ... expr) + (let* ((path? (cut syntax-case <> (:path) ((_ :path) #t) (_ #f))) + (qualified? (cut syntax-case <> (=>) + ((_ => spec ...) (any path? #'(spec ...))) + (_ #f))) + (specs #'(spec ...)) + (lets (apply append (filter-map binds specs))) + (type (cut syntax-case <> (=>) + ((t => _ ...) #'t) (t #'t)))) + (receive (full part) (partition qualified? specs) + #`(and (ensure-majors (list #,@(map type specs)) #,targets) + (ensure-target-types (list #,@(map type part)) + #,targets #t) + (ensure-target-types (list #,@(map type full)) + #,targets #f) + (let* #,lets expr))))) + (bad #'(syntax-error "malformed block" bad)))) + "Using the list TARGETS, evaluate and sequence each BLOCK to produce a +gexp. BLOCK is a set of SPECs followed by an EXPR (evaluating to a gexp). +Each SPEC denotes a type of target to guard EXPR on their existance and +full-qualification. This procedure is linear in regard to BLOCKs. + +SPEC may be of the following forms: +@itemize +@item 'TYPE Requires TYPE to be fully present or promised. Errors otherwise. +@item ('TYPE => (VAR COMPONENT) ...): As type, but also binds variables. TYPE's + COMPONENT is bound to the variable VAR as described below. +@end itemize + +Available COMPONENTs are: +@itemize +@item :path (fully-qualified) +@item :devpath (relative from device) +@item :device (auto-detected from uuid and label if not user-provided) +@item :fs +@item :label +@item :uuid +@end itemize + +Note that installers may be called multiple times with different targets being +fully-qualified. To ensure that targets aren't installed multiple times, make sure +that each BLOCK ensures at least one major target, either directly or indirectly. +Likewise, at most one major target should be ensured per BLOCK, under the same +conditions. Major targets originate from disk image handling, and are currently: +@itemize +@item disk +@item root +@item esp +@end itemize" + #`(let ((#,targets targets-expr)) + (apply gbegin (filter identity + (list #,@(map blocks #'(block ...)))))))) + (bad #'(syntax-error "must provide targets" bad)))) + ;;; ;;; Bootloader configuration record. diff --git a/guix/ui.scm b/guix/ui.scm index fe059ba089..663b814da6 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -19,6 +19,7 @@ ;;; Copyright © 2018 Steve Sprang ;;; Copyright © 2022 Taiju HIGASHI ;;; Copyright © 2022 Liliana Marie Prikler +;;; Copyright © 2024 Lilah Tascheter ;;; ;;; This file is part of GNU Guix. ;;; @@ -36,6 +37,8 @@ ;;; along with GNU Guix. If not, see . (define-module (guix ui) ;import in user interfaces only + #:use-module ((gnu bootloader) + #:select (target-error? target-error-type target-error-targets)) #:use-module (guix i18n) #:use-module (guix colors) #:use-module (guix diagnostics) @@ -862,6 +865,12 @@ (define (call-with-error-handling thunk) (invoke-error-stop-signal c) (cons (invoke-error-program c) (invoke-error-arguments c)))) + ((target-error? c) + (leave (G_ "bootloader-target '~a'~@[: ~a~] ~ + among the following targets:~%~{~y~}") + (target-error-type c) + (and (message-condition? c) (condition-message c)) + (target-error-targets c))) ((formatted-message? c) (apply report-error From patchwork Thu Sep 26 10:09:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31492 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 B9B3827BBE9; Thu, 26 Sep 2024 11:12:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CBB5B27BBEB for ; Thu, 26 Sep 2024 11:12:08 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTJ-0002yU-4h; Thu, 26 Sep 2024 06:11:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTH-0002xQ-Lv for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:39 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTH-0007Ph-BQ for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=IJShaDk+nVvCcgJhpUHmyt7BkJueute34U1DFCvRRVc=; b=Ug3BqQG+RweF8LqdpaC+ZdAShRjhU+0AXPe/32eDzrxmUfId0BlJJLhr72FcOYhTusP/H9OGolG6egbSqSHjUvqGkKxohaJgBDNUukphKSwrwSRyqaOUGkAEr2PqTNLaJSyUL4u3DkHCyE1U1GJjZqaIt5cv5T+cV8wIxDW1xRz8vqDKo69VlB78bCuUEb8G9LlqVRGtIocfyIzDey8ceT1zqG8EQV01acymE7H/NobZNQU/7Z6P92oVG/P4Sgx8YMIclyIIjPmmZf9qlydDD+R271SKO8QOowi7Jax1bg5z4RG5E+eodNLa7CznEBvUllpMWTA7Wovtgi9p2gXlZw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTi-0003Uz-9d; Thu, 26 Sep 2024 06:12:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 09/14] gnu: bootloader: Add bootloader-configurations->gexp. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: lilah@lunabee.space, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter , Lilah Tascheter X-Debbugs-Original-Xcc: Lilah Tascheter Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734550613310 (code B ref 73202); Thu, 26 Sep 2024 10:12:06 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:46 +0000 Received: from localhost ([127.0.0.1]:55500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlTN-0003SW-El for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:45 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39475 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlSz-0003PA-Jv for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qBNIh/kScwIFDm4cVMybJISLgB15iFQHhIQqqC68N6I=; b=sLeo8E8sZ/0XupqHGNTwOgS9j4GP2M8oqJ68gB2baZjQ4u8xMSLZ/XFnHgOgIKI0sAfxqX gRM3hBTCs1gc+zYwIcSV1NxGJxuzCX9SUCeeXuWnusycxVupMvtVN2fz+HOBcSUAbjfXS4 jCZdolEzEsSkr7ov1mYsmhyL2RMGt6VPO+IRlnLBhtOx8UnmLb0zFQep+Vxv+4BsGMjvL9 x1ycxG6DD43br44DtfSYwJjueTDPngP54CCs3N4n9jFeHfaBLvHUBl1rnfE1hxTaJvcuz2 vD4GleQcslNuPQUK1fxWZunJAApE4QC3CJSfvJwCu9VL3c4o/cGh412Ldhwqew== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 03d74ee7 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:41 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:06 +0200 Message-ID: <2ce2a5d1b077a35dcfc95c707703f8c0a11bf3b2.1727345067.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter * gnu/bootloader.scm (bootloader)[default-targets]: Add field. (target-overrides, normalize, bootloader-configuration->gexp, bootloader-configurations->gexp): New procedures. Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739 --- gnu/bootloader.scm | 108 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 0c24996205..c77de6f55e 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -67,6 +67,7 @@ (define-module (gnu bootloader) bootloader? bootloader-name bootloader-package + bootloader-default-targets bootloader-installer bootloader-disk-image-installer bootloader-configuration-file @@ -107,6 +108,8 @@ (define-module (gnu bootloader) bootloader-configuration-device-tree-support? bootloader-configuration-extra-initrd + bootloader-configuration->gexp + bootloader-configurations->gexp efi-bootloader-chain)) @@ -255,6 +258,7 @@ (define-record-type* bootloader? (name bootloader-name) (package bootloader-package) + (default-targets bootloader-default-targets (default '())) (installer bootloader-installer) (disk-image-installer bootloader-disk-image-installer (default #f)) @@ -498,6 +502,110 @@ (define (bootloader-configuration-targets config) ;; hence the default value of '(#f) rather than '(). (list #f))) + +;;; +;;; Bootloader installation paths. +;;; + +(define (target-overrides . layers) + (let* ((types (flat-map (cute map bootloader-target-type <>) layers)) + ;; TODO: use loop instead of fold for early termination. + (pred (lambda (type layer found) + (or found (get-target-of-type type layer)))) + (find (lambda (type) (fold (cute pred type <> <>) #f layers)))) + (filter identity (map find (delete-duplicates types))))) + +(define (normalize targets) + "Augments TARGETS with filesystem information at runtime, allowing +users to specify a lot less information. Puts TARGETS into a normal +form, where each path is fully specified up to a device offset." + (define (mass m) + `((,(mount-source m) . ,m) + (,(mount-point m) . ,m))) + + (define (accessible=> d f) + (and d (access? d R_OK) (f d))) + + (define (fixuuid target) + (match-record target (uuid file-system) + (let ((type (cond ((not file-system) 'dce) + ((member file-system '("vfat" "fat32")) 'fat) + ((string=? file-system "ntfs") 'ntfs) + ((string=? file-system "iso9660") 'iso9660) + (else 'dce)))) + (bootloader-target (inherit target) + (uuid (cond ((uuid? uuid) uuid) + ((bytevector? uuid) (bytevector->uuid uuid type)) + ((string? uuid) (string->uuid uuid type)) + (else #f))))))) + + (define (arborify target targets) + (let* ((up (lambda (t) (and t (parent-of t targets)))) + (proto (unfold target-base? identity up (up target) list)) + (chain (reverse (cons target proto)))) + (bootloader-target + (inherit target) + (offset (and=> (car chain) bootloader-target-type)) + (path (reduce pathcat #f (map bootloader-target-path (cdr chain))))))) + + (let ((amounts (delay (apply append (map mass (mounts)))))) + (define (assoc-mnt f) + (lambda (v) (and=> (assoc-ref (force amounts) v) f))) + + (define (scrape target) + (match-record target + (expected? path offset device label uuid file-system) + (if expected? target + (bootloader-target + (inherit target) + (device (or device + (false-if-exception + (or (and=> uuid find-partition-by-uuid) + (and=> label find-partition-by-label))) + (and path ((assoc-mnt mount-source) + (unfold-pathcat target targets))))) + (label (or label (accessible=> device read-partition-label))) + (uuid (or uuid (accessible=> device read-partition-uuid))) + (file-system (or file-system (and=> device (assoc-mnt mount-type)))) + (offset (and path offset)) + (path (or path (and=> device (assoc-mnt mount-point)))))))) + + (let ((mid (map (compose fixuuid scrape) targets))) + (map (cut arborify <> mid) mid)))) + +(define* (bootloader-configuration->gexp bootloader-config args #:key + (root-offset "/") (overrides '())) + "Returns a gexp to install BOOTLOADER-CONFIG to its targets, passing ARGS +to each installer alongside the additional #:bootloader-config keyword +arguments. Target OVERRIDES are applied and all path targets have ROOT-OFFSET +applied. The following keyword arguments are expected in ARGS: +@enumerate +@item current-boot-alternative +@item old-boot-alternatives +@item locale (from bootmeta) +@item store-directory-prefix (from bootmeta) +@item store-crypto-devices (from bootmeta) +@end enumerate" + (let* ((bootloader (bootloader-configuration-bootloader bootloader-config)) + (installer (bootloader-installer bootloader)) + (auto-targets (list (bootloader-target + (type 'root) + (path root-offset) + (offset #f)))) + (targets (target-overrides + overrides + (bootloader-configuration-targets bootloader-config) + auto-targets + (bootloader-default-targets bootloader))) + (conf (bootloader-configuration + (inherit bootloader-config) + (targets (normalize targets))))) + (apply installer #:bootloader-config conf args))) + +(define (bootloader-configurations->gexp bootloader-configs . rest) + (apply gbegin (filter-map (cut apply bootloader-configuration->gexp <> rest) + bootloader-configs))) + ;;; ;;; Bootloaders. From patchwork Thu Sep 26 10:09:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31499 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 B400F27BBEA; Thu, 26 Sep 2024 11:12:48 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1094F27BBE2 for ; Thu, 26 Sep 2024 11:12:48 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTK-0002zc-WC; Thu, 26 Sep 2024 06:11:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTI-0002xh-96 for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:40 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTH-0007Px-Th for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=QJoHxVO8C/6UH6ICoo6AdFAwpNBVhW1OBOxGDYtZPB8=; b=qxxHmfhdMOGNJDpEJurBpuUA2v+9/iiP2T2N7Al535yzmh0JqmKNppDgaAOZj2nDvxt0gItty0TXBOihumnyr38XeLuDsLi5gUszagWlYI39mDE8wvKRDvQ/2kF+7GSAVr+tR+++12NrBZOBRid/4XwK8J+fy+UUnNROa3+cR5P9GVXe5kaSHlwDf6Tlw7DGAx5/DeYyZhGUY/lgLfohaHTAGeIki9L898ZlyliXlobkGetqZI2y2H97tZl5/dtXly0WOuRZ1ZeWkcWppK86PwGZhIvJnGTdkfnxzvy2BnAKEt56UdTs2Yp08XjLP2lUA1ERngFcczywKEb3/JFduQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTi-0003VD-QA; Thu, 26 Sep 2024 06:12:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 10/14] gnu: bootloader: Add device-subvol field to menu-entry record. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: lilah@lunabee.space, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter , Lilah Tascheter X-Debbugs-Original-Xcc: Lilah Tascheter Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734550613318 (code B ref 73202); Thu, 26 Sep 2024 10:12:06 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:46 +0000 Received: from localhost ([127.0.0.1]:55502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlTN-0003Sd-W5 for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:46 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:53171 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT0-0003PN-N9 for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0CaZ9OnPl3/7G2AVIzFTBFAwD5Y8HdNbaKxoXkEs1cA=; b=oHsBDNbo9zsYzY5wl6UGUWFYBDWzaMVU78yNAvX7nrvXzPzjTUPztp1HTlGaIgycYZkeC6 f/YEjFKUb9AWndNu8QnjSx2zwoNsOiX5XA0dz0sQI4+zHtYkRUhyONNNW4aqQ6rvts80iq +MNBkaPMVvQNGxPJH00ATf7rE4EB02XHOZzqbtIqOtpjzDYxZeWhHQQeO5sXkQDd0E2wLf 8FF14MHqLRl7xLcHzDd0CVW9Y4LbsBXxidGKq+phc/YmnVrKBc4P2kJguZCbdfBCIKDtv+ rUtxYdxMyGULTZNxHU0ZE+kR07qjTuKs3sYIrxNl67VUbEEDfdGL2natief0Mw== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 8c230017 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:41 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:07 +0200 Message-ID: <33b51456dc709d17c8be3776471e0599f83eaec1.1727345067.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter * gnu/bootloader.scm (menu-entry-device-subvol): Add and export field. (normalize-file): Add procedure. (device->sexp): Match device-subvol and include in S-expression. (sexp->menu-entry): Try match device-subvol and include in menu-entry. * gnu/system/boot.scm (boot-parameters->menu-entry): Add device-subvol value to menu-entry. Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739 --- gnu/bootloader.scm | 51 ++++++++++++++++++++++++++++++++++----------- gnu/system/boot.scm | 1 + 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index c77de6f55e..f1352122a9 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -51,15 +51,17 @@ (define-module (gnu bootloader) menu-entry? menu-entry-label menu-entry-device + menu-entry-device-mount-point + menu-entry-device-subvol menu-entry-linux menu-entry-linux-arguments menu-entry-initrd - menu-entry-device-mount-point menu-entry-multiboot-kernel menu-entry-multiboot-arguments menu-entry-multiboot-modules menu-entry-chain-loader + normalize-file menu-entry->sexp sexp->menu-entry @@ -126,6 +128,8 @@ (define-record-type* (default #f)) (device-mount-point menu-entry-device-mount-point (default #f)) + (device-subvol menu-entry-device-subvol + (default #f)) (linux menu-entry-linux (default #f)) (linux-arguments menu-entry-linux-arguments @@ -142,6 +146,18 @@ (define-record-type* (chain-loader menu-entry-chain-loader (default #f))) ; string, path of efi file +(define (normalize-file entry file) + "Normalize a file FILE stored in a menu entry into one suitable for a +bootloader. Realizes device-mount-point and device-subvol." + (match-menu-entry entry (device-mount-point device-subvol) + ;; Avoid using cut procedure from SRFI-26 inside G-exp. + (let ((mount (and=> device-mount-point (cut string-trim <> #\/)))) + #~(let* ((file (string-trim #$file #\/)) + (file (if (and #$mount (string-prefix? #$mount file)) + (substring file (string-length #$mount)) + file))) + (string-append (or #$device-subvol "") "/" file))))) + (define (report-menu-entry-error menu-entry) (raise (condition @@ -169,7 +185,7 @@ (define (menu-entry->sexp entry) `(label ,(file-system-label->string label))) (_ device))) (match entry - (($ label device mount-point + (($ label device mount-point subvol (? identity linux) linux-arguments (? identity initrd) #f () () #f) `(menu-entry (version 0) @@ -178,8 +194,9 @@ (define (menu-entry->sexp entry) (device-mount-point ,mount-point) (linux ,linux) (linux-arguments ,linux-arguments) - (initrd ,initrd))) - (($ label device mount-point #f () #f + (initrd ,initrd) + (device-subvol ,subvol))) + (($ label device mount-point subvol #f () #f (? identity multiboot-kernel) multiboot-arguments multiboot-modules #f) `(menu-entry (version 0) @@ -188,19 +205,23 @@ (define (menu-entry->sexp entry) (device-mount-point ,mount-point) (multiboot-kernel ,multiboot-kernel) (multiboot-arguments ,multiboot-arguments) - (multiboot-modules ,multiboot-modules))) - (($ label device mount-point #f () #f #f () () + (multiboot-modules ,multiboot-modules) + (device-subvol ,subvol))) + (($ label device mount-point subvol #f () #f #f () () (? identity chain-loader)) `(menu-entry (version 0) (label ,label) (device ,(device->sexp device)) (device-mount-point ,mount-point) - (chain-loader ,chain-loader))) + (chain-loader ,chain-loader) + (device-subvol ,subvol))) (_ (report-menu-entry-error entry)))) (define (sexp->menu-entry sexp) "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a record." + ;; XXX: The match ORs shadow subvol. + (define subvol #f) (define (sexp->device device-sexp) (match device-sexp (('uuid type uuid-string) @@ -213,35 +234,41 @@ (define (sexp->menu-entry sexp) ('label label) ('device device) ('device-mount-point mount-point) ('linux linux) ('linux-arguments linux-arguments) - ('initrd initrd) _ ...) + ('initrd initrd) + (or ('device-subvol subvol _ ...) (_ ...))) (menu-entry (label label) (device (sexp->device device)) (device-mount-point mount-point) + (device-subvol subvol) (linux linux) (linux-arguments linux-arguments) (initrd initrd))) (('menu-entry ('version 0) ('label label) ('device device) - ('device-mount-point mount-point) + ('device-mount-point mount-point) ('device-subvol subvol) ('multiboot-kernel multiboot-kernel) ('multiboot-arguments multiboot-arguments) - ('multiboot-modules multiboot-modules) _ ...) + ('multiboot-modules multiboot-modules) + (or ('device-subvol subvol _ ...) (_ ...))) (menu-entry (label label) (device (sexp->device device)) (device-mount-point mount-point) + (device-subvol subvol) (multiboot-kernel multiboot-kernel) (multiboot-arguments multiboot-arguments) (multiboot-modules multiboot-modules))) (('menu-entry ('version 0) ('label label) ('device device) - ('device-mount-point mount-point) - ('chain-loader chain-loader) _ ...) + ('device-mount-point mount-point) ('device-subvol subvol) + ('chain-loader chain-loader) + (or ('device-subvol subvol _ ...) (_ ...))) (menu-entry (label label) (device (sexp->device device)) (device-mount-point mount-point) + (device-subvol subvol) (chain-loader chain-loader))))) diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index 54e5673a54..98fcd2b3a0 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -328,6 +328,7 @@ (define (boot-parameters->menu-entry conf) (label (boot-parameters-label conf)) (device (boot-parameters-store-device conf)) (device-mount-point (boot-parameters-store-mount-point conf)) + (device-subvol (boot-parameters-store-directory-prefix conf)) (linux (and (not multiboot?) kernel)) (linux-arguments (if (not multiboot?) (boot-parameters-kernel-arguments conf) From patchwork Thu Sep 26 10:09:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31496 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 9FD9E27BBEA; Thu, 26 Sep 2024 11:12:29 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1463C27BBE2 for ; Thu, 26 Sep 2024 11:12:29 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTL-000308-Vb; Thu, 26 Sep 2024 06:11:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTI-0002yO-P1 for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:40 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTI-0007QU-EY for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=IwjQq7hXMawzHIjFS9OpHeTFeaptK6HMgCh8qwZAyV8=; b=kMS6vfzqE06vuF2H3OWJ/+oRMP5C2fJV6bFidsXEeJIQZnge3mPZ4R7tjzXI7Kfga7J7I+DGlmPUm03pFoCcf/aHK7ecxqxdLcOY4Zn2K8GnMjc9Nes+fRMF+23d9wy7B7dzoHgZovuPd4vHo7kQ5xOxkvVMo1ISmDm4pUdEIbj3y7hgP0Wr7j1rgw6RNRpcwQh6UQzFmO6VH/VTBEVWRa+W4H9J21Syl5xHGNCslHnb0+tccuqkXGeX45WW3I6od1CuNZoYfAW+I/IM7qGOAskVWFZn5xVtBaTjZAGz3XPhfNfPedbbV/vCf36btfgHI0eIYEEpOiepS5wfe6cFDw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTj-0003VQ-D0 for guix-patches@gnu.org; Thu, 26 Sep 2024 06:12:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 11/14] gnu: build: bootloader: Add efi-bootnums procedure. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734550713325 (code B ref 73202); Thu, 26 Sep 2024 10:12:07 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:47 +0000 Received: from localhost ([127.0.0.1]:55504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlTO-0003Sl-Ic for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:47 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39475 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT1-0003PA-UU for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ahYOiYejvGUtNAnSjkb6HMGrj1pd/GqjJ61kZBWbi9A=; b=kU3dDqEfP9KtYV9MUCOVtlUrxaVlbzJapexMpfSVIGQ0VhImnM4V7amipd9ZyXbz7wKk5B Y9xZWmgLx53/R5xplTki+yq0Gtp4xd056SnNydyML//gj/Ys7n5I+Et1fPShUuk8rASITK GxXSjOhA/mXCCXAOR+nthleF82d1QSd6vc0PweF9OIHnvmggTKtV4hLnAFupN73vMK5kMN 55tqzboXThqYyYtpKSE4pf/SU4qXRKHnmYFiE36QBkcO4rA7cxZXwJsmpdlFvuwPeL7JYE 1jymYI4l/Y8TmV9/cT1tEJ0f//8pXYtEvxkPSdsiajPg/S+EJIUUnXNttYw7wA== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id fa5314c6 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:42 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:08 +0200 Message-ID: <3063da96c7b9dc3db63dbc96d2238f6ed742b857.1727345067.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter * gnu/build/bootloader.scm (atomic-copy, efi-bootnums): Add procedures. (in-temporary-directory): Add macro. Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739 --- gnu/build/bootloader.scm | 48 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/gnu/build/bootloader.scm b/gnu/build/bootloader.scm index af6063a884..3934e03aee 100644 --- a/gnu/build/bootloader.scm +++ b/gnu/build/bootloader.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2019 Ludovic Courtès ;;; Copyright © 2022 Denis 'GNUtoo' Carikli ;;; Copyright © 2022 Timothy Sample +;;; Copyright © 2024 Lilah Tascheter ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,13 +21,25 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu build bootloader) + #:autoload (guix build syscalls) (free-disk-space) #:use-module (guix build utils) #:use-module (guix utils) #:use-module (ice-9 binary-ports) + #:use-module (guix diagnostics) + #:use-module (guix i18n) #:use-module (ice-9 format) + #:use-module (ice-9 match) + #:use-module (ice-9 popen) + #:use-module (ice-9 receive) + #:use-module (ice-9 regex) #:use-module (rnrs io ports) #:use-module (rnrs io simple) - #:export (write-file-on-device + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:use-module (srfi srfi-35) + #:export (atomic-copy + in-temporary-directory + write-file-on-device install-efi-loader)) @@ -34,6 +47,21 @@ (define-module (gnu build bootloader) ;;; Writing utils. ;;; +(define (atomic-copy from to) + (let ((pivot (string-append to ".new"))) + (copy-file from pivot) + (rename-file pivot to))) + +(define-syntax-rule (in-temporary-directory blocks ...) + "Run BLOCKS while chdir'd into a temporary directory." + ;; Under POSIX.1-2008, mkdtemp must make the dir with 700 perms. + (let* ((tmp (or (getenv "TMPDIR") "/tmp")) + (dir (mkdtemp (string-append tmp "/guix-bootloader.XXXXXX"))) + (cwd (getcwd))) + (dynamic-wind (lambda () (chdir dir)) + (lambda () blocks ...) + (lambda () (chdir cwd) (delete-file-recursively dir))))) + (define (write-file-on-device file size device offset) "Write SIZE bytes from FILE to DEVICE starting at OFFSET." (call-with-input-file file @@ -56,6 +84,24 @@ (define (write-file-on-device file size device offset) ;;; EFI bootloader. ;;; +;; XXX: Parsing efibootmgr output may be kinda jank. A better way may exist. +(define (efi-bootnums efibootmgr) + "Returns '(path . bootnum) pairs for each EFI boot entry. bootnum is +a string, and path is backslash-deliminated and relative to the ESP." + (let* ((pipe (open-pipe* OPEN_READ efibootmgr)) + (text (get-string-all pipe)) + (status (status:exit-val (close-pipe pipe))) + (bootnum-pattern + "^Boot([0-9a-fA-F]+).*[^A-Za-z]File\\(([^)]+)\\)$")) + (unless (zero? status) + (raise-exception + (formatted-message (G_ "efibootmgr exited with error code ~a") status))) + (fold-matches (make-regexp bootnum-pattern regexp/newline) text '() + (lambda (match acc) + (let* ((path (match:substring match 2)) + (bootnum (match:substring match 1))) + (cons (cons path bootnum) acc)))))) + (define* (install-efi grub grub-config esp #:key targets) "Write a self-contained GRUB EFI loader to the mounted ESP using GRUB-CONFIG. From patchwork Thu Sep 26 10:09:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31502 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 9348027BBE2; Thu, 26 Sep 2024 11:12:53 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1CC7627BBE2 for ; Thu, 26 Sep 2024 11:12:51 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTO-000314-7b; Thu, 26 Sep 2024 06:11:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTL-0002zd-8N for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:43 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTK-0007R7-VY; Thu, 26 Sep 2024 06:11:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=gsi9MidD/Q/qYzrV/1380WC9VquOgjQm68ObUKt3yPU=; b=R9sCsS7cQUt+r6pZvyRgs52oNptIdCBCaG7HjrZBEFsoU8HSQNf2DlPNSPFcZlF6JNuxhw6STcDUhJWBG2mp7eOWHek0stjkqRIcyKAN8Y2bCn52ZkqPDu5SDVQxNqYoQpzhB8GtxmJcOCaC6xB6x2WB0aerTWZBQdedeG/EL70CLdBGruLKHzBE5cf8jmhh+Q6FcynS9r0ez1EtsxHFokmKVHi+6yfLEr6vkY5vqI24zu41BzdjfBUG+v9J6oKQt5ndgcfOeHUIIxT/jW3EPFSTsM6Y/QY5qZBoTUImrSCCfBgkw0iAZmEAcb3nLyBQ0QrLOTcplfGKgei1NxI1cg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTk-0003Vq-U6; Thu, 26 Sep 2024 06:12:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 12/14] gnu: bootloader: Install any bootloader to ESP. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: pelzflorian@pelzflorian.de, lilah@lunabee.space, ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter , Florian Pelz , Lilah Tascheter , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Florian Pelz , Lilah Tascheter , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734551213352 (code B ref 73202); Thu, 26 Sep 2024 10:12:08 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:52 +0000 Received: from localhost ([127.0.0.1]:55510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlTS-0003TA-U5 for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:52 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:53171 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT2-0003PN-0w for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=csNazSvP3ae1xauuntLPk/lAGEr/O6mK3d5r2OhmmqI=; b=mAYY/1tynbY055e7KTID/PFS3KFYw1pgTvt15TdrKa1APm4v9iSBlOS7k85oREvCydM8YR 2MUTYDFfZ4bwwwggT/hlXAJy0SbSTXtrxLJoahRoqhzn6yggISENFkDAKHDSD/JCjoguLR Z/9PivdlCbHbT8tPhDUb8g4mbzuygQ0a4RWMzGFUG3yOGmVuFBRKq9yZ/9lcOBvoZWgUFf uixYWdKKoOcGD5IB5jdy8S8WaOV+5Y6oDn6+y7mrpBzyrk4HQ720L0CnP3SubKTE5wt2Y7 2IHnWKPnVsk+W6sonbW2bY7SVVu3x0YA1MVZh8W1P8pkhE/aUJiSlmX5GWKLog== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id d85f1347 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:42 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:09 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter * gnu/bootloader.scm (efi-arch, install-efi): New procedures. (%efi-supported-systems, lazy-efibootmgr): New variables. (bootloader-configuration)[efi-removable?, 32bit?]: New fields. (match-bootloader-configuration, match-menu-entry): New macros. * gnu/build/bootloader.scm (install-efi-loader): Delete procedure. (install-efi): Rewrite to support installation of any efi bootloader. * gnu/build/image.scm (initialize-efi32-partition): Deprecate. (initialize-efi-partitition): Only create EFI directory. * gnu/image.scm (partition)[target]: New field in order to support dynamic provision of image partitions as bootloader targets. * gnu/system/image.scm (root-partition, esp-partition): Use target field. * gnu/system/image.scm (esp32-partition, efi32-disk-partition, efi32-raw-image-type): Deprecate. * doc/guix.texi (Creating System Images)[image Reference]: Add target field. [Instantiate an Image]: Update examples and update formatting. : Delete. : Reword slightly. Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739 --- doc/guix.texi | 34 ++++++------ gnu/bootloader.scm | 56 ++++++++++++++++++- gnu/build/bootloader.scm | 115 ++++++++++++++++++++------------------- gnu/build/image.scm | 23 ++------ gnu/image.scm | 4 ++ gnu/system/image.scm | 22 +++----- 6 files changed, 150 insertions(+), 104 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 38a4650977..2f6d72f793 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -130,6 +130,7 @@ Copyright @copyright{} 2024 Dariqq@* Copyright @copyright{} 2024 Denis 'GNUtoo' Carikli@* Copyright @copyright{} 2024 Fabio Natali@* +Copyright @copyright{} 2024 Lilah Tascheter@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -48163,6 +48164,12 @@ partition Reference this flag set, usually the root one. The @code{'esp} flag identifies a UEFI System Partition. +@item @code{target} (default: @var{#f}) +If provided, this partition provides itself as a bootloader target +(@pxref{Bootloader Configuration}). Most commonly, this is used to provide the +@code{'root} and @code{'esp} targets, with the root partition and EFI System +Partition, respectively, though this can provide any target necessary. + @item @code{initializer} (default: @code{#false}) The partition initializer procedure as a gexp. This procedure is called to populate a partition. If no initializer is passed, the @@ -48211,6 +48218,7 @@ Instantiate an Image (label "GNU-ESP") (file-system "vfat") (flags '(esp)) + (target 'esp) (initializer (gexp initialize-efi-partition))) (partition (size (* 50 MiB)) @@ -48227,15 +48235,17 @@ Instantiate an Image (label root-label) (file-system "ext4") (flags '(boot)) + (target 'root) (initializer (gexp initialize-root-partition)))))) @end lisp -Note that the first and third partitions use generic initializers -procedures, initialize-efi-partition and initialize-root-partition -respectively. The initialize-efi-partition installs a GRUB EFI loader -that is loading the GRUB bootloader located in the root partition. The -initialize-root-partition instantiates a complete system as defined by -the @code{%simple-os} operating-system. +Note that the first and third partitions use generic initializer +procedures, @code{initialize-efi-partition} and +@code{initialize-root-partition} respectively. +@code{initialize-efi-partition} simply creates the directory structure +for an EFI bootloader to install itself to. +@code{initialize-root-partition} instantiates a complete system as +defined by the @code{%simple-os} operating-system. You can now run: @@ -48292,10 +48302,6 @@ Instantiate an Image @code{i686} machines, supporting BIOS or UEFI booting. @end defvar -@defvar efi32-disk-image -Same as @code{efi-disk-image} but with a 32 bits EFI partition. -@end defvar - @defvar iso9660-image An ISO-9660 image composed of a single bootable partition. This image can also be used on most @code{x86_64} and @code{i686} machines. @@ -48386,10 +48392,6 @@ image-type Reference Build an image based on the @code{efi-disk-image} image. @end defvar -@defvar efi32-raw-image-type -Build an image based on the @code{efi32-disk-image} image. -@end defvar - @defvar qcow2-image-type Build an image based on the @code{mbr-disk-image} image but with the @code{compressed-qcow2} image format. @@ -48417,14 +48419,14 @@ image-type Reference @defvar pinebook-pro-image-type Build an image that is targeting the Pinebook Pro machine. The MBR image contains a single partition starting at a @code{9MiB} offset. The -@code{u-boot-pinebook-pro-rk3399-bootloader} bootloader will be +@code{u-boot-pinebook-pro-rk3399-bootloader} bootloader can be installed in this gap. @end defvar @defvar rock64-image-type Build an image that is targeting the Rock64 machine. The MBR image contains a single partition starting at a @code{16MiB} offset. The -@code{u-boot-rock64-rk3328-bootloader} bootloader will be installed in +@code{u-boot-rock64-rk3328-bootloader} bootloader can be installed in this gap. @end defvar diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index f1352122a9..6b08e61492 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -100,6 +100,8 @@ (define-module (gnu bootloader) bootloader-configuration-targets bootloader-configuration-menu-entries bootloader-configuration-default-entry + bootloader-configuration-efi-removable? + bootloader-configuration-32bit? bootloader-configuration-timeout bootloader-configuration-keyboard-layout bootloader-configuration-theme @@ -113,6 +115,9 @@ (define-module (gnu bootloader) bootloader-configuration->gexp bootloader-configurations->gexp + %efi-supported-systems + efi-arch + install-efi efi-bootloader-chain)) @@ -502,6 +507,10 @@ (define-record-type* (default '())) ;list of (default-entry bootloader-configuration-default-entry (default 0)) ;integer + (efi-removable? bootloader-configuration-efi-removable? + (default #f)) ;bool + (32bit? bootloader-configuration-32bit? + (default #f)) ;bool (timeout bootloader-configuration-timeout (default 5)) ;seconds as integer (keyboard-layout bootloader-configuration-keyboard-layout @@ -635,9 +644,54 @@ (define (bootloader-configurations->gexp bootloader-configs . rest) ;;; -;;; Bootloaders. +;;; Bootloader installation to ESP. ;;; +;; systems currently supported by efi-arch. should be used for packages relying +;; on it. +(define %efi-supported-systems + '("i686-linux" "x86_64-linux" "armhf-linux" "aarch64-linux" "riscv64-linux")) + +(define* (efi-arch #:key (target (or (%current-target-system) (%current-system))) + (32? #f)) + "Returns the UEFI architecture name for the current target, in lowercase." + (cond ((target-x86-32? target) "ia32") + ((target-x86-64? target) (if 32? "ia32" "x64")) + ((target-arm32? target) "arm") + ((target-aarch64? target) (if 32? "arm" "aa64")) + ((target-riscv64? target) (if 32? "riscv32" "riscv64")) + (else (raise (formatted-message (G_ "no UEFI standard arch for ~a!") + target))))) + +(define (lazy-efibootmgr) + "Lazy-loaded efibootmgr package, in order to prevent circular refs." + (module-ref (resolve-interface '(gnu packages linux)) 'efibootmgr)) + +(define (install-efi bootloader-config plan) + "Returns a gexp installing PLAN to the ESP, as denoted by the 'vendir target. +PLAN is a gexp of a list of '(BUILDER DEST-BASENAME . LABEL) triples, that +should be in boot order. If the user selects a removable bootloader, only the +first entry in PLAN is used." + (match-record bootloader-config + (targets efi-removable? 32bit?) + (if efi-removable? + ;; Hard code the output location to a well-known path recognized by + ;; compliant firmware. See "3.5.1.1 Removable Media Boot Behaviour": + ;; http://www.uefi.org/sites/default/files/resources/UEFI%20Spec%202_6.pdf + (with-targets targets + (('esp => (path :path)) + #~(let ((boot #$(string-append path "/EFI/BOOT")) + (arch #$(string-upcase (efi-arch #:32? 32bit?))) + (builder (car (car #$plan)))) + (mkdir-p boot) + ;; Only realize the first planspec. + (builder (string-append boot "/BOOT" arch ".EFI"))))) + ;; Install normally if not configured as removable. + (with-targets targets + (('vendir => (vendir :path) (loader :devpath) (disk :device)) + #~(install-efi #+(file-append (lazy-efibootmgr) "/sbin/efibootmgr") + #$vendir #$loader #$disk #$plan)))))) + (define (efi-bootloader-profile packages files hooks) "Creates a profile from the lists of PACKAGES and FILES from the store. This profile is meant to be used by the bootloader-installer. diff --git a/gnu/build/bootloader.scm b/gnu/build/bootloader.scm index 3934e03aee..064466bd33 100644 --- a/gnu/build/bootloader.scm +++ b/gnu/build/bootloader.scm @@ -23,8 +23,6 @@ (define-module (gnu build bootloader) #:autoload (guix build syscalls) (free-disk-space) #:use-module (guix build utils) - #:use-module (guix utils) - #:use-module (ice-9 binary-ports) #:use-module (guix diagnostics) #:use-module (guix i18n) #:use-module (ice-9 format) @@ -40,7 +38,7 @@ (define-module (gnu build bootloader) #:export (atomic-copy in-temporary-directory write-file-on-device - install-efi-loader)) + install-efi)) ;;; @@ -102,57 +100,62 @@ (define (efi-bootnums efibootmgr) (bootnum (match:substring match 1))) (cons (cons path bootnum) acc)))))) -(define* (install-efi grub grub-config esp #:key targets) - "Write a self-contained GRUB EFI loader to the mounted ESP using -GRUB-CONFIG. - -If TARGETS is set, use its car as the GRUB image format and its cdr as -the output filename. Otherwise, use defaults for the host platform." - (let* ((system %host-type) - ;; Hard code the output location to a well-known path recognized by - ;; compliant firmware. See "3.5.1.1 Removable Media Boot Behaviour": - ;; http://www.uefi.org/sites/default/files/resources/UEFI%20Spec%202_6.pdf - (grub-mkstandalone (string-append grub "/bin/grub-mkstandalone")) - (efi-directory (string-append esp "/EFI/BOOT")) - ;; Map grub target names to boot file names. - (efi-targets (or targets - (cond ((string-prefix? "x86_64" system) - '("x86_64-efi" . "BOOTX64.EFI")) - ((string-prefix? "i686" system) - '("i386-efi" . "BOOTIA32.EFI")) - ((string-prefix? "armhf" system) - '("arm-efi" . "BOOTARM.EFI")) - ((string-prefix? "aarch64" system) - '("arm64-efi" . "BOOTAA64.EFI")))))) - ;; grub-mkstandalone requires a TMPDIR to prepare the firmware image. - (setenv "TMPDIR" esp) - - (mkdir-p efi-directory) - (invoke grub-mkstandalone "-O" (car efi-targets) - "-o" (string-append efi-directory "/" - (cdr efi-targets)) - ;; Graft the configuration file onto the image. - (string-append "boot/grub/grub.cfg=" grub-config)))) - -(define* (install-efi-loader grub-efi esp #:key targets) - "Install in ESP directory the given GRUB-EFI bootloader. Configure it to -load the Grub bootloader located in the 'Guix_image' root partition. - -If TARGETS is set, use its car as the GRUB image format and its cdr as -the output filename. Otherwise, use defaults for the host platform." - (let ((grub-config "grub.cfg")) - (call-with-output-file grub-config - (lambda (port) - ;; Create a tiny configuration file telling the embedded grub where to - ;; load the real thing. XXX This is quite fragile, and can prevent - ;; the image from booting when there's more than one volume with this - ;; label present. Reproducible almost-UUIDs could reduce the risk - ;; (not eliminate it). - (format port - "insmod part_msdos~@ - insmod part_gpt~@ - search --set=root --label Guix_image~@ - configfile /boot/grub/grub.cfg~%"))) - (install-efi grub-efi grub-config esp #:targets targets) - (delete-file grub-config))) +(define (install-efi efibootmgr vendir loader* disk plan) + "See also install-efi in (gnu bootloader)." + (let* ((loader (string-map (match-lambda (#\/ #\\) (x x)) loader*)) + (bootnums (filter (compose (cut string-prefix? loader <>) car) + (efi-bootnums efibootmgr))) + (plan-files (map cadr plan))) + (define (size file) (if (file-exists? file) (stat:size (stat file)) 0)) + (define (vendirof file) (string-append vendir "/" file)) + (define (loaderof file) (string-append loader "\\" file)) + (define (delete-boot num file) + (invoke efibootmgr "--quiet" "--bootnum" num "--delete-bootnum") + (when (file-exists? file) (delete-file file))) + (mkdir-p vendir) + ;; Delete old entries first, to clear up space. + (for-each (lambda (spec) ; '(path . bootnum) + (let* ((s (substring (car spec) (string-length loader))) + (file (substring s (if (string-prefix? "\\" s) 1 0)))) + (unless (member file plan-files) + (delete-boot (cdr spec) (vendirof file))))) + bootnums) + ;; New and updated entries. + (in-temporary-directory + (for-each + (lambda (spec) + (let* ((builder (car spec)) (name (cadr spec)) + (dest (vendirof name)) (loadest (loaderof name)) + (rest (reverse (cdr (member name plan-files))))) + ;; Build to a temporary file so we can check its size. + (builder name) + ;; Disk space is usually limited on ESPs. + ;; Try to clear space as we install new bootloaders. + (if (while (> (- (size name) (size dest)) (free-disk-space vendir)) + (let ((del (find (compose file-exists? vendirof) rest))) + (if del (delete-file (vendirof del)) (break #t)))) + (begin + (and=> (assoc-ref bootnums loadest) (cut delete-boot <> dest)) + (warning (G_ "ESP too small for bootloader ~a!~%") name)) + ;; The ESP is too small for atomic copy. + (begin + (copy-file name dest) + (unless (assoc loadest bootnums) + (invoke + efibootmgr "--quiet" "--create-only" "--label" + (cddr spec) "--disk" disk "--loader" loadest)))) + (delete-file name))) + plan)) + ;; Verify that at least the first entry was installed. + (unless (file-exists? (vendirof (cadr (car plan)))) + ;; Extremely fatal error so we use leave instead of raise. + (leave (G_ "not enough space in ESP to install bootloader! + SYSTEM WILL NOT BOOT UNLESS THIS IS FIXED!~%"))) + ;; Some UEFI systems will refuse to acknowledge the existence of boot + ;; entries unless they're in bootorder, so just shove everything in there. + (invoke + efibootmgr "--quiet" "--bootorder" + ;; Recall efi-bootnums to get a fresh list with new installs. + (let ((num (cute assoc-ref (efi-bootnums efibootmgr) <>))) ; cute is eager + (string-join (filter-map (compose num loaderof) plan-files) ","))))) diff --git a/gnu/build/image.scm b/gnu/build/image.scm index 6ca0a428e0..1b2d4da814 100644 --- a/gnu/build/image.scm +++ b/gnu/build/image.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2022 Pavel Shlyak ;;; Copyright © 2022 Denis 'GNUtoo' Carikli ;;; Copyright © 2023 Efraim Flashner +;;; Copyright © 2024 Lilah Tascheter ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,6 +29,7 @@ (define-module (gnu build image) #:use-module (guix build store-copy) #:use-module (guix build syscalls) #:use-module (guix build utils) + #:use-module (guix deprecation) #:use-module (guix store database) #:use-module (guix utils) #:use-module (gnu build bootloader) @@ -181,23 +183,10 @@ (define* (register-closure prefix closure #:prefix prefix #:registration-time %epoch))))) -(define* (initialize-efi-partition root - #:key - grub-efi - #:allow-other-keys) - "Install in ROOT directory, an EFI loader using GRUB-EFI." - (install-efi-loader grub-efi root)) - -(define* (initialize-efi32-partition root - #:key - grub-efi32 - #:allow-other-keys) - "Install in ROOT directory, an EFI 32bit loader using GRUB-EFI32." - (install-efi-loader grub-efi32 root - #:targets (cond ((target-x86?) - '("i386-efi" . "BOOTIA32.EFI")) - ((target-arm?) - '("arm-efi" . "BOOTARM.EFI"))))) +(define (initialize-efi-partition root . rest) + (mkdir-p (string-append root "/EFI"))) + +(define-deprecated/alias initialize-efi32-partition initialize-efi-partition) (define* (initialize-root-partition root #:key diff --git a/gnu/image.scm b/gnu/image.scm index 7fb06dec10..c6cc264147 100644 --- a/gnu/image.scm +++ b/gnu/image.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020, 2022 Mathieu Othacehe ;;; Copyright © 2023 Oleg Pykhalov +;;; Copyright © 2024 Lilah Tascheter ;;; ;;; This file is part of GNU Guix. ;;; @@ -35,6 +36,7 @@ (define-module (gnu image) partition-label partition-uuid partition-flags + partition-target partition-initializer image @@ -131,6 +133,8 @@ (define-record-type* partition make-partition (flags partition-flags (default '()) ;list of symbols (sanitize validate-partition-flags)) + (target partition-target ; bootloader target type: symbol | #f + (default #f)) (initializer partition-initializer (default #false))) ;gexp | #false diff --git a/gnu/system/image.scm b/gnu/system/image.scm index b0c96c60f0..8ac91800ad 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2022 Alex Griffin ;;; Copyright © 2023 Efraim Flashner ;;; Copyright © 2023 Oleg Pykhalov +;;; Copyright © 2024 Lilah Tascheter ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +24,7 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu system image) + #:use-module (guix deprecation) #:use-module (guix diagnostics) #:use-module (guix discovery) #:use-module (guix gexp) @@ -133,12 +135,10 @@ (define esp-partition ;; FAT-ness is based on file system size (16 in this case). (file-system "vfat") (flags '(esp)) - (initializer (gexp initialize-efi-partition)))) + (target 'esp) + (initializer #~initialize-efi-partition))) -(define esp32-partition - (partition - (inherit esp-partition) - (initializer (gexp initialize-efi32-partition)))) +(define-deprecated/alias esp32-partition esp-partition) (define root-partition (partition @@ -149,6 +149,7 @@ (define root-partition ;; with U-Boot. (file-system-options (list "-O" "^metadata_csum,^64bit")) (flags '(boot)) + (target 'root) (initializer (gexp initialize-root-partition)))) (define mbr-disk-image @@ -173,11 +174,7 @@ (define efi-disk-image (partition-table-type 'gpt) (partitions (list esp-partition root-partition)))) -(define efi32-disk-image - (image-without-os - (format 'disk-image) - (partition-table-type 'gpt) - (partitions (list esp32-partition root-partition)))) +(define-deprecated/alias efi32-disk-image efi-disk-image) (define iso9660-image (image-without-os @@ -238,10 +235,7 @@ (define efi-raw-image-type (name 'efi-raw) (constructor (cut image-with-os efi-disk-image <>)))) -(define efi32-raw-image-type - (image-type - (name 'efi32-raw) - (constructor (cut image-with-os efi32-disk-image <>)))) +(define-deprecated/alias efi32-raw-image-type efi-raw-image-type) (define qcow2-image-type (image-type From patchwork Thu Sep 26 10:09:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31495 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 07B3627BBEA; Thu, 26 Sep 2024 11:12:22 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B6DE927BBE2 for ; Thu, 26 Sep 2024 11:12:21 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTN-00030z-HJ; Thu, 26 Sep 2024 06:11:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTJ-0002z1-Bt for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:41 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTJ-0007Qj-1b for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=qRkQ+V7cbQqvpp4N1OyLrTv06n5MQwiFsnRDUcaJYXA=; b=iEmKUbfzu7ddTEf/uxvltazO1+C1jUim1m8FJHDbnWxFozIbWo93dHHbDsL9oGAqrkJgYukaY57y9z9gXDVwXRd7NaZKAJQiytXAMffpw6Mg/02NMHrrS8qAGfGCbGkLMHJe4v/JGePQUyAFDuyRZUiNHHytrotkx5/j4B5yX59PZvIWYEPI2rz6nuFLZb146x+xNOQ/8XwuapLYyVuYKg0eLQJo6RZpuVFDVIlFBg0iqxPfGYTqYrCRGrDyWUBVwikq9bScRcMb/k9Oyou6LRBIoRKHkN40kYLZWWH3wnn86ZvaGP9TcpjnMCk9b+BPWXyW5/G0mKDj2rk4NbVdcw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTj-0003Va-Um; Thu, 26 Sep 2024 06:12:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 13/14] gnu: bootloader: Match records outside the module. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: lilah@lunabee.space, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter X-Debbugs-Original-Xcc: Lilah Tascheter Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734551013336 (code B ref 73202); Thu, 26 Sep 2024 10:12:07 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:50 +0000 Received: from localhost ([127.0.0.1]:55506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlTP-0003Ss-1z for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:50 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:36821 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT2-0003Q9-NC for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345443; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MGXJGMlBS2JxeQ9UHG5y4t5h/ac6O9cs+W8GkavSdxg=; b=Wgf78P0DG+HMYyj7x6MBKHBsb+fbJMpySIJkRY9i6ugSHPWkp4aWdVAxUuYyCHdwbz2WUx C1ZB6SY4YC8KkFf35UwtjwuU7OL8KE+cMVxj0nHgZ7KYYBvQQ40gT+e7iYyll+33AB9Et4 kTwA46rWcraRpmoKv9L5TYhCkBxApkhO+WsHSgQwN9ub8VaYWldJU8scggprW98sDLL8eN BPXKf2YJlXE7DLPLDBY+ryIh4ai/xuUW3ZyAzLyeAMtGQ1rtwuQRfrCZ0bKYHWuSDsC+T1 T6NS7b20gfidsveq/PQox9h6DkKBRx53IAwd7tfI1Ur6dFqbEu43/HbI3qaMvw== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 2f74c9e7 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <73202@debbugs.gnu.org>; Thu, 26 Sep 2024 10:10:43 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:10 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/bootloader.scm (match-bootloader-configuration, match-menu-entry): Add macros. Change-Id: I42cb7541045314c37ffef98fe6efe7f46acd9d9b --- gnu/bootloader.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 6b08e61492..b1ed187aa2 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2022 Reza Alizadeh Majd ;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz> ;;; Copyright © 2024 Lilah Tascheter +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -115,6 +116,9 @@ (define-module (gnu bootloader) bootloader-configuration->gexp bootloader-configurations->gexp + match-bootloader-configuration + match-menu-entry + %efi-supported-systems efi-arch install-efi @@ -642,6 +646,20 @@ (define (bootloader-configurations->gexp bootloader-configs . rest) (apply gbegin (filter-map (cut apply bootloader-configuration->gexp <> rest) bootloader-configs))) +;; In lieu of exporting bootloader-configuration and menu-entry RTDs. +(define-syntax match-bootloader-configuration + (syntax-rules () + "Bind each BOOTLOADER-CONFIGURATION field in FIELDS." + ((_ bootloader-configuration (fields ...) body ...) + (match-record bootloader-configuration + (fields ...) body ...)))) + +(define-syntax match-menu-entry + (syntax-rules () + "Bind each MENU-ENTRY field in FIELDS." + ((_ menu-entry (fields ...) body ...) + (match-record menu-entry (fields ...) body ...)))) + ;;; ;;; Bootloader installation to ESP. From patchwork Thu Sep 26 10:09:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 31497 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 154BF27BBEA; Thu, 26 Sep 2024 11:12:32 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CDFF927BBE2 for ; Thu, 26 Sep 2024 11:12:31 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTL-0002zp-I3; Thu, 26 Sep 2024 06:11:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stlTJ-0002zO-PT for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:41 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stlTJ-0007Qx-Fy for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=05ZpYUQWjLraaZkFklKQAVJ7OD3MFTWXDuCoNW+OPWQ=; b=WqOaktu0tOxFOomHyRfw3o+/KtpSFyDz+Ng+f0W9QDEtOX2K4XAn7lqPJ8jYPX79jvlJgH25PKCNmjdSvd3rMXvASbs4a8ot98Eu5p5xcI9MpGoWqCvqlkFcUQ0Rr3x1Q5/1P2MG0KMGMpKi8f5hbLLqksoIEzDuXhvnoXaK5mxZyyP+6WQEC42HINnNkl4JqfHehNGNweUNtLcL171Fp+uM1+gocSw021J4k9nw/Djfug1BNs4tdw0criYzWg6Vy7jDCQ5+S1emUzn5ek0jubfF97EFInzl7Ru6bDk6iK72yt8qEBcoNHIO8lWyU0tMaofsbknMJNvtHnKFdXGgpA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTk-0003Vi-Do for guix-patches@gnu.org; Thu, 26 Sep 2024 06:12:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 14/14] teams: Add bootloading team. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734551113343 (code B ref 73202); Thu, 26 Sep 2024 10:12:08 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:51 +0000 Received: from localhost ([127.0.0.1]:55508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlTS-0003T3-JL for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:50 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39475 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT3-0003PA-F9 for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345444; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JMyL6wxv0K/n+14BL5MIqksXAnqONeJGjRnmYYtwgQo=; b=daGDRvLIlvLyINXjWzr7yx7DGfWVIhksBFIlESvM2uKWtw3cIhzfDPQt+vz5O9NKF/r0XL qx5cR+y1TNhqNp4IFil/FNOPajCnOZnDvnfGDCcRqF4UVd3Ettwa55/GeUaFzQD8cvotO+ 9XIYQDvApJEBzc5QsDYq5t08+2tbRA4BqK6h/LUOHDJjLOBiJnCCsWjiZJ7pr9Zyh8BFuK AHaIiQGCZkkOK7aaabkx++z/NEPvWG3oolwZwVx/KaPqM2R41XKHfkaW3VvHa6rzd4snQl LmHmUuMNE4JDw2zDSQ1uxSspMk+K7YKfEaNGxklf2ago9TzQIJOAjkveqs5kqw== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 1e582227 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:43 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:11 +0200 Message-ID: <5bca06489688f23265bec3e96fb94412acd05b0f.1727345067.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Lilah Tascheter Might as well, to help ease the transition. * etc/teams.scm (bootloaders): New team. (Lilah Tascheter): Create and add to above. Change-Id: I63620f4e3151bb8e3d0bdf619fc70501af6397a0 --- etc/teams.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etc/teams.scm b/etc/teams.scm index 9239021b39..2150a7aad1 100755 --- a/etc/teams.scm +++ b/etc/teams.scm @@ -328,6 +328,12 @@ (define-team embedded #:scope (list "gnu/packages/bootloaders.scm" "gnu/packages/firmware.scm"))) +(define-team bootloaders + (team 'bootloaders + #:name "Bootloaders" + #:scope (list "gnu/bootloader.scm" + (make-regexp* "^gnu/bootloader/")))) + (define-team rust (team 'rust #:name "Rust" @@ -749,6 +755,10 @@ (define-member (person "André Batista" "nandre@riseup.net") mozilla) +(define-member (person "Lilah Tascheter" + "lilah@lunabee.space") + bootloaders) + (define (find-team name) (or (hash-ref %teams (string->symbol name))