From patchwork Sun Aug 4 03:13:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66647 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 8193227BBED; Sun, 4 Aug 2024 04:17: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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 E895427BBEE for ; Sun, 4 Aug 2024 04:17:44 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjv-0003mI-Pl; Sat, 03 Aug 2024 23:16:59 -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 1saRji-0003k6-8q for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:46 -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 1saRjh-0002NW-9t; Sat, 03 Aug 2024 23:16:45 -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=2ZG/xzlaJZwVvFpWrIC7p3e3sUtcoH68qb3lRbMLAhU=; b=JwSY2q1Hp+UFQYiY0VPEZI8gQp7fMTbPqIbc9Dr7082NeChgSG8ILZuu90lOEpdbZP3BD3My7SnANhA9z5d9nDSbCJAvnWBcjVdxGQlwx32BOMo3ZM71tpmgbBR63B+D5R4XAZRIAxldfo3OP2c/mBBoUux7sjv8+jGl/lpTnIA6/W4m+JNR4RRXt/snE/It/Bn2yQC8nEmiQTgq1Ub0JQpMwycGY+1QveEVXFEPPnbPUG14XnWe5zCqPdEAbMt7X68CxG2LKFVr+KrKIz/1pHtL7mDrdCaWpnHNZ4eyWP3bWqs/AmhNgSSPUnknzRhS6+I+FRoo1Ot7nvkJ0hhMKg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRjy-0007n1-Vk; Sat, 03 Aug 2024 23:17:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 01/12] Fix bug where the extra menu entries for a bootloader were shown twice. Resent-From: Lilah Tascheter 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: Sun, 04 Aug 2024 03:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274136829616 (code B ref 69343); Sun, 04 Aug 2024 03:17:02 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:08 +0000 Received: from localhost ([127.0.0.1]:54982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRj5-0007hX-L7 for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:07 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:56494) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRj3-0007ge-43 for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:06 -0400 DKIM-Signature: a=rsa-sha256; b=HX0fVzAs5xOV34TRNun+64UaDPkqDNXmYM9EjEuno8BM7iHQtezOPRGm496bgLgXZNHOrwdo8aftpxPlAGvYipfyPuBA0kgFEa33DUg+mJwK71VJELT4sb+oxJJ7P9LAjVQBLfZyIV52wnAZA4j9GtsQqcl/CVjDlsxQpHowXiRClqD0aH6/VTfNUeKTYAqSQu9OCTzbCOo1Yr/S8FKObKcEFu9VHYGr1wHBd3c0HtOSe/8nMchYg9xN6XLEOqp5zhJif/Qobt2040upy4RApQ3HwPnJc+gqA6FB4dWggUxYFR8HpBcjVD30syy3WPRDLaRkFXV0Tf8s/+TJ/UKeFA==; s=purelymail2; d=lunabee.space; v=1; bh=qXWn1cz6zN65+Q68ygAxFMhzoQIb60JNk1LL8A3ilhs=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=Ymjeoj9Jm14DJFP4EBzK1dnPTb9ym2vxm7IH9FQaaCxfCnupBBlTGJFfhYFQHJZv//T09kaiXFZa1+Od7GAcSX8/V+RyZOIPuIseU6ggIywS4sbw3327sRtzy665xoNqH0GlhHuJXhYeK4hCB24K1XGvs9q20LXyhF+Ljx393c1RdE7Skt6Y2fwFhPr+vbH4zWA/ufGQ+Ozb5RAzvV1nYlUdwaw/aP0kJIViDGnwBDtwvXP6MwH0QBF7lbb7QDz8auq1Dh71HhV76geHgzrEADZKqIkPYPLpvuQeRusd0qFCw7mWgeRSl3E2B8p0gncBNgBQ6tMfSlhvGfORA+c5fQ==; s=purelymail2; d=purelymail.com; v=1; bh=qXWn1cz6zN65+Q68ygAxFMhzoQIb60JNk1LL8A3ilhs=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:35 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:23 -0500 Message-ID: <048a294013321d432030a71007d7386d2f1308d7.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner The extra menu entries are already being added in each bootloaders, as applicable. * guix/scripts/system.scm (reinstall-bootloader)[entries]: Don't extraneously include bootloader-configuration-menu-entries here. Change-Id: I8a600f2a5836ab4f7db5e27e25b0b8f432c3e1e0 --- guix/scripts/system.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 99c58f3812..0305128763 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -412,8 +412,7 @@ (define (reinstall-bootloader store number) (delv number (reverse (generation-numbers %system-profile)))) (old-params (profile-boot-parameters %system-profile old-generations)) - (entries (cons (boot-parameters->menu-entry params) - (boot-parameters-bootloader-menu-entries params))) + (entries (list (boot-parameters->menu-entry params))) (old-entries (map boot-parameters->menu-entry old-params))) (run-with-store store (mlet* %store-monad From patchwork Sun Aug 4 03:13:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66643 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 1E45927BBE9; Sun, 4 Aug 2024 04:17:43 +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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 EAC3527BBE2 for ; Sun, 4 Aug 2024 04:17:39 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjy-0003n5-70; Sat, 03 Aug 2024 23:17:02 -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 1saRji-0003kI-GO for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:50 -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 1saRji-0002Q5-66; Sat, 03 Aug 2024 23:16:46 -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=vO6hmiHkgswz0z62Lgk/jg6jH6fvwKSJtTU2C6oSo6k=; b=Nq2le4TynqJnO4Ih43rmuyDFDOKB+2/S1HHA2rIDrOKS33mY5oxsBJOVBwVX/4IvegOiqqDD+7xklIcBkU7C9X5qS+srY6b2WwI1J9/5CIJvI0vvZqyU+KHeoCChDesgiX7bK7HNR7ostzCS1oSeFTHvkE94jO4GfYAqORsIrWKt8oiFwKn/ckhHPF7X061xvmbaE35wRVHZNSwqRX8GpSUV7FH9egojCGXhxKKuPZVpcJ4xy5AYhHdHKPfCaV+OWLJNFeEcsF0bQyKYng1D2YCgn2YhQZFvShPUy5T/HfeNM31c/Lo/rQbzvoa4N35UU1yK7AaoSoINVbOn4ZLKpw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRjz-0007nK-VG; Sat, 03 Aug 2024 23:17:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 02/12] Move record to a separate file. Resent-From: Lilah Tascheter 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: Sun, 04 Aug 2024 03:17:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274137329665 (code B ref 69343); Sun, 04 Aug 2024 03:17:03 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:13 +0000 Received: from localhost ([127.0.0.1]:54992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRj9-0007iG-J0 for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:13 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:51702) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRj5-0007h5-Vr for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:10 -0400 DKIM-Signature: a=rsa-sha256; b=mYs3mQYBH/bj5MWWFfpkOhnuMZCmZOhoNGL3GcT/ppiCcGTED6QgqFRrAla8/Kyp0iEaj5LiKAjxqv5sfqJrPykNFs0Tri6jphF77nY3Nlmhf/+SRJOXM7O+hGPLRpxlKdcyI2sqYEforpcB9QX2RggVUY5ISZ5Owf1ErPY61dqU7cvWGK8aTauZ6BELPPQF4dB/dFi3DdSf4zJg2d7fSjQSlSnjjXcnNd4pshtBc1uNg3BHU66H+g5JvR8Z+l2moGzzms/LDg6ptrkPt6xpafeArE48+kBDZ3NrSoQziVsO6U2RPz/Gl83og/OyjA6CfhuGNR/i9nggMXHfj1WlgA==; s=purelymail2; d=lunabee.space; v=1; bh=a5UGzS5kQkdVSvcKofZnx9J57WwombKPeOCAElNSvCo=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=LVeUwlXYjUk0X0334JXnmh6JlcX/ch3gJuGI3Kubpl0EPGhz2x81U9ebW68ciBxLp8/Y+M9nRy8cL6B3s8aTamnbqyZ0WynRV8EFBbd1jdQuNAPxnIM4pK3ak/MKds7pVrjSusUJkzz8jBHacJJFmTnaYB60g1VItRcff7PS1PiuplzkfFIsWIKKHh1NE3TM06mNUyMhVqmnjS3F7pQQdR2yUg0SAEV2Zo4cjC+esebn6mLJl9JvqpECbOjlTBazhBjB3hljLToUMsdheQqKGDTc4/xpmaMBlYQt1PwYYulz+AxQqMn5lnlUQwc8BlCvE/C3x6gQIacj3mkd737P1g==; s=purelymail2; d=purelymail.com; v=1; bh=a5UGzS5kQkdVSvcKofZnx9J57WwombKPeOCAElNSvCo=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:35 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:24 -0500 Message-ID: <84d2bacfdda34a9c8be2ed13b3d348280f9ba2ef.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner Required to avoid a missing dependency error on build-side. * gnu/system.scm (): Move this record, and... (system-linux-image-file-name, %boot-parameters-version, bootable-kernel-arguments, ensure-not-/dev, read-boot-parameters, read-boot-parameters-file): ...these procedures, to... * gnu/system/boot.scm: ...this new file. * gnu/machine/ssh.scm, gnu/system.scm, guix/scripts/system.scm, tests/boot-parameters.scm: Use new module above. * gnu/local.mk (GNU_SYSTEM_MODULES): Add new module above. * gnu/machine/ssh.scm (machine-boot-parameters): Don't private-import bootable-kernel-arguments. Change-Id: I6944ffd4c323c776005b0cef23218bffae59be23 --- gnu/local.mk | 1 + gnu/machine/ssh.scm | 4 +- gnu/system.scm | 259 +------------------------------ gnu/system/boot.scm | 318 ++++++++++++++++++++++++++++++++++++++ guix/scripts/system.scm | 1 + tests/boot-parameters.scm | 1 + 6 files changed, 323 insertions(+), 261 deletions(-) create mode 100644 gnu/system/boot.scm diff --git a/gnu/local.mk b/gnu/local.mk index 6d2b14e72d..8375e13709 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -758,6 +758,7 @@ GNU_SYSTEM_MODULES = \ \ %D%/system.scm \ %D%/system/accounts.scm \ + %D%/system/boot.scm \ %D%/system/file-systems.scm \ %D%/system/hurd.scm \ %D%/system/image.scm \ diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 0be9ebbc0d..749aa2b6d8 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -23,6 +23,7 @@ (define-module (gnu machine ssh) #:use-module (gnu machine) #:autoload (gnu packages gnupg) (guile-gcrypt) #:use-module (gnu system) + #:use-module (gnu system boot) #:use-module (gnu system file-systems) #:use-module (gnu system uuid) #:use-module ((gnu services) #:select (sexp->system-provenance)) @@ -417,9 +418,6 @@ (define not-config? (define (machine-boot-parameters machine) "Monadic procedure returning a list of 'boot-parameters' for the generations of MACHINE's system profile, ordered from most recent to oldest." - (define bootable-kernel-arguments - (@@ (gnu system) bootable-kernel-arguments)) - (define remote-exp (with-extensions (list guile-gcrypt) (with-imported-modules `(((guix config) => ,(make-config.scm)) diff --git a/gnu/system.scm b/gnu/system.scm index c76f4d7c50..2e4b10e2fb 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -72,6 +72,7 @@ (define-module (gnu system) #:use-module (gnu services shepherd) #:use-module (gnu services base) #:use-module (gnu bootloader) + #:use-module (gnu system boot) #:use-module (gnu system shadow) #:use-module (gnu system nss) #:use-module (gnu system locale) @@ -145,31 +146,11 @@ (define-module (gnu system) operating-system-boot-script operating-system-uuid - system-linux-image-file-name operating-system-with-gc-roots operating-system-with-provenance hurd-default-essential-services - boot-parameters - boot-parameters? - 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 - boot-parameters-store-mount-point - boot-parameters-locale - boot-parameters-kernel - boot-parameters-kernel-arguments - boot-parameters-initrd - boot-parameters-multiboot-modules - boot-parameters-version - %boot-parameters-version - read-boot-parameters - read-boot-parameters-file boot-parameters->menu-entry local-host-aliases ;deprecated @@ -192,29 +173,6 @@ (define-module (gnu system) ;;; ;;; Code: -(define* (bootable-kernel-arguments system root-device version) - "Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE. -VERSION is the target version of the boot-parameters record." - ;; If the version is newer than 0, we use the new style initrd parameter - ;; names, otherwise we use the legacy ones. This is to maintain backward - ;; compatibility when producing bootloader configurations for older - ;; generations. - (define version>0? (> version 0)) - (let ((root (file-system-device->string root-device - #:uuid-type 'dce))) - (append - (if (string=? root "none") - '() ; Ignore the case where the root is "none" (typically tmpfs). - ;; Note: Always use the DCE format because that's what - ;; (gnu build linux-boot) expects for the 'root' - ;; kernel command-line option. - (list (string-append (if version>0? "root=" "--root=") root))) - (list #~(string-append (if #$version>0? "gnu.system=" "--system=") #$system) - #~(string-append (if #$version>0? "gnu.load=" "--load=") - #$system "/boot"))))) - -;; System-wide configuration. - (define-with-syntax-properties (warn-hosts-file-field-deprecation (value properties)) (when value @@ -361,210 +319,6 @@ (define* (operating-system-kernel-arguments ;;; Boot parameters ;;; -;;; Version 1 was introduced early 2022 to mark the departure from long option -;;; names such as '--load' to the more conventional initrd option names like -;;; 'gnu.load'. -;;; -;;; When bumping the boot-parameters version, increment it by one (1). -(define %boot-parameters-version 1) - -(define-record-type* - boot-parameters make-boot-parameters boot-parameters? - (label boot-parameters-label) - ;; Because we will use the 'store-device' to create the GRUB search command, - ;; the 'store-device' has slightly different semantics than 'root-device'. - ;; The 'store-device' can be a file system uuid, a file system label, or #f, - ;; but it cannot be a device file name such as "/dev/sda3", since GRUB would - ;; not understand that. The 'root-device', on the other hand, corresponds - ;; exactly to the device field of the object representing the - ;; OS's root file system, so it might be a device file name like - ;; "/dev/sda3". The 'store-directory-prefix' field contains #f or the store - ;; file name inside the 'store-device' as it is seen by GRUB, e.g. it would - ;; contain "/storefs" if the store is located in that subvolume of a btrfs - ;; 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) - (store-crypto-devices boot-parameters-store-crypto-devices - (default '())) - (locale boot-parameters-locale) - (kernel boot-parameters-kernel) - (kernel-arguments boot-parameters-kernel-arguments) - (initrd boot-parameters-initrd) - (multiboot-modules boot-parameters-multiboot-modules) - (version boot-parameters-version ;positive integer - (default %boot-parameters-version))) - -(define (ensure-not-/dev device) - "If DEVICE starts with a slash, return #f. This is meant to filter out -Linux device names such as /dev/sda, and to preserve GRUB device names and -file system labels." - (if (and (string? device) (string-prefix? "/" device)) - #f - device)) - -(define (read-boot-parameters port) - "Read boot parameters from PORT and return the corresponding - object. Raise an error if the format is unrecognized." - (define device-sexp->device - (match-lambda - (('uuid (? symbol? type) (? bytevector? bv)) - (bytevector->uuid bv type)) - (('file-system-label (? string? label)) - (file-system-label label)) - ((? bytevector? bv) ;old format - (bytevector->uuid bv 'dce)) - ((? string? device) - (if (string-contains device ":/") - device ; nfs-root - ;; It used to be that we would not distinguish between labels and - ;; device names. Try to infer the right thing here. - (if (string-prefix? "/" device) - device - (file-system-label device)))))) - (define uuid-sexp->uuid - (match-lambda - (('uuid (? symbol? type) (? bytevector? bv)) - (bytevector->uuid bv type)) - (x - (warning (G_ "unrecognized uuid ~a at '~a'~%") x (port-filename port)) - #f))) - - ;; New versions are not backward-compatible, so only accept past and current - ;; versions, not future ones. - (define (version? n) - (member n (iota (1+ %boot-parameters-version)))) - - (match (read port) - (('boot-parameters ('version (? version? version)) - ('label label) ('root-device root) - ('kernel kernel) - rest ...) - (boot-parameters - (version version) - (label label) - (root-device (device-sexp->device root)) - - (bootloader-name - (match (assq 'bootloader-name rest) - ((_ 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)) - (string-append kernel "/" - (system-linux-image-file-name)) - kernel)) - - (kernel-arguments - (match (assq 'kernel-arguments rest) - ((_ args) args) - (#f '()))) ;the old format - - (initrd - (match (assq 'initrd rest) - (('initrd ('string-append directory file)) ;the old format - (string-append directory file)) - (('initrd (? string? file)) - file) - (#f #f))) - - (multiboot-modules - (match (assq 'multiboot-modules rest) - ((_ args) args) - (#f '()))) - - (locale - (match (assq 'locale rest) - ((_ locale) locale) - (#f #f))) - - (store-device - ;; Linux device names like "/dev/sda1" are not suitable GRUB device - ;; identifiers, so we just filter them out. - (ensure-not-/dev - (match (assq 'store rest) - (('store ('device #f) _ ...) - root-device) - (('store ('device device) _ ...) - (device-sexp->device device)) - (_ ;the old format - root-device)))) - - (store-directory-prefix - (match (assq 'store rest) - (('store . store-data) - (match (assq 'directory-prefix store-data) - (('directory-prefix prefix) prefix) - ;; No directory-prefix found. - (_ #f))) - (_ - ;; No store found, old format. - #f))) - - (store-crypto-devices - (match (assq 'store rest) - (('store . store-data) - (match (assq 'crypto-devices store-data) - (('crypto-devices (devices ...)) - (map uuid-sexp->uuid devices)) - (('crypto-devices dev) - (warning (G_ "unrecognized crypto-devices ~S at '~a'~%") - dev (port-filename port)) - '()) - (_ - ;; No crypto-devices found. - '()))) - (_ - ;; No store found, old format. - '()))) - - (store-mount-point - (match (assq 'store rest) - (('store ('device _) ('mount-point mount-point) _ ...) - mount-point) - (_ ;the old format - "/"))))) - (x ;unsupported format - (raise - (make-compound-condition - (formatted-message - (G_ "unrecognized boot parameters at '~a'~%") - (port-filename port)) - (condition - (&fix-hint (hint (format #f (G_ "This probably means that this version -of Guix is older than the one that created @file{~a}. To address this, you -need to update Guix: - -@example -guix pull -@end example") - (port-filename port)))))))))) - -(define (read-boot-parameters-file system) - "Read boot parameters from SYSTEM's (system or generation) \"parameters\" -file and returns the corresponding object or #f if the -format is unrecognized. -The object has its kernel-arguments extended in order to make it bootable." - (let* ((file (string-append system "/parameters")) - (params (call-with-input-file file read-boot-parameters)) - (root (boot-parameters-root-device params)) - (version (boot-parameters-version params))) - (boot-parameters - (inherit params) - (kernel-arguments (append (bootable-kernel-arguments system root version) - (boot-parameters-kernel-arguments params)))))) - (define (boot-parameters->menu-entry conf) "Return a instance given CONF, a instance." (let* ((kernel (boot-parameters-kernel conf)) @@ -726,17 +480,6 @@ (define (swap-services os) (map (compose swap-service filter-deps) (operating-system-swap-devices os))) -(define* (system-linux-image-file-name #:optional - (target (or (%current-target-system) - (%current-system)))) - "Return the basename of the kernel image file for TARGET." - (cond - ((string-prefix? "arm" target) "zImage") - ((string-prefix? "mips" target) "vmlinuz") - ((string-prefix? "aarch64" target) "Image") - ((string-prefix? "riscv64" target) "Image") - (else "bzImage"))) - (define (operating-system-kernel-file os) "Return an object representing the absolute file name of the kernel image of OS." diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm new file mode 100644 index 0000000000..7bae9d2102 --- /dev/null +++ b/gnu/system/boot.scm @@ -0,0 +1,318 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2013-2022 Ludovic Courtès +;;; Copyright © 2015 Mark H Weaver +;;; Copyright © 2015, 2016 Alex Kost +;;; Copyright © 2016 Chris Marusich +;;; Copyright © 2017 Mathieu Othacehe +;;; Copyright © 2019 Meiyo Peng +;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas +;;; Copyright © 2020 Danny Milosavljevic +;;; Copyright © 2020, 2021 Brice Waegeneire +;;; Copyright © 2020 Florian Pelz +;;; Copyright © 2020, 2022 Maxim Cournoyer +;;; Copyright © 2020, 2023 Janneke Nieuwenhuizen +;;; Copyright © 2020, 2022 Efraim Flashner +;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2021 raid5atemyhomework +;;; Copyright © 2023 Bruno Victal +;;; Copyright © 2023 Felix Lechner +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu system boot) + #:use-module (guix gexp) + #:use-module (guix diagnostics) + #:use-module (guix i18n) + #:use-module (guix records) + #:use-module (guix store) + #:use-module (guix utils) + #:use-module (gnu bootloader) + #:use-module (gnu system file-systems) + #:use-module (gnu system uuid) + #:use-module (ice-9 format) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) + #:use-module (rnrs bytevectors) + #:export (boot-parameters + boot-parameters? + 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 + boot-parameters-store-mount-point + boot-parameters-locale + boot-parameters-kernel + boot-parameters-kernel-arguments + boot-parameters-initrd + boot-parameters-multiboot-modules + boot-parameters-version + %boot-parameters-version + + read-boot-parameters + read-boot-parameters-file + bootable-kernel-arguments + + ensure-not-/dev + system-linux-image-file-name)) + +;;; +;;; Boot parameters +;;; + +;;; Version 1 was introduced early 2022 to mark the departure from long option +;;; names such as '--load' to the more conventional initrd option names like +;;; 'gnu.load'. +;;; +;;; When bumping the boot-parameters version, increment it by one (1). +(define %boot-parameters-version 1) + +(define-record-type* + boot-parameters make-boot-parameters boot-parameters? + (label boot-parameters-label) + ;; Because we will use the 'store-device' to create the GRUB search command, + ;; the 'store-device' has slightly different semantics than 'root-device'. + ;; The 'store-device' can be a file system uuid, a file system label, or #f, + ;; but it cannot be a device file name such as "/dev/sda3", since GRUB would + ;; not understand that. The 'root-device', on the other hand, corresponds + ;; exactly to the device field of the object representing the + ;; OS's root file system, so it might be a device file name like + ;; "/dev/sda3". The 'store-directory-prefix' field contains #f or the store + ;; file name inside the 'store-device' as it is seen by GRUB, e.g. it would + ;; contain "/storefs" if the store is located in that subvolume of a btrfs + ;; 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) + (store-crypto-devices boot-parameters-store-crypto-devices + (default '())) + (locale boot-parameters-locale) + (kernel boot-parameters-kernel) + (kernel-arguments boot-parameters-kernel-arguments) + (initrd boot-parameters-initrd) + (multiboot-modules boot-parameters-multiboot-modules) + (version boot-parameters-version ;positive integer + (default %boot-parameters-version))) + +(define (read-boot-parameters port) + "Read boot parameters from PORT and return the corresponding + object. Raise an error if the format is unrecognized." + (define device-sexp->device + (match-lambda + (('uuid (? symbol? type) (? bytevector? bv)) + (bytevector->uuid bv type)) + (('file-system-label (? string? label)) + (file-system-label label)) + ((? bytevector? bv) ;old format + (bytevector->uuid bv 'dce)) + ((? string? device) + (if (string-contains device ":/") + device ; nfs-root + ;; It used to be that we would not distinguish between labels and + ;; device names. Try to infer the right thing here. + (if (string-prefix? "/" device) + device + (file-system-label device)))))) + (define uuid-sexp->uuid + (match-lambda + (('uuid (? symbol? type) (? bytevector? bv)) + (bytevector->uuid bv type)) + (x + (warning (G_ "unrecognized uuid ~a at '~a'~%") x (port-filename port)) + #f))) + + ;; New versions are not backward-compatible, so only accept past and current + ;; versions, not future ones. + (define (version? n) + (member n (iota (1+ %boot-parameters-version)))) + + (match (read port) + (('boot-parameters ('version (? version? version)) + ('label label) ('root-device root) + ('kernel kernel) + rest ...) + (boot-parameters + (version version) + (label label) + (root-device (device-sexp->device root)) + + (bootloader-name + (match (assq 'bootloader-name rest) + ((_ 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)) + (string-append kernel "/" + (system-linux-image-file-name)) + kernel)) + + (kernel-arguments + (match (assq 'kernel-arguments rest) + ((_ args) args) + (#f '()))) ;the old format + + (initrd + (match (assq 'initrd rest) + (('initrd ('string-append directory file)) ;the old format + (string-append directory file)) + (('initrd (? string? file)) + file) + (#f #f))) + + (multiboot-modules + (match (assq 'multiboot-modules rest) + ((_ args) args) + (#f '()))) + + (locale + (match (assq 'locale rest) + ((_ locale) locale) + (#f #f))) + + (store-device + ;; Linux device names like "/dev/sda1" are not suitable GRUB device + ;; identifiers, so we just filter them out. + (ensure-not-/dev + (match (assq 'store rest) + (('store ('device #f) _ ...) + root-device) + (('store ('device device) _ ...) + (device-sexp->device device)) + (_ ;the old format + root-device)))) + + (store-directory-prefix + (match (assq 'store rest) + (('store . store-data) + (match (assq 'directory-prefix store-data) + (('directory-prefix prefix) prefix) + ;; No directory-prefix found. + (_ #f))) + (_ + ;; No store found, old format. + #f))) + + (store-crypto-devices + (match (assq 'store rest) + (('store . store-data) + (match (assq 'crypto-devices store-data) + (('crypto-devices (devices ...)) + (map uuid-sexp->uuid devices)) + (('crypto-devices dev) + (warning (G_ "unrecognized crypto-devices ~S at '~a'~%") + dev (port-filename port)) + '()) + (_ + ;; No crypto-devices found. + '()))) + (_ + ;; No store found, old format. + '()))) + + (store-mount-point + (match (assq 'store rest) + (('store ('device _) ('mount-point mount-point) _ ...) + mount-point) + (_ ;the old format + "/"))))) + (x ;unsupported format + (raise + (make-compound-condition + (formatted-message + (G_ "unrecognized boot parameters at '~a'~%") + (port-filename port)) + (condition + (&fix-hint (hint (format #f (G_ "This probably means that this version +of Guix is older than the one that created @file{~a}. To address this, you +need to update Guix: + +@example +guix pull +@end example") + (port-filename port)))))))))) + +(define (read-boot-parameters-file system) + "Read boot parameters from SYSTEM's (system or generation) \"parameters\" +file and returns the corresponding object or #f if the +format is unrecognized. +The object has its kernel-arguments extended in order to make it bootable." + (let* ((file (string-append system "/parameters")) + (params (call-with-input-file file read-boot-parameters)) + (root (boot-parameters-root-device params)) + (version (boot-parameters-version params))) + (boot-parameters + (inherit params) + (kernel-arguments (append (bootable-kernel-arguments system root version) + (boot-parameters-kernel-arguments params)))))) + +(define* (bootable-kernel-arguments system root-device version) + "Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE. +VERSION is the target version of the boot-parameters record." + ;; If the version is newer than 0, we use the new style initrd parameter + ;; names, otherwise we use the legacy ones. This is to maintain backward + ;; compatibility when producing bootloader configurations for older + ;; generations. + (define version>0? (> version 0)) + (let ((root (file-system-device->string root-device + #:uuid-type 'dce))) + (append + (if (string=? root "none") + '() ; Ignore the case where the root is "none" (typically tmpfs). + ;; Note: Always use the DCE format because that's what + ;; (gnu build linux-boot) expects for the 'root' + ;; kernel command-line option. + (list (string-append (if version>0? "root=" "--root=") root))) + (list #~(string-append (if #$version>0? "gnu.system=" "--system=") #$system) + #~(string-append (if #$version>0? "gnu.load=" "--load=") + #$system "/boot"))))) + +(define (ensure-not-/dev device) + "If DEVICE starts with a slash, return #f. This is meant to filter out +Linux device names such as /dev/sda, and to preserve GRUB device names and +file system labels." + (if (and (string? device) (string-prefix? "/" device)) + #f + device)) + +;; XXX: defined here instead of (gnu system) to prevent dependency loop +(define* (system-linux-image-file-name #:optional + (target (or (%current-target-system) + (%current-system)))) + "Return the basename of the kernel image file for TARGET." + (cond + ((string-prefix? "arm" target) "zImage") + ((string-prefix? "mips" target) "vmlinuz") + ((string-prefix? "aarch64" target) "Image") + ((string-prefix? "riscv64" target) "Image") + (else "bzImage"))) + + +;;; boot.scm ends here diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 0305128763..7000c470ed 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -70,6 +70,7 @@ (define-module (guix scripts system) #:use-module (gnu image) #:use-module (gnu system) #:use-module (gnu bootloader) + #:use-module (gnu system boot) #:use-module (gnu system file-systems) #:use-module (gnu system image) #:use-module (gnu system mapped-devices) diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm index 03a1d01aff..2e7976aa6c 100644 --- a/tests/boot-parameters.scm +++ b/tests/boot-parameters.scm @@ -27,6 +27,7 @@ (define-module (test-boot-parameters) #:use-module (gnu bootloader) #:use-module (gnu bootloader grub) #:use-module (gnu system) + #:use-module (gnu system boot) #:use-module (gnu system file-systems) #:use-module (gnu system uuid) #:use-module ((guix diagnostics) #:select (formatted-message?)) From patchwork Sun Aug 4 03:13:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66639 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 A4AC627BBEA; Sun, 4 Aug 2024 04:17: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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 E124527BBE2 for ; Sun, 4 Aug 2024 04:17:08 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjg-0003k4-Sz; Sat, 03 Aug 2024 23:16: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 1saRjf-0003ja-At for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16: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 1saRjf-0002Mc-1X for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16: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=nSh94YDMUPuaeE6kwLDSGjbptFIlIrKN0BZyuy3XTms=; b=Xn6/+W5VHiNXNVdbF9Gg1K9q8oB0ari+9UYIi+/FSVlppmNMo0Py+y6JP9OA/6X2FKVvY4AusJBumG8BGd4Q1zhaPXiemg15zFk0LNP6uvOfvrsYqn4piOTKqdVTpFimU3mOC4kKN16MDuGl25q+RepUJRxn7H3IXdBm287BF0f+535HfNBafWHXJzoZVpaKsFV1zmmBezNIeN4qxAcMjvPEtRgi6XybaBRAqsIHqlmaAMyFXisoIt9wwDXBuc2fM3+UW1QQHBMGlxtFEc6TRqTkSf+QCyvxfpncVyi5Q70upmSqwDiJIaPc5IN2WjpEhZuNnujQftvq035MQ64nSw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRjz-0007n9-Eg for guix-patches@gnu.org; Sat, 03 Aug 2024 23:17:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 03/12] Also move boot-parameters->menu-entry. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 04 Aug 2024 03:17:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274137029641 (code B ref 69343); Sun, 04 Aug 2024 03:17:03 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:10 +0000 Received: from localhost ([127.0.0.1]:54990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRj8-0007i0-11 for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:10 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:51704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRj5-0007h6-W4 for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:08 -0400 DKIM-Signature: a=rsa-sha256; b=p+hUvS8Xu2XM3odq+GQkkzndbUH17xgCGlJVOjEf0LXKxCit1uHG7TiJP4BcnQzstOdLGdDyTHQFNGC5RakWfPki4FVginF0e85VIRipUrOHrDWHy4A08FOZWquEiqzZ9RtCVNIdyi5kGKTKRFusPlY75Ul4P7bUdEfWMu+FGn2GQ5cPpH4RJ9xms/WcJYKlfTExcRn2PASFhWuoQE/57SpT4WqATl7e0Iu8QgcK5FEJzjBkcCyuf4tb5WeF3NIxZf9UzFooPoQX9LDNplJCurwzqJhoEvUcJfcNR2fh8RfwGhh2dbBI8RrCvqm3kLcr2AWHd8bOMEJc7Ixqtr6Jtg==; s=purelymail2; d=lunabee.space; v=1; bh=jy/kU1dLT9HOtgJ0JkSUOAOHJKl09vrJf8Tl6mXh85Q=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=eHjt6bbt466xWrBtW0kTZOohgjmXG///hFzMdW4LfoS2/58/weiz69/Uar0vsDbdhpuaZPmxrrqYHoIu1mD/Hrj2ROwg4WtUeMqVKmmm32NAiwTxl5HtPInUniofs3+pw9GkDlkAXqzXXPpFVqrVbkK18PeyvZc0xQCXFHUeZopVa8IjsgWfEhnmwPjpYjZnnzXGRN90QCiAPkg/cCX6DwSz+Qvua+9y1dkdAZ+UtSiFihmYYREmkcqmVo8d3wk81+wtnbWU7/bqy354FaKZmgvvYISlBpTFjhWkZexDjVGjPGRokZyv4K1aGrJlpwUG5X9akd5y5YJguh4Re5GWjQ==; s=purelymail2; d=purelymail.com; v=1; bh=jy/kU1dLT9HOtgJ0JkSUOAOHJKl09vrJf8Tl6mXh85Q=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:36 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:25 -0500 Message-ID: <9f0909b3323fd6dda448e7c9b36f9c46115dc778.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner * gnu/system.scm (boot-parameters->menu-entry): Move to... * gnu/system/boot.scm (boot-parameters->menu-entry): ...here. Change-Id: I794198e074b6d3012526a3056599ee3db1f1cdba --- gnu/system.scm | 28 ---------------------------- gnu/system/boot.scm | 25 ++++++++++++++++++++++++- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index 2e4b10e2fb..4a084b2ecf 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -151,8 +151,6 @@ (define-module (gnu system) hurd-default-essential-services - boot-parameters->menu-entry - local-host-aliases ;deprecated %root-account %setuid-programs @@ -314,32 +312,6 @@ (define* (operating-system-kernel-arguments (append (bootable-kernel-arguments os root-device version) (operating-system-user-kernel-arguments os))) - -;;; -;;; Boot parameters -;;; - -(define (boot-parameters->menu-entry conf) - "Return a instance given CONF, a instance." - (let* ((kernel (boot-parameters-kernel conf)) - (multiboot-modules (boot-parameters-multiboot-modules conf)) - (multiboot? (pair? multiboot-modules))) - (menu-entry - (label (boot-parameters-label conf)) - (device (boot-parameters-store-device conf)) - (device-mount-point (boot-parameters-store-mount-point conf)) - (linux (and (not multiboot?) kernel)) - (linux-arguments (if (not multiboot?) - (boot-parameters-kernel-arguments conf) - '())) - (initrd (boot-parameters-initrd conf)) - (multiboot-kernel (and multiboot? kernel)) - (multiboot-arguments (if multiboot? - (boot-parameters-kernel-arguments conf) - '())) - (multiboot-modules (if multiboot? - (boot-parameters-multiboot-modules conf) - '()))))) ;;; diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index 7bae9d2102..df27b8aea4 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -70,6 +70,8 @@ (define-module (gnu system boot) read-boot-parameters-file bootable-kernel-arguments + boot-parameters->menu-entry + ensure-not-/dev system-linux-image-file-name)) @@ -294,6 +296,28 @@ (define* (bootable-kernel-arguments system root-device version) #~(string-append (if #$version>0? "gnu.load=" "--load=") #$system "/boot"))))) +(define (boot-parameters->menu-entry conf) + "Return a instance given CONF, a instance." + (let* ((kernel (boot-parameters-kernel conf)) + (multiboot-modules (boot-parameters-multiboot-modules conf)) + (multiboot? (pair? multiboot-modules))) + (menu-entry + (label (boot-parameters-label conf)) + (device (boot-parameters-store-device conf)) + (device-mount-point (boot-parameters-store-mount-point conf)) + (linux (and (not multiboot?) kernel)) + (linux-arguments (if (not multiboot?) + (boot-parameters-kernel-arguments conf) + '())) + (initrd (boot-parameters-initrd conf)) + (multiboot-kernel (and multiboot? kernel)) + (multiboot-arguments (if multiboot? + (boot-parameters-kernel-arguments conf) + '())) + (multiboot-modules (if multiboot? + (boot-parameters-multiboot-modules conf) + '()))))) + (define (ensure-not-/dev device) "If DEVICE starts with a slash, return #f. This is meant to filter out Linux device names such as /dev/sda, and to preserve GRUB device names and @@ -314,5 +338,4 @@ (define* (system-linux-image-file-name #:optional ((string-prefix? "riscv64" target) "Image") (else "bzImage"))) - ;;; boot.scm ends here From patchwork Sun Aug 4 03:13:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66640 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 AE62727BBEA; Sun, 4 Aug 2024 04:17:12 +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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 D6B7F27BBE2 for ; Sun, 4 Aug 2024 04:17:11 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjw-0003mN-TF; Sat, 03 Aug 2024 23:17:00 -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 1saRji-0003k9-DP for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:46 -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 1saRji-0002Q4-2y; Sat, 03 Aug 2024 23:16:46 -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=rF0HxWCgcf/VEP5PbScOUADP1Ar6Ys6Ha2KztD/zTHU=; b=qimGvw0WSIBC+5mJFIS8/xe0M1547Yc3nrPYCKsnjS8PrcTNA7kuBMQ/aweeRCQN/IB8YJ//WmNn1UO1tcx3QmDopuATt2nT27jf6ny2iiPoi8n+Gb+cdawY9UHE0Pycl1Lu8SjJg+81osVbx+bJDUleflb/BwXdzBpcNrRwG3n7xoyoWwiEJdwe9ewSsPenMiB2swsyQYcBg7RTY3g3UU9tTfYFyOKzxI/y6qxAGeUQE50tkiDp0Bq4vFzp6V9kawQWzCkjVYa8BUXmAaWfCad9Nfsa6LZeBpYyrlaiRz67l/BV1SUKuPWCtGxBxLeThNJarwpXIZPsR6Y7zGyFVw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk0-0007nU-E5; Sat, 03 Aug 2024 23:17:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 04/12] Rename seconds->string procedure to epoch->date-string. Resent-From: Lilah Tascheter 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: Sun, 04 Aug 2024 03:17:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274137829691 (code B ref 69343); Sun, 04 Aug 2024 03:17:04 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:18 +0000 Received: from localhost ([127.0.0.1]:54997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjF-0007in-Lu for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:18 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:56516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjE-0007iF-81 for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:16 -0400 DKIM-Signature: a=rsa-sha256; b=V6I/7vg/b2+EwJvyM0aV8xMcwnGRVZcFa4/KebBRmW08vjw0zeNBOukyf4bnnzbIA3aRRX+kQA+YFKcnI6qChS+8XuGDUMoliH9HdhIIg/8PJuaFJPcOCMuBZE3AOU6VFIEWnhbh0FPUTlU3obOxalkN5G9UNq/abOb4DouzWC2U7E/qOxVhfmBAfQPSj72YRdFNFzLcRM95UPvSQM/ajQCFuCuMJgDsr30jFfj2oeJht7R1klGhubPsGKuY6Qh6hYK5+t+LPBOPYPL2D+2vHEGpOP929vIvMEbc6BS5ypOxpwA0wJ4xeZZzq3yMgDOVocTcuZO+495D7QpNX5m0IQ==; s=purelymail2; d=lunabee.space; v=1; bh=oThLW0/lymMCVSVmKwy8oE8qI6vmgdd2ZBmkRVkECVU=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=k0PuBkTvqP2YyjuIkVV2JVBTEiZ+t/S2YoMpACHm/07u56Hkd+swh4wHru/5G0MTCjgeJ+Kk7fC56udwbby1DD6lOVQwalFDiiYo/pbkcRUrnjyRe6IPP4fIZpcDq4sT9JPsGK4NCyb5iHDOJGIWIMFLZinWCRUDzsP5msy9Vlgomzj6QdnItGdZGZU1EA0sISbKbTAbFwa6tSkBNbaH7Ges96h0Ip/vrjOIdyLr5MrRGfhxeNc/lZhstoe7/af+OBg0BEWQPWjCq4yOlxwxl9neJr8FNaMYfp1xSL9X/E2L9yzmEV6gxgzRGp0Gde5haR+hI4zZOM4QgkV+QWaikA==; s=purelymail2; d=purelymail.com; v=1; bh=oThLW0/lymMCVSVmKwy8oE8qI6vmgdd2ZBmkRVkECVU=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:37 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:26 -0500 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner * guix/scripts/system.scm (seconds->string): Rename to epoch->date-string. (profile-boot-parameters)[boot-parameters]: Update as above. Change-Id: I2b9aaa816b3ca84c32f7d6fa690245b149228310 --- guix/scripts/system.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 7000c470ed..cb70d36219 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -328,9 +328,9 @@ (define-syntax-rule (unless-file-not-found exp) #f (apply throw args))))) -(define (seconds->string seconds) - "Return a string representing the date for SECONDS." - (let ((time (make-time time-utc 0 seconds))) +(define (epoch->date-string epoch) + "Return a string representing the date for EPOCH seconds." + (let ((time (make-time time-utc 0 epoch))) (date->string (time-utc->date time) "~Y-~m-~d ~H:~M"))) @@ -348,7 +348,7 @@ (define* (profile-boot-parameters #:optional (profile %system-profile) (inherit params) (label (string-append label " (#" (number->string number) ", " - (seconds->string time) ")")))))) + (epoch->date-string time) ")")))))) (let* ((systems (map (cut generation-file-name profile <>) numbers)) (times (map (lambda (system) From patchwork Sun Aug 4 03:13:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66645 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 4083727BBEA; Sun, 4 Aug 2024 04:17: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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 D72D327BBE2 for ; Sun, 4 Aug 2024 04:17:43 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjv-0003lY-E7; Sat, 03 Aug 2024 23:16:59 -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 1saRji-0003k7-BB for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:46 -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 1saRjh-0002PV-ML; Sat, 03 Aug 2024 23:16:45 -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=GkXQmKfGKePQaC1SQcLmSTKCPVMRu4FhXICXbMjDOng=; b=b+DkXqOwrmAeH+s/dmrq3hUAduMDjHlxrN1IitkUdRPuynPbdlkOnSGPQqF0ZtS6tTPqrJlh/vsTXtL4OnpVwMpCgwc1WlgD+GIWc8E1M+ZTWnkf7oAsRJK9tMZc/7wIp40XyeAbw9MJzTeMet55jXNiQP+gmEWYUMDusffOzLjOKRGSklqblWWKDCrP32FuFya5Gd85CN+LvFWKHv+8OBRLAuAFJPpZ8nQYF0xnv+/vltT/5FWEg0GOhPetYnBxw5P3uW5zQ2vaKGXxv/l/h9sXaQBsXAGDEFV7CYy9DHq1yLxH0/sj5GHHOXgVfDK6SOJNdpKqGphzV2IO5moaPA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk0-0007nf-Um; Sat, 03 Aug 2024 23:17:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 05/12] Move epoch->date-string to gnu/system/boot.scm and use it elsewhere. Resent-From: Lilah Tascheter 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: Sun, 04 Aug 2024 03:17:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274139629776 (code B ref 69343); Sun, 04 Aug 2024 03:17:04 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:36 +0000 Received: from localhost ([127.0.0.1]:55005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjX-0007k4-LM for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:36 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:56536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjV-0007jP-Og for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:34 -0400 DKIM-Signature: a=rsa-sha256; b=q45eCk3kECGfYW+hvIkxhiTpR/E78iUuhibKoz7O+pDCQFmLS78P23LsGPSsmcuYPdN9HXufi3yzN7jp/76by1c5JhX6+OnL8bszqWPwMxgWGl+I156jIxyPpMIdN/i1lstd9Qcv6Mjcqm91lNA6tlQO9dn6ioOL6rVYgAsLDr3Nk1ZXxbQe5UHU59+olCv++B7aenNze78Jvaw3f74b6Ex/l5BsUjwSFffiGN6goq0Vh9eSwVc6n03VbTaM+KViy5796UfkXvTB1/3etbmdUcq3sD4PAspjqV+o2f8aDVXeYnLvNkkgrrQfUiSR5jUrhEY80hIie8rBxwib73Vnxg==; s=purelymail2; d=lunabee.space; v=1; bh=fwzoCc7y6ItU44Puf4gL6wng+1TnmX0zYcUUjQTfsJo=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=qIRbQS1VNZHJKWiNuEA92m4ikWRisVVRSzvOIVzhoccAUOnitVTEXejW338HtL0YWAH2CNnT1TtlW9SaVwINcIru6GqP7RCMf6BLe3cyRpcEEjxXiJCKMA753jGgJcB7AoFNEyupXQLzbPWkfJsuGcUiOWeHD7S8Lgunfqb0ezTIkrLhaS47ys7N0vbKNUf2cqn6bv/wJvVfNsWxwTtFhNLS3G4sGJM0Cl9wvhZXz8UZeQH2pj7C8Wh8GOkSziFi9e5nsqtlOEaYZyMu7+tahlyF0lPNeP4cSOxq66R3cHh5pr/hHT71c87cYfy/BPpMs08vplcsW8yy8EXP23Esfg==; s=purelymail2; d=purelymail.com; v=1; bh=fwzoCc7y6ItU44Puf4gL6wng+1TnmX0zYcUUjQTfsJo=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:37 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:27 -0500 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner * guix/scripts/system.scm (profile-boot-parameters): Rename time to epoch to fit new procedure name. (epoch->date-string): Move to... * gnu/system/boot.scm (epoch->date-string): ...here. * gnu/machine/ssh.scm (machine-boot-parameters): Rename time to epoch. (machine-boot-parameters)[boot-parameters]: Use epoch->date-string. Change-Id: I6a5f793567221f81edd7b2d8d9f0f3e801d1b113 --- gnu/machine/ssh.scm | 10 ++++------ gnu/system/boot.scm | 8 ++++++++ guix/scripts/system.scm | 10 ++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 749aa2b6d8..e68e64527e 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -442,10 +442,10 @@ (define (machine-boot-parameters machine) generation)) (boot-parameters-path (string-append system-path "/parameters")) - (time (stat:mtime (lstat system-path)))) + (epoch (stat:mtime (lstat system-path)))) (list generation system-path - time + epoch (read-file boot-parameters-path)))) (reverse (generation-numbers %system-profile))))))) @@ -453,7 +453,7 @@ (define (machine-boot-parameters machine) (return (map (lambda (generation) (match generation - ((generation system-path time serialized-params) + ((generation system-path epoch serialized-params) (let* ((params (call-with-input-string serialized-params read-boot-parameters)) (root (boot-parameters-root-device params)) @@ -464,9 +464,7 @@ (define (machine-boot-parameters machine) (label (string-append label " (#" (number->string generation) ", " - (let ((time (make-time time-utc 0 time))) - (date->string (time-utc->date time) - "~Y-~m-~d ~H:~M")) + (epoch->date-string epoch) ")")) (kernel-arguments (append (bootable-kernel-arguments system-path root version) diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index df27b8aea4..01e3a965e4 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -45,6 +45,7 @@ (define-module (gnu system boot) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-19) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:use-module (rnrs bytevectors) @@ -70,6 +71,7 @@ (define-module (gnu system boot) read-boot-parameters-file bootable-kernel-arguments + epoch->date-string boot-parameters->menu-entry ensure-not-/dev @@ -296,6 +298,12 @@ (define* (bootable-kernel-arguments system root-device version) #~(string-append (if #$version>0? "gnu.load=" "--load=") #$system "/boot"))))) +(define (epoch->date-string epoch) + "Return a string representing the date for EPOCH seconds." + (let ((time (make-time time-utc 0 epoch))) + (date->string (time-utc->date time) + "~Y-~m-~d ~H:~M"))) + (define (boot-parameters->menu-entry conf) "Return a instance given CONF, a instance." (let* ((kernel (boot-parameters-kernel conf)) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index cb70d36219..b197812e63 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -328,19 +328,13 @@ (define-syntax-rule (unless-file-not-found exp) #f (apply throw args))))) -(define (epoch->date-string epoch) - "Return a string representing the date for EPOCH seconds." - (let ((time (make-time time-utc 0 epoch))) - (date->string (time-utc->date time) - "~Y-~m-~d ~H:~M"))) - (define* (profile-boot-parameters #:optional (profile %system-profile) (numbers (reverse (generation-numbers profile)))) "Return a list of 'boot-parameters' for the generations of PROFILE specified by NUMBERS, which is a list of generation numbers. The list is ordered from the most recent to the oldest profiles." - (define (system->boot-parameters system number time) + (define (system->boot-parameters system number epoch) (unless-file-not-found (let* ((params (read-boot-parameters-file system)) (label (boot-parameters-label params))) @@ -348,7 +342,7 @@ (define* (profile-boot-parameters #:optional (profile %system-profile) (inherit params) (label (string-append label " (#" (number->string number) ", " - (epoch->date-string time) ")")))))) + (epoch->date-string epoch) ")")))))) (let* ((systems (map (cut generation-file-name profile <>) numbers)) (times (map (lambda (system) From patchwork Sun Aug 4 03:13:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66644 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 D88DD27BBEA; Sun, 4 Aug 2024 04:17:45 +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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 135A527BBEA for ; Sun, 4 Aug 2024 04:17:42 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjw-0003mM-Hz; Sat, 03 Aug 2024 23:17:00 -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 1saRji-0003kM-Is for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:50 -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 1saRji-0002QA-8S; Sat, 03 Aug 2024 23:16:46 -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=6LoXyj9UOcexnup6hT4O6jhziYxcYAq98lt6s/cozcc=; b=JR2IJ+aeLmf3TrvQyb8NUC3lK1EXvWJFP4j0aTVXGYs3Kb53GEa6cOa8ES3CHbgJ0uecOxoMFAYjxGhXuQJSoYX1zOShzlsJBgDA5VUNqtbENggWQYonklq+y93pde/TiC4AFn39dJiknW3S233+Ax9/IbvqTQU8cv8349wbMS7m8BkL2dcPhccIKHOnyZWOqA2pexZuj/Z34XdsC2ZScJMguyDp13dGZ5JADFqz9j5zbyViICXHKIYpV3u6CDKoK6/NtmGpKpX4WHLorfOlFZhRrwjuaWvev1o6T91Qv5FYBbuJRYTUSR3pbe8uyPsNI6Y5qJF2Hmt9un9n7+3Ygg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk1-0007nr-I2; Sat, 03 Aug 2024 23:17:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 06/12] Offer a uniform decorated-boot-label and use it. Resent-From: Lilah Tascheter 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: Sun, 04 Aug 2024 03:17:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274139829786 (code B ref 69343); Sun, 04 Aug 2024 03:17:05 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:38 +0000 Received: from localhost ([127.0.0.1]:55007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjZ-0007kJ-KD for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:38 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:51806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjX-0007jW-I3 for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:36 -0400 DKIM-Signature: a=rsa-sha256; b=YWXon0l1i47J4x8o/ysxps2DDy1sdjpRFwkHSxHoje2Dmt/Sp6KMyUxfBhAouzKeXtQNccfBrQHVJTRGvsjbaRUf0WU+RtN7IEfg3TBrcwB1l5Ru1Jk7Vuo9LTGG8e7vL5ZbdkAuQJfS61QM5+U2+0W/Kxw8ApMrPy98phcBTyqXqJKw+XwdyDF56PnuYOXg/t1Dg8+JM1f0glHO3R53ecLtPULzt+nWVOHE1jLGEgL3oJI49SEqRlj/iCUpLgCVU8OJ8Igjl7aOtryuihMYi+ezzltGJjBqfAGImemmtlSOnxn3GC3U/dsGt6fXPKLQw/LHMxBgyWWrTwjIcCbIjg==; s=purelymail2; d=lunabee.space; v=1; bh=fU4zrS3h+RESWGPofXsOm6UJWY6GaeME8xd4jKqnYus=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=DhnSa8QVVsVDa6xyGvjdBobFM3gYy5tXyUS9N/ujn/2QhShCpuwRSSGUoImGGHzqyPNkyoYQID1V+/6HC02AdoeECS5a69vsxa/6Y27PnIG1kXoh6dj4lCmrqQEAz/lMN/Vgqd+DQ/tiz0Hqw+dhGPwsrrGTf6/bEZehQ7/9A5FFGhFhRW+7rugO88nnWYMvUQJOPHogze5WIwjWjzPY2oGg8ttwP4Jk4LQvGoanuoy9koytuMP6plYNQIt5o/jYOZB818IasBWqnAVARVRNDtV8x1tEskdcRT+1y0FsrcAKVJar943H7VXkeNh5vWejY+qR2M5KPToh/1yHjwh0/Q==; s=purelymail2; d=purelymail.com; v=1; bh=fU4zrS3h+RESWGPofXsOm6UJWY6GaeME8xd4jKqnYus=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:38 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:28 -0500 Message-ID: <1cd48d746543091532044ffa979cacc17f725cc7.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner * gnu/system/boot.scm (decorated-boot-label): New procedure. * gnu/machine/ssh.scm (machine-boot-parameters): Use decorated-boot-label. * guix/scripts/system.scm (profile-boot-parameters)[system->boot-parameters]: Use decorated-boot-label. Change-Id: Id348c3047df2353f76b1bad0eb2a3e0fa17e474c --- gnu/machine/ssh.scm | 8 ++------ gnu/system/boot.scm | 13 +++++++++++++ guix/scripts/system.scm | 8 +++----- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index e68e64527e..3971469e33 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -457,15 +457,11 @@ (define (machine-boot-parameters machine) (let* ((params (call-with-input-string serialized-params read-boot-parameters)) (root (boot-parameters-root-device params)) - (label (boot-parameters-label params)) + (text (boot-parameters-label params)) (version (boot-parameters-version params))) (boot-parameters (inherit params) - (label - (string-append label " (#" - (number->string generation) ", " - (epoch->date-string epoch) - ")")) + (label (decorated-boot-label text generation epoch)) (kernel-arguments (append (bootable-kernel-arguments system-path root version) (boot-parameters-kernel-arguments params)))))))) diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index 01e3a965e4..b1302b8786 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -72,6 +72,7 @@ (define-module (gnu system boot) bootable-kernel-arguments epoch->date-string + decorated-boot-label boot-parameters->menu-entry ensure-not-/dev @@ -304,6 +305,18 @@ (define (epoch->date-string epoch) (date->string (time-utc->date time) "~Y-~m-~d ~H:~M"))) +(define (decorated-boot-label text generation epoch) + "Return a string for a nice boot label that includes TEXT, a numbered GENERATION, +and a timestamp derived from EPOCH seconds." + (let* ((numbered (lambda (number) (string-append "#" (number->string number)))) + (count (and=> generation numbered)) + (timestamp (and=> epoch epoch->date-string)) + (extras (filter identity (list count timestamp))) + (helpful (if (null? extras) + "" + (string-append "(" (string-join extras ", ") ")")))) + (string-join (list text helpful)))) + (define (boot-parameters->menu-entry conf) "Return a instance given CONF, a instance." (let* ((kernel (boot-parameters-kernel conf)) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index b197812e63..84eb99b938 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -337,12 +337,10 @@ (define* (profile-boot-parameters #:optional (profile %system-profile) (define (system->boot-parameters system number epoch) (unless-file-not-found (let* ((params (read-boot-parameters-file system)) - (label (boot-parameters-label params))) + (text (boot-parameters-label params))) (boot-parameters - (inherit params) - (label (string-append label " (#" - (number->string number) ", " - (epoch->date-string epoch) ")")))))) + (inherit params) + (label (decorated-boot-label text number epoch)))))) (let* ((systems (map (cut generation-file-name profile <>) numbers)) (times (map (lambda (system) From patchwork Sun Aug 4 03:13:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66650 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 B193D27BBEA; Sun, 4 Aug 2024 04:17:52 +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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 D3AD927BBE2 for ; Sun, 4 Aug 2024 04:17:50 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjx-0003mT-9e; Sat, 03 Aug 2024 23:17:01 -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 1saRjk-0003kV-MI for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:50 -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 1saRjk-0002Qz-2o; Sat, 03 Aug 2024 23:16:48 -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=xH6N3KcjXiHGSeavyBCwt+jekQZziNo2tyGwxHomiik=; b=sVqUSWK44KIQw6GajxMMdQu/67j/FNyNJRwRADQDoJU9pMq2YPN9mZEevbLqYy+OXfdr/DnbdvmZn8H9JwXyxEKd9KMWV0dzZSZI79gIyAQteSFJ2pAdfMPbieugkS3QPJw9ODnI01knGeCrM4YOmXavsMlCDg+EwXZT7myyXTxXbsl05eXi8g94y28uIzmKTlY4R+6AXKQ06BtMezsEBJSl0S7mPgaOCr+YOLq7vZHJAnhzFyZGPVDT2ZVDbhWQb61iX/3zda699gzeZdtO2VNz8Is2rrIkUXhh2GHkw1qJ7pbzCZu9QvxDUFO6sQh5KqPcQQhiFyCy/z6f2VG9CA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk2-0007o6-2Z; Sat, 03 Aug 2024 23:17:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 07/12] Rename boot-parameters to boot-alternatives when appropriate. Resent-From: Lilah Tascheter 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: Sun, 04 Aug 2024 03:17:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274140229807 (code B ref 69343); Sun, 04 Aug 2024 03:17:06 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:42 +0000 Received: from localhost ([127.0.0.1]:55012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRje-0007kg-47 for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:42 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:51810) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjc-0007k3-JW for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:41 -0400 DKIM-Signature: a=rsa-sha256; b=q2CM70bFf/bT5SsHpAYk/IZA4mhFV82oVVM1rV+riK8ZsCtsLV9ABNefDlKMXWUA4lemmAwBkk8oVAXOCNy/dqaahl0ogzHzXWuMcNSttU/D25qqd1MYKPuYPLp1hJfIp+m0kdHOpVOFGbvTFbu9To06P6NDHCn6oAYCQLD7K0SSSow5TtDF9m36ZrGMzV0rh3aQy8fR/r0vnhTYx/9W3UuQ8hZvKw7DELdv0H9GdEBtabSH47jeUzNCLS2nGp5y4yo1PK8TJ1b2N6ivYyKoL43QwoCo7LGb1KtQuxh8ixnAKWiHpqWN23TonlC+hFbujq0s+uFSpu1IJsawqYKWfw==; s=purelymail2; d=lunabee.space; v=1; bh=y5Tz2MCs2MM3YaWA05pWXrUKfFWXWXur/6HXGs15djE=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=IZgdHsiuGExBfhHonsIeDJvx7dFsKCMz6JtcqYgzeqZb9slc7w9UaRW7wlVIBxXSYig+S9epRA44S9sFMepyB+nVPT0a/gibzB/soYAXTWCpKm0UsfcFPLGC/4bq8PTiaWiBNpYDqFNe0cBlp99L3VK0XE1InQKQWTK3XZeLZEofrGI3CoG1kI+TTOTQptjEQvQmFsFKosZt/5itV9JltqGOypkj5ledsNtKGXsQGjWThcTPcwpF30Mdw/4aOn+tW3FdyHwsPXUhFNB9OrtateQmD78ZYL9EmY9vR2eUCITJOFXewh+ilUNGabvC4H37OOo90MNdWM20pU3y2cPxSw==; s=purelymail2; d=purelymail.com; v=1; bh=y5Tz2MCs2MM3YaWA05pWXrUKfFWXWXur/6HXGs15djE=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:39 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:29 -0500 Message-ID: <0bc81e0b885d720e8b094a64f22253248425e787.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner Throughout the code base, the token 'boot-parameters' refers to collection of data that is stored on disk for each system generation. It was confusing to use it for a list of such records. This comment imposes an alternative name. * gnu/machine/ssh.scm (machine-boot-parameters): Rename to machine->boot-alternatives. (machine->boot-alternatives, roll-back-managed-host): Use boot-alternatives instead of boot-parameters as appropriate. * guix/scripts/system.scm (profile-boot-parameters): Rename to profile->boot-alternatives. (reinstall-bootloader, perform-action): Use boot-alternatives instead of boot-parameters as appropriate. Change-Id: Iabb04dbb39f42f989692bede7304f20a69bef9fb --- gnu/machine/ssh.scm | 20 ++++++++++---------- guix/scripts/system.scm | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 3971469e33..f3d2a77625 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -415,7 +415,7 @@ (define not-config? (('gnu _ ...) #t) (_ #f))) -(define (machine-boot-parameters machine) +(define (machine->boot-alternatives machine) "Monadic procedure returning a list of 'boot-parameters' for the generations of MACHINE's system profile, ordered from most recent to oldest." (define remote-exp @@ -501,14 +501,14 @@ (define (deploy-managed-host machine) (machine-become-command machine))) (mlet %store-monad ((_ (check-deployment-sanity machine)) - (boot-parameters (machine-boot-parameters machine))) + (boot-alternatives (machine->boot-alternatives machine))) ;; Make sure code that check %CURRENT-SYSTEM, such as ;; %BASE-INITRD-MODULES, gets to see the right value. (parameterize ((%current-system system) (%current-target-system #f)) (let* ((os (machine-operating-system machine)) (eval (cut machine-remote-eval machine <>)) - (menu-entries (map boot-parameters->menu-entry boot-parameters)) + (menu-entries (map boot-parameters->menu-entry boot-alternatives)) (bootloader-configuration (operating-system-bootloader os)) (bootcfg (operating-system-bootcfg os menu-entries))) (define-syntax-rule (eval/error-handling condition handler ...) @@ -579,19 +579,19 @@ (define (roll-back-managed-host machine) (define roll-back-failure (condition (&message (message (G_ "could not roll-back machine"))))) - (mlet* %store-monad ((boot-parameters (machine-boot-parameters machine)) - (_ -> (if (< (length boot-parameters) 2) + (mlet* %store-monad ((boot-alternatives (machine->boot-alternatives machine)) + (_ -> (if (< (length boot-alternatives) 2) (raise roll-back-failure))) (entries -> (map boot-parameters->menu-entry - (list (second boot-parameters)))) + (list (second boot-alternatives)))) (locale -> (boot-parameters-locale - (second boot-parameters))) + (second boot-alternatives))) (crypto-dev -> (boot-parameters-store-crypto-devices - (second boot-parameters))) + (second boot-alternatives))) (store-dir -> (boot-parameters-store-directory-prefix - (second boot-parameters))) + (second boot-alternatives))) (old-entries -> (map boot-parameters->menu-entry - (drop boot-parameters 2))) + (drop boot-alternatives 2))) (bootloader -> (operating-system-bootloader (machine-operating-system machine))) (bootcfg (lower-object diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 84eb99b938..cdd78a7849 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -328,9 +328,9 @@ (define-syntax-rule (unless-file-not-found exp) #f (apply throw args))))) -(define* (profile-boot-parameters #:optional (profile %system-profile) - (numbers - (reverse (generation-numbers profile)))) +(define* (profile->boot-alternatives #:optional (profile %system-profile) + (numbers + (reverse (generation-numbers profile)))) "Return a list of 'boot-parameters' for the generations of PROFILE specified by NUMBERS, which is a list of generation numbers. The list is ordered from the most recent to the oldest profiles." @@ -395,18 +395,19 @@ (define (reinstall-bootloader store number) (bootloader bootloader))) ;; Make the specified system generation the default entry. - (params (first (profile-boot-parameters %system-profile - (list number)))) + (params (first (profile->boot-alternatives %system-profile + (list number)))) (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)))) - (old-params (profile-boot-parameters - %system-profile old-generations)) + (previous-boot-alternatives (profile->boot-alternatives + %system-profile old-generations)) (entries (list (boot-parameters->menu-entry params))) - (old-entries (map boot-parameters->menu-entry old-params))) + (old-entries (map boot-parameters->menu-entry + previous-boot-alternatives))) (run-with-store store (mlet* %store-monad ((bootcfg (lower-object @@ -823,7 +824,7 @@ (define* (perform-action action image os (if (eq? action 'init) '() - (map boot-parameters->menu-entry (profile-boot-parameters)))))) + (map boot-parameters->menu-entry (profile->boot-alternatives)))))) (when (eq? action 'reconfigure) (maybe-suggest-running-guix-pull) From patchwork Sun Aug 4 03:13:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66648 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 53FD627BBED; Sun, 4 Aug 2024 04:17:50 +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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 BF22727BBEA for ; Sun, 4 Aug 2024 04:17:47 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjx-0003mR-45; Sat, 03 Aug 2024 23:17:01 -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 1saRji-0003kN-L8 for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:50 -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 1saRji-0002QH-BF for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:46 -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=FQIV5Ox8Z+GX38pe35gzv0h+S1S6x8OT5fQyhtOFKdU=; b=GYylzN1Iu6Tl6+f2HPJRDCTcz0SQSzrs0Iv47ji2zqQpFBrjVBkk+XVU/bOtkuZEX2fgRnkKDrj1rmbpPiPSE3FBHed/gOUmIF5m0GeK9p2I/5LBncsxCqokrCHLX5G2nlXuC5f4CplDRQm8kn5i3H2gCeur9h7OX5+U0JNosHIgfi1pcUTk046/OLri8bGpgddpAZghcHDv4LwUlRyuh73tC3UYJP00xIS+qOxiCqML/7tvpkjTfj+TX1dfY3phS8tZBEqSjRWLbrsIFnwwbUflqDXSGW+Go9JfqfFywMclGs7Q4JxK/pQ8/ucGcw4MQX8wTC1IcOS/qgKgGL1BCQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk2-0007oK-Mk for guix-patches@gnu.org; Sat, 03 Aug 2024 23:17:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 08/12] Rename two remote variables confusingly named 'generations'. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 04 Aug 2024 03:17:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274140529826 (code B ref 69343); Sun, 04 Aug 2024 03:17:06 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:45 +0000 Received: from localhost ([127.0.0.1]:55017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjg-0007l0-PB for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:45 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:56582) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjf-0007kS-7b for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:43 -0400 DKIM-Signature: a=rsa-sha256; b=ixXog01r+kpMlOje5vqmk9Sx29cVRLsDE68Q0nH0ZblGlHH7q0250at82QU0bcYXIWSbIpyhe2gpO7+OJwFmAZLLeS7DNGKbxpYYxvuB8EISykEeMxJ+puhjvXAoniOl1hsf5Tj5/M/tkLYwmuKFGxUtVAp/fTaGeEsYnDQxF4E074CFHfip0mAVnaRSh8sSD3EFRCZu8AdmIudtynnHG5fwAX3o4XT7enMqPSBejw333xhNyw0xBNj6VEU0mSASa7gBsTGkb1yhR3GffJq7ujv2z8qk2mmU3bdYCFj0G0cKGwv7wU2+DCcmv0+H40zMnu8XHJeJx4fP17iNutHSsw==; s=purelymail2; d=lunabee.space; v=1; bh=8Y3lwlhVZfv4H/3/f/+71DSSH9NmrIzG73u+i2tfSKY=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=EQCNT6By20f/bsVJIAfAjVOA+AzEy04je5/X/dwgfRA9WPpcYeHk4ay7is119Ugt0ZiSJd4E/MHUunl/cdhYuuxr4Q3DLQSFYh7W7TFn7JCrYsumNJzm6RUZfsS0hM+AloatWo/W/xqQBoPubvedBOJ82zhCSzRhCutwx+JBKcsIlBiLzEJ0P5P9DWWqEe8VccVMr+TYER3m6puiFHGos1SEduTSwoPEivCH4SZegsLxttKboiXL1LIhS1CPZN9QhGRNk9Q9bVDwcFKXWlNPt74qhq0N3VqxgxE24gwQJ3LudLkRGztRO2z1GIOGll9nrF/u0bg7SDuG8N3M/BrOLA==; s=purelymail2; d=purelymail.com; v=1; bh=8Y3lwlhVZfv4H/3/f/+71DSSH9NmrIzG73u+i2tfSKY=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:39 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:30 -0500 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner Both refer to data sets returned from the remote expression, and one of them shadowed an element of itself. * gnu/machine/ssh.scm (machine->boot-alternatives): Rename generations to remote-results. Change-Id: Ibd8a3036126d9da1215cfc191884c0f54df637df --- gnu/machine/ssh.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index f3d2a77625..75b02bff50 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -449,10 +449,10 @@ (define (machine->boot-alternatives machine) (read-file boot-parameters-path)))) (reverse (generation-numbers %system-profile))))))) - (mlet* %store-monad ((generations (machine-remote-eval machine remote-exp))) + (mlet* %store-monad ((remote-results (machine-remote-eval machine remote-exp))) (return - (map (lambda (generation) - (match generation + (map (lambda (remote-result) + (match remote-result ((generation system-path epoch serialized-params) (let* ((params (call-with-input-string serialized-params read-boot-parameters)) @@ -465,7 +465,7 @@ (define (machine->boot-alternatives machine) (kernel-arguments (append (bootable-kernel-arguments system-path root version) (boot-parameters-kernel-arguments params)))))))) - generations)))) + remote-results)))) (define-syntax-rule (with-roll-back should-roll-back? mbody ...) "Catch exceptions that arise when binding MBODY, a monadic expression in From patchwork Sun Aug 4 03:13:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66641 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 C5EED27BBEA; Sun, 4 Aug 2024 04:17:26 +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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 487C727BBE2 for ; Sun, 4 Aug 2024 04:17:26 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjw-0003mL-6x; Sat, 03 Aug 2024 23:17:00 -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 1saRjj-0003kO-1X for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:50 -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 1saRji-0002Qd-OI for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:46 -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=C1+PJ+OdJrDOMqoOuxR7drYS7s9EdXbDe6sodPYZ/MQ=; b=W+KC0sC3wSpy8bUNaAMKZ264D5c2VoxmN48owBDO9UFGacGSph3SL3Jy7cYBuUwB8bXroUUGAyNyhIsHOr73daCv7+uSZ/p94LEkk8Wm0w29nDubUq7ZPvE9lcnn5lXPrfYoSx3G+MaBrTnfryvVrJjaCuqpm0up3lxNO2wsly2+lMnj5uT8k0PPxsj446YuHNSDolb3XuHTHptnTFrOEtiICl2j5xb85ESNOVUOfQ2lk+u5XlvnON3rG5ZpYfJSHInl4fOAuANq+xEcmFHPxJ10yFpWSYWul2w52Fqe060/TYgVXO14o7Jnn4cfrV4JWMc35fBevxrGwTWrmKwytQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk3-0007oX-6U for guix-patches@gnu.org; Sat, 03 Aug 2024 23:17:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 09/12] Give a separate name to a commonly used expression. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 04 Aug 2024 03:17:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274140729845 (code B ref 69343); Sun, 04 Aug 2024 03:17:07 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:47 +0000 Received: from localhost ([127.0.0.1]:55022 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjj-0007lJ-5J for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:47 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:51922) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjh-0007kZ-J3 for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:45 -0400 DKIM-Signature: a=rsa-sha256; b=I9T/4sY9fz149ShK0VpLjWmYSXmSHSY/h39zdB7icindQY7D6o87ZPE+M9G820dwZMuEiX2su0D6ZNHWzQu6c7WiooUHrjtlg4zbQ5EmfUymJVs8OjAnpFeuYw5GGkgagFvG+y89pbm+Mjf3vZBfhRy1XIoT4VS5Ul6b0sORmItbvecXfA2Ngh+txZ2i7P7rvlO9+DIHT5jmoGtHbkwHSe0f1AqQrP62zjxqJN7Ee2/FmZVU3oj2P+5tBnwiE4gWP/kIvKvGp1DVcjJ30MLuc/HY09ycCAJxBXpD1gYpWafha4eNfDkdcfx5/UE+s8K70qLAwPEbl4PHB/nw7ozB+Q==; s=purelymail2; d=lunabee.space; v=1; bh=4MuWm+0iaQXUgxclHAHItfhlMj6cT4OP/EafMQjnn+g=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=P+yYzydrET0+G3PEukGwnKJ6M2gzXPhQE712nELbHwpVHzOWd3Dmicwm3Fu++zBzy9Rs4bOx3FUiLCk5dNBo80tcarW7mzpC7cRnJzelAme/zH9h5y+jkZi3zMHi1O2cP4NnXoMh0F0tEB0yrseYne17Cki5ZDefzMXOsfJe3oIX15l99m6erjig49LIv2ZTARKc4ggIldmGodwrrmMu73QQONvWBKucPfWczBieq1vo4TTDL0WSP8udodk2Vy6L1A6fPaPEUrIpDcngnc1ZRS67uJpN7XmZUCFGTg6VZDera3qLgDATRPKDPs6kXNk7zBP6lcxGZ3enH/+NR+m+1A==; s=purelymail2; d=purelymail.com; v=1; bh=4MuWm+0iaQXUgxclHAHItfhlMj6cT4OP/EafMQjnn+g=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:40 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:31 -0500 Message-ID: <907087c7d2f0161e1c7800430c6017d2b4b92b9a.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner * gnu/machine/ssh.scm (roll-back-managed-host): Factor out a subexpression into new variable parameters. Change-Id: I8d70684142bea736042d6c9dc8276ea7bdb9c181 --- gnu/machine/ssh.scm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 75b02bff50..fa1066b27b 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -582,14 +582,11 @@ (define (roll-back-managed-host machine) (mlet* %store-monad ((boot-alternatives (machine->boot-alternatives machine)) (_ -> (if (< (length boot-alternatives) 2) (raise roll-back-failure))) - (entries -> (map boot-parameters->menu-entry - (list (second boot-alternatives)))) - (locale -> (boot-parameters-locale - (second boot-alternatives))) - (crypto-dev -> (boot-parameters-store-crypto-devices - (second boot-alternatives))) - (store-dir -> (boot-parameters-store-directory-prefix - (second boot-alternatives))) + (parameters (second boot-alternatives)) + (entries -> (list (boot-parameters->menu-entry parameters))) + (locale -> (boot-parameters-locale parameters)) + (crypto-dev -> (boot-parameters-store-crypto-devices parameters)) + (store-dir -> (boot-parameters-store-directory-prefix parameters)) (old-entries -> (map boot-parameters->menu-entry (drop boot-alternatives 2))) (bootloader -> (operating-system-bootloader From patchwork Sun Aug 4 03:13:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66649 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 2A04F27BBE9; Sun, 4 Aug 2024 04:17:51 +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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 7442127BBEB for ; Sun, 4 Aug 2024 04:17:48 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjx-0003mX-Tz; Sat, 03 Aug 2024 23:17:02 -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 1saRjk-0003kU-2i for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:50 -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 1saRjj-0002Qr-Ow; Sat, 03 Aug 2024 23:16:47 -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=3vJs6hPqNL85y9eyKAWNH9jAawLjkkIzXe+vUd+liNM=; b=ZWoj9LKEWj91mCgE3y1koSo/+qj4JDo2Y3dZGmTKOFWvEXcdWzxgFUgvhpNZkUHTKvleHHG5M4YrRBEBo8r0Qx5qqsCeCaedPU73C5SZ+UocI6M7ZXDRstlIiq1fh/UkYfmThgN+w6wvB1q1JBNZjuyZxn+4IYkh1NFwfMVZjJIrCNw0Pz1WNg41kMvddxhx6PDMG597cI6nGh/Sh4Oo1xv2KVsOfbjXKEQ1Q97QI+WeA5HL8YOEj3XFGBNDfYC2zRDfiKtcgf49QL1PQ9SmzAgRq7EySS0JsG/AlGnspCKRh9sF6HZZcTvu4oXycEKFvjjxbM5sfslIdDi3RAjl1Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk3-0007oi-MF; Sat, 03 Aug 2024 23:17:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 10/12] Simplify profile->boot-alternatives. Resent-From: Lilah Tascheter 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: Sun, 04 Aug 2024 03:17:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274141029866 (code B ref 69343); Sun, 04 Aug 2024 03:17:07 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:50 +0000 Received: from localhost ([127.0.0.1]:55027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjl-0007lb-Io for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:50 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:56590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjk-0007kq-7M for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:48 -0400 DKIM-Signature: a=rsa-sha256; b=YYwsZqOfkYX9rIPXhPn5svMlP/ILeLHTsIHaT1FuDGxP8T1qilzniIlOrxmv8t4pVOxWUfTBG5lswy3mGOsNK/mPu8tKNYHWW3e4mvyALSeUtH2tefUmvJurmZ+PxWqpsF6KDY1Sq3AlL2IkVo1er9+YinBlF+wjcMeJpxpIRlTMQwD+SUy4VDF9em3v0LLu50hUGvesNQvoGwQq5206nz3JF5QWKvfWyx+zKmDxI4FwCral2qJQz9AFalfsChKh84vJthJIjO5r8s0jBqMdV7Kwh7RaoVRPg3zgn9sdt6LZyOTdCJqHPITZ0TkH8CdkHWpQQRf/O1Jz1ILt04/Mrw==; s=purelymail2; d=lunabee.space; v=1; bh=NWG6NUH0mK7gkG+sq9A+xR0W0wwVR7O7WawedBxVieU=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=C/Tski/rxLHcqwLFnr3W1xs3s1wkXuQqoxL1rgPZsuqGYvylYi/ltwvLfxaoTPcLgTah9SG2jZBUX3teATL5BEmVVt7beg5D5f+mWiMGAW5DY8Kv7fKAWr18HIufTgemGMgjF1FORP7UX4VmmeXqvyTm2v2YCwRn7yHDfQVfskMD//nGONvvPaYNUChX+pzzQsqA6KBew74RJnxJyd8on4eYC2F0Q11ARvgGpwuA+N6qzoYnaZZxAaFaEHV600F5tJcNvbp6N89fpIlPoeGSCr+saugPr8XfOdiw/CYBkLYs7Kq/2exSID82j/IOiSxoiXwIX9ceaK0ErDJn3iApiQ==; s=purelymail2; d=purelymail.com; v=1; bh=NWG6NUH0mK7gkG+sq9A+xR0W0wwVR7O7WawedBxVieU=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:41 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:32 -0500 Message-ID: <6b454e5cd048626a4f32bcec0d135f700f705b92.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner * guix/scripts/system.scm (profile->boot-alternatives)[system->boot-parameters]: Rename to generation->boot-parameters and factor out processing from... (profile->boot-alternatives): ...here. Change-Id: If31eeb4cef4f5a107a0ee5ad3f117bf38629ac38 --- guix/scripts/system.scm | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index cdd78a7849..a4dd7a8054 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -334,20 +334,16 @@ (define* (profile->boot-alternatives #:optional (profile %system-profile) "Return a list of 'boot-parameters' for the generations of PROFILE specified by NUMBERS, which is a list of generation numbers. The list is ordered from the most recent to the oldest profiles." - (define (system->boot-parameters system number epoch) + (define (generation->boot-parameters number) (unless-file-not-found - (let* ((params (read-boot-parameters-file system)) + (let* ((system (generation-file-name profile number)) + (params (read-boot-parameters-file system)) + (epoch (stat:mtime (lstat system))) (text (boot-parameters-label params))) (boot-parameters (inherit params) (label (decorated-boot-label text number epoch)))))) - (let* ((systems (map (cut generation-file-name profile <>) - numbers)) - (times (map (lambda (system) - (unless-file-not-found - (stat:mtime (lstat system)))) - systems))) - (filter-map system->boot-parameters systems numbers times))) + (filter-map generation->boot-parameters numbers)) ;;; From patchwork Sun Aug 4 03:13:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66642 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 1577F27BBEA; Sun, 4 Aug 2024 04:17:35 +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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 5903627BBE2 for ; Sun, 4 Aug 2024 04:17:34 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRkB-0003sW-KJ; Sat, 03 Aug 2024 23:17:15 -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 1saRjn-0003kl-1T for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:51 -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 1saRjk-0002RQ-TL; Sat, 03 Aug 2024 23:16:49 -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=T7BKkIrypFS3jrOnHYS9zc/rfHl2KYrYktxjcyxu/0M=; b=paFCu8yLchzm2Nd28ZXVjYj6C10RFFHp19BnFfHaOsuNAdHIv/ly1do67RR6IAWTHZ+PxxYpkA8sfwCXZh7jlmOo8G++y3YLGaa9+TGmXQoyQGn9jzjnv0cTAvlQcs0ICt+EWrbcy2js0recNDJDpBO28RYDeaSuyjEmSNUCATl+wDswQd1E+ic+8MWpP9mmMQAYL8GFbpsj+kQg1jDKACUVBnZ5YGm9K+TlAfwwhRq8VE0kQEU4sy0dx435Odow/T6HvfJ50p1zI2ppgtTPUarY4ngvfvXJjFe9fLr8t6AbozyvyTkqEa8njWpGlZXNWF98CLL4Ba5VNoPxTpDhCA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk4-0007ov-5w; Sat, 03 Aug 2024 23:17:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 11/12] Split generation->boot-parameters out of profile->boot-alternatives. Resent-From: Lilah Tascheter 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: Sun, 04 Aug 2024 03:17:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274141429894 (code B ref 69343); Sun, 04 Aug 2024 03:17:08 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:54 +0000 Received: from localhost ([127.0.0.1]:55032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjq-0007m4-4q for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:54 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:56598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjo-0007lI-1D for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:52 -0400 DKIM-Signature: a=rsa-sha256; b=AUYz0YWWI1AApKqX96bJ9Nq7zoRzSAcFJO1cpsi2GnOpFokmq3+/+FIqAtHBwtOA57A1DYb3B25M2x5Lf89NvMxVv1pYY6egD+Pg2FWRw92Bqb/4yNPdjSExqmyeX2eEe6FY75FFt1jOdzKQZ3ECawim2GXR0w+MPe1t63Dy5mFMNY1jbdNL6c+s//srFqxw0RdPr7adnDVmIR0KLf2oVmuHl2arxmWrUXucwdM0n8W1l8+gvxORFOvlkrSsf6tN/nmpBzKtvoqZtu0K6XBEMyaex9gfO8WZFfj4M9gJRY/OoFdCfOGfv965bz0TsUhlDnF5J8W/k2rK+cw+Hpoupw==; s=purelymail2; d=lunabee.space; v=1; bh=Tk8W7qM2jR/8/MeUJ1Qk7Yr0/D33pJMJPZnx9XqDdmw=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=eLDUIkKaUdaHDLWbs2bUrI2TNJGcMaDh8E6qgLIdX1+4d2LVbO3CY1N9O4fDYlrtnWiLz4CscqZjXABHWB+qtovGxg6THvngQz5Cg4DpYeCg4oKEIL4D0EQq1YtxwSaboJaWDXmheNeKGKcF7XGNLhkgxINYUy/GP2ZUkzU4T0a2yV7ag0cDA7FuRyh/psapK88pkvSbyEOgZNtdcLy8B9QkGW3k5+tsATeAECD7PX2FrnFvG5vVYOXTlW2XAgNpQiFBzj5SG8yHSYF8ns3WNb833/Q7hDiKVPcMQWikXTl7isNwhPCFcGdV16d++Arp6cGpXWEcrjVsqc5IA2CnUQ==; s=purelymail2; d=purelymail.com; v=1; bh=Tk8W7qM2jR/8/MeUJ1Qk7Yr0/D33pJMJPZnx9XqDdmw=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:41 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:33 -0500 Message-ID: <009964ba87f3458ce70ce14f3106c46971cb57ef.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner * guix/scripts/system.scm (profile->boot-alternatives)[generation->boot-parameters]: Move to... (generation->boot-parameters): ...here. (reinstall-bootloader): Use procedure above. Change-Id: I51ef1a4fa8fd18104d28a6a845707d7dedde3782 --- guix/scripts/system.scm | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index a4dd7a8054..0c69f6d90b 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -328,22 +328,27 @@ (define-syntax-rule (unless-file-not-found exp) #f (apply throw args))))) +(define (generation->boot-parameters profile number) + "Return the 'boot-parameters' for the generation of PROFILE specified +by NUMBER." + (unless-file-not-found + (let* ((system (generation-file-name profile number)) + (params (read-boot-parameters-file system)) + (epoch (stat:mtime (lstat system))) + (text (boot-parameters-label params))) + (boot-parameters + (inherit params) + (label (decorated-boot-label text number epoch)))))) + (define* (profile->boot-alternatives #:optional (profile %system-profile) (numbers (reverse (generation-numbers profile)))) "Return a list of 'boot-parameters' for the generations of PROFILE specified by NUMBERS, which is a list of generation numbers. The list is ordered from the most recent to the oldest profiles." - (define (generation->boot-parameters number) - (unless-file-not-found - (let* ((system (generation-file-name profile number)) - (params (read-boot-parameters-file system)) - (epoch (stat:mtime (lstat system))) - (text (boot-parameters-label params))) - (boot-parameters - (inherit params) - (label (decorated-boot-label text number epoch)))))) - (filter-map generation->boot-parameters numbers)) + (filter-map (lambda (number) + (generation->boot-parameters profile number)) + numbers)) ;;; @@ -391,8 +396,7 @@ (define (reinstall-bootloader store number) (bootloader bootloader))) ;; Make the specified system generation the default entry. - (params (first (profile->boot-alternatives %system-profile - (list number)))) + (params (generation->boot-parameters %system-profile number)) (locale (boot-parameters-locale params)) (store-crypto-devices (boot-parameters-store-crypto-devices params)) (store-directory-prefix From patchwork Sun Aug 4 03:13:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66646 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 F077027BBEB; Sun, 4 Aug 2024 04:17: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=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 A09A327BBEC for ; Sun, 4 Aug 2024 04:17:42 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjx-0003mV-G4; Sat, 03 Aug 2024 23:17:01 -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 1saRjn-0003km-79 for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:51 -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 1saRjl-0002RT-IH; Sat, 03 Aug 2024 23:16:50 -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=qwGZKiXieyigE1Z6gQ2W21+mcjAALtB7u2ZYs2VSv4E=; b=JMHfMoq7Ft/NY37vDRkNqQwZIbFf63A18T26LVcj/Tz1l0Hk3q/Bt7rLzUsZqkioihjRP3uO83WXQA6mPcD3CqHjTMLSUWg/YOpVNOUVg1ycI+ulxV9GfLpold1c3Iqf2nllThu/y2XQE0Hv8HFW0t5DT2YwJljYTsZwNF46m2KC2Nvv4CkAOEL86Ubd0aoDuP3/cF4O7G3e3vs9s061Ptni/wuv5J7nHwPlcvbNS6PkbIH1LxjxIDt6T+N2h/CQ+WHuh0yChE51X0oB24gGZmjUjUu2X0HvvUyHhlXDMthLaDj1KPCWkUx9+hDpjgg7zzOPAzPfIHB9r0EQrP7WSA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk4-0007pA-PR; Sat, 03 Aug 2024 23:17:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 12/12] Encapsulate to retain generation, system-path and epoch. Resent-From: Lilah Tascheter 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: Sun, 04 Aug 2024 03:17:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274142229942 (code B ref 69343); Sun, 04 Aug 2024 03:17:08 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:17:02 +0000 Received: from localhost ([127.0.0.1]:55037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjx-0007mc-Ot for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:17:02 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:56606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjv-0007m6-Hj for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:17:00 -0400 DKIM-Signature: a=rsa-sha256; b=odvQ/3TZNBWJWPETPFKX8H9JoeOVd+QfA7ZLfcVJk3zsM+319FkrIhyndA8feBBv0Br4vv83oM6ZN0fjCydl0PmCQkKimj/kUXKj1kjIeAqxqyL8OkOafuaIAM1Avdc/fB9CVnlsDViiOdg6+j8JZG37VVi6kBpE3HN2vrUFihqYmPpdzbwICK1pS2Dtqeu7xS4TOE02sh8KozV1h2EIwLalqKo+ApMTQ8S6OhndTvimq7UW8ZvtDgoiSo3n5SCdjKEF0nSZjJy7A4JcreW3SpaRPWknQ+gBYoR4UOXCx5TeqsAbysjOHycP0NdN0cQTznxR8LcL53FSMgnOKIQcXQ==; s=purelymail2; d=lunabee.space; v=1; bh=RUHmSuhS5uGJenfJXJKaEJCl2J6PvkMjfkqxRW4ZKHI=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=Y2TFPijtjktrmsFyWkzw+S9QsO2mFSUvVdMlzt5B/cX8FP8MNJEG3OaDCaM8SRftBnKvZnLu5aMiQQ6g2Ud4DT/pk/CCB5s6QHpprdHhoxdMu5Vhadlwr8LIshBIrXrLWRV900P+w5uLJLbP/R1ErBdhp7EdB+RyKllaYJ4isLmP7ovtSNHBZaGXw+nzDkcxTH/SFKxmXeNwzM/T+jjDz7R6WOvw6uqaVNgxzCWiLRLYsN+t4vW3aqX+oHLK9U9BQfiBNp3EYvxyWWPBaBpdV6vyQpPxyqWVkQrjbDgmOrDam1CaXGL9Vj7nZozsuIdh2SHTBQjHJ3vGtkTYb6EAQA==; s=purelymail2; d=purelymail.com; v=1; bh=RUHmSuhS5uGJenfJXJKaEJCl2J6PvkMjfkqxRW4ZKHI=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:42 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:34 -0500 Message-ID: <7d781027c78bdea5fdb3f1c9c9ec432b9606d2b5.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail 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: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter 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: Felix Lechner * gnu/system/boot.scm (): New record. * gnu/machine/ssh.scm (machine->boot-alternatives): Return a boot-alternative encapsulating previous return value. (with-roll-back, roll-back-managed-host): Get parameters from boot-alternatives. * guix/scripts/system.scm (generation->boot-parameters): Rename to... (generation->boot-alternative): ...this. Return a boot-alternative encapsulating previous return value. (profile->boot-alternatives): Rename uses as above. (reinstall-bootloader, perform-action): Get parameters from boot-alternatives. Change-Id: Iaef0b0a3fa9240ca8315a9699bcf4a7bfe908e33 --- gnu/machine/ssh.scm | 32 ++++++++++++++++++++------------ gnu/system/boot.scm | 14 ++++++++++++++ guix/scripts/system.scm | 32 +++++++++++++++++++++----------- 3 files changed, 55 insertions(+), 23 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index fa1066b27b..8dd8c342a0 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -416,8 +416,8 @@ (define not-config? (_ #f))) (define (machine->boot-alternatives machine) - "Monadic procedure returning a list of 'boot-parameters' for the generations -of MACHINE's system profile, ordered from most recent to oldest." + "Monadic procedure returning a list of records for the +generations of MACHINE's system profile, ordered from most recent to oldest." (define remote-exp (with-extensions (list guile-gcrypt) (with-imported-modules `(((guix config) => ,(make-config.scm)) @@ -458,13 +458,18 @@ (define (machine->boot-alternatives machine) read-boot-parameters)) (root (boot-parameters-root-device params)) (text (boot-parameters-label params)) - (version (boot-parameters-version params))) - (boot-parameters - (inherit params) - (label (decorated-boot-label text generation epoch)) - (kernel-arguments - (append (bootable-kernel-arguments system-path root version) - (boot-parameters-kernel-arguments params)))))))) + (version (boot-parameters-version params)) + (parameters (boot-parameters + (inherit params) + (label (decorated-boot-label text generation epoch)) + (kernel-arguments + (append (bootable-kernel-arguments system-path root version) + (boot-parameters-kernel-arguments params)))))) + (boot-alternative + (generation generation) + (system-path system-path) + (epoch epoch) + (parameters parameters)))))) remote-results)))) (define-syntax-rule (with-roll-back should-roll-back? mbody ...) @@ -508,7 +513,8 @@ (define (deploy-managed-host machine) (%current-target-system #f)) (let* ((os (machine-operating-system machine)) (eval (cut machine-remote-eval machine <>)) - (menu-entries (map boot-parameters->menu-entry boot-alternatives)) + (menu-entries (map boot-parameters->menu-entry + (map boot-alternative-parameters boot-alternatives))) (bootloader-configuration (operating-system-bootloader os)) (bootcfg (operating-system-bootcfg os menu-entries))) (define-syntax-rule (eval/error-handling condition handler ...) @@ -582,13 +588,15 @@ (define (roll-back-managed-host machine) (mlet* %store-monad ((boot-alternatives (machine->boot-alternatives machine)) (_ -> (if (< (length boot-alternatives) 2) (raise roll-back-failure))) - (parameters (second boot-alternatives)) + (chosen-alternative (second boot-alternatives)) + (parameters (boot-alternative-parameters chosen-alternative)) (entries -> (list (boot-parameters->menu-entry parameters))) (locale -> (boot-parameters-locale parameters)) (crypto-dev -> (boot-parameters-store-crypto-devices parameters)) (store-dir -> (boot-parameters-store-directory-prefix parameters)) (old-entries -> (map boot-parameters->menu-entry - (drop boot-alternatives 2))) + (map boot-alternative-parameters + (drop boot-alternatives 2)))) (bootloader -> (operating-system-bootloader (machine-operating-system machine))) (bootcfg (lower-object diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index b1302b8786..833caef496 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -71,6 +71,13 @@ (define-module (gnu system boot) read-boot-parameters-file bootable-kernel-arguments + boot-alternative + boot-alternative? + boot-alternative-generation + boot-alternative-system-path + boot-alternative-epoch + boot-alternative-parameters + epoch->date-string decorated-boot-label boot-parameters->menu-entry @@ -299,6 +306,13 @@ (define* (bootable-kernel-arguments system root-device version) #~(string-append (if #$version>0? "gnu.load=" "--load=") #$system "/boot"))))) +(define-record-type* + boot-alternative make-boot-alternative boot-alternative? + (generation boot-alternative-generation) + (system-path boot-alternative-system-path) + (epoch boot-alternative-epoch) + (parameters boot-alternative-parameters)) + (define (epoch->date-string epoch) "Return a string representing the date for EPOCH seconds." (let ((time (make-time time-utc 0 epoch))) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 0c69f6d90b..0f7d864e06 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -328,26 +328,31 @@ (define-syntax-rule (unless-file-not-found exp) #f (apply throw args))))) -(define (generation->boot-parameters profile number) - "Return the 'boot-parameters' for the generation of PROFILE specified +(define (generation->boot-alternative profile number) + "Return the 'boot-alternative' for the generation of PROFILE specified by NUMBER." (unless-file-not-found (let* ((system (generation-file-name profile number)) (params (read-boot-parameters-file system)) (epoch (stat:mtime (lstat system))) - (text (boot-parameters-label params))) - (boot-parameters - (inherit params) - (label (decorated-boot-label text number epoch)))))) + (text (boot-parameters-label params)) + (parameters (boot-parameters + (inherit params) + (label (decorated-boot-label text number epoch))))) + (boot-alternative + (generation number) + (system-path system) + (epoch epoch) + (parameters parameters))))) (define* (profile->boot-alternatives #:optional (profile %system-profile) (numbers (reverse (generation-numbers profile)))) - "Return a list of 'boot-parameters' for the generations of PROFILE specified + "Return a list of 'boot-alternative' for the generations of PROFILE specified by NUMBERS, which is a list of generation numbers. The list is ordered from the most recent to the oldest profiles." (filter-map (lambda (number) - (generation->boot-parameters profile number)) + (generation->boot-alternative profile number)) numbers)) @@ -396,7 +401,9 @@ (define (reinstall-bootloader store number) (bootloader bootloader))) ;; Make the specified system generation the default entry. - (params (generation->boot-parameters %system-profile number)) + (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 @@ -407,7 +414,8 @@ (define (reinstall-bootloader store number) %system-profile old-generations)) (entries (list (boot-parameters->menu-entry params))) (old-entries (map boot-parameters->menu-entry - previous-boot-alternatives))) + (map boot-alternative-parameters + previous-boot-alternatives)))) (run-with-store store (mlet* %store-monad ((bootcfg (lower-object @@ -824,7 +832,9 @@ (define* (perform-action action image os (if (eq? action 'init) '() - (map boot-parameters->menu-entry (profile->boot-alternatives)))))) + (map boot-parameters->menu-entry + (map boot-alternative-parameters + (profile->boot-alternatives))))))) (when (eq? action 'reconfigure) (maybe-suggest-running-guix-pull)