From patchwork Fri Sep 20 04:15:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68147 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 70A1427BBE2; Fri, 20 Sep 2024 05:18:13 +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 5A4B827BBEA for ; Fri, 20 Sep 2024 05:18:12 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5a-0008CK-E3; Fri, 20 Sep 2024 00:17:50 -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 1srV5W-0008B9-6R for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17: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 1srV5V-0006FT-7h; Fri, 20 Sep 2024 00:17: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=twBSxO8OYtv7Y0YpuY4Yq5bn1AJZ/T1jWxLM2EXy96q9BDSDLgo1flD9/G5IsTiHoF7QksRsxlx0I8jDkTIbC9p9gP0s8SKDa123Wr/4HDvE2rY44g9TNVFmGYYTfI4V4IZDWt3x7+yVlTyM0KQTP+juSTi9HS0xPntBbrpohb76vYZzer/Ja60BtdlPuraCOqxs0cxtAD9zxuOEcigJfe+8c7kawzVMR3VXx5vaXQS7Or34EyCZr6EJINhl6kYGfyNwic3li4pIph9eWVU6XTh3OXPgcJuHXh6Sd6Kkez+md/256vbK8dwN3JY8T1pLJntTGp8paxXpIyds/2NeRA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5m-0005T1-FA; Fri, 20 Sep 2024 00:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 01/11] 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: Fri, 20 Sep 2024 04:18: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: Herman Rimm , 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.172680585620863 (code B ref 69343); Fri, 20 Sep 2024 04:18:02 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:17:36 +0000 Received: from localhost ([127.0.0.1]:33723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5M-0005QQ-3H for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:36 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:49144) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5K-0005Q0-4I for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:34 -0400 DKIM-Signature: a=rsa-sha256; b=awliK9Fzrvgq3UnS44kefL4JfzLACfXV9qlNY5gK0awpFnZTZz3fBswkKmMkFkH20gGvTGe6dET2kFnGBfbRm+GlJgkcPexggUbfIL+NnQ0x0m0Jgnc3dz321OnuCWpegb1V6iXtMOQ6CTdsN+y5mspDw6rTxzccmYiwYBMrCjK0D0RwyXYsbEpFz7HSGrmWixSurpjCTYLL9Pzyi7+jkQxqa5vuIwJxR8gDvRYsnlBXh9avYDKhGMZYt0sjWnSLS0hPVVTSCECMYpRojmz2HyI1Oj3rf3jlyH1cw54xSLZ7KPIlYFmbPEtXFMA75cFit02LCUFCzAyYYz1PRgcmLA==; s=purelymail3; d=lunabee.space; v=1; bh=qXWn1cz6zN65+Q68ygAxFMhzoQIb60JNk1LL8A3ilhs=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=iljA4SzUGUnnbXQoVY9hu2NfHeR3nCeMMgDNdoNP+kQBn0WLF0Px5lhUcX58+97zy92kiBq1k08V/49Tjec15bJrcVU4hbTQN/2WJPc/EEDrD5wZb5UPiFf5CTwIiB7qmymUpEUUmsVM9Aj22i80HbCbYCBhfLkbLEXB6+DO6qwrY5opzCbOihykzfvzDasesVh67GXHV6/lCxb4zq5FndWqmmwCf0aX6lcNVYcCuRCbej3nmmLIVH6J/ak83864Dxu6KkChJ27tjGwEKHB8N1w1CUP6h0cF+gWcKGT1LKE0AAr/4jiJUXfiCZBDv7ElpGWxsH0R+Tss80Ecd4kdHA==; s=purelymail3; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:09 +0000 (UTC) Date: Thu, 19 Sep 2024 23:15:55 -0500 Message-ID: <048a294013321d432030a71007d7386d2f1308d7.1726805765.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 Fri Sep 20 04:15:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68154 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 D097227BBEA; Fri, 20 Sep 2024 05:18:49 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-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 3959F27BBE2 for ; Fri, 20 Sep 2024 05:18:48 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5f-0008DR-8S; Fri, 20 Sep 2024 00:17:55 -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 1srV5Y-0008BW-Vi for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17:49 -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 1srV5Y-0006Fz-DT; Fri, 20 Sep 2024 00:17: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=W8VAygEyNCbbOC4n8gnnfwe+dFyVy83ARb/7rTKOsHk=; b=i8KLxeW0buSvAMEiDPkrjN9E1E8yC6upI5u/86oUcG7MvU/ONeJHgKpQkbKO/IW/Gmuz5CiTk8748dmWouZY2TCH0EqhaPPLIojndVG02+GwyGGa/S6tmut5Ltut5AaCx6TC9wDMLrvrSNJh4ZVKoLS9HQwyty8PW15FEnAIRvRtV18LKfcpi6yXw4s9FonJU+3aa7UCXaz2jNi0cQG6qMOSXCT0jr3sjcyhaiqR6qd+vQ1ADBox2+SNmgPCy7Yh8eis207dME88zfhuuxzcKwORSDJEr4AicQetZ8T9xgmCezTzkf/qSf1thWwMkCU/9lQJIfasoJEAOt0t1asJQA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5n-0005TJ-Ft; Fri, 20 Sep 2024 00:18:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 02/11] 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: Fri, 20 Sep 2024 04:18: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: Herman Rimm , 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.172680586720918 (code B ref 69343); Fri, 20 Sep 2024 04:18:03 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:17:47 +0000 Received: from localhost ([127.0.0.1]:33739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5V-0005RC-8Y for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:47 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:45752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5P-0005QN-RP for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:42 -0400 DKIM-Signature: a=rsa-sha256; b=p8ahLyCtvSM3gl6l/TgGjeSCfAMPOPrkVp6zEaB8k/IVszuxIKP1Yx1xEXdIqszSFjXYF/fNVnNA1UqUnqnw2BNPv+ZJ2ixZSxe0anUSQ3B4uQiR1lmARb49cy+nnQUYY72vzW5bAyPWqBexRUGD2gohe/l5u9jakblJnc/79SQWIqI3dYHn7TGsRtYaOtgnpsjBJEyfxjWUWqGxox6bPg1dER2QjtmjI9/POxCuRZLEiP+2Ri848vo6PVrQGu3qVcI47dAnDWteE7MyV3vjhNmWrNTiWUF6cQpmoXt5ZJTU4O/E6nGql/iKSjnY49Vgy3a0/9/Qn2BV30KsgiI0Eg==; s=purelymail3; d=lunabee.space; v=1; bh=oRaTEmS2mej/tH6xcejZxpSD254H6b/VBo3LygsmuCo=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=Fvf3bpqyeBlwoqlTayA8a7FIV11HjZ85KQwX9iX1VA6LhuI5jMR5VdAtTdubV1g1puk8CmmhULeAVNE/JdrruWDUE5uIRGK8GYcRpPgo0HUZD52rTwq16GW+yp9bpCBEa4Hnp/HU5TaYJpuOzSZuuvCeEhgABJEM2SHqKT86z0RkxkFEgCcv7j0ajTJljx7yumuS9ne5lw96Yf2H/P45+Cp2AqT/cPgyjriBJZzA83UD954WOb4teBMXbAZfUVNn3T/OTgc/smpSjKPWlRJdPO85PqnPYh45czRP6Yh6x0iMwHybXfevl6f7l61ftP8z3kW2GDcT3sHcly8TZ6H1ew==; s=purelymail3; d=purelymail.com; v=1; bh=oRaTEmS2mej/tH6xcejZxpSD254H6b/VBo3LygsmuCo=; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:13 +0000 (UTC) Date: Thu, 19 Sep 2024 23:15:56 -0500 Message-ID: <1f574c422d47205d1f5e0fc139959d0e93280576.1726805765.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, boot-parameters->menu-entry): ...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. --- gnu/local.mk | 1 + gnu/machine/ssh.scm | 4 +- gnu/system.scm | 287 +------------------------------- gnu/system/boot.scm | 341 ++++++++++++++++++++++++++++++++++++++ guix/scripts/system.scm | 1 + tests/boot-parameters.scm | 1 + 6 files changed, 346 insertions(+), 289 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..4a084b2ecf 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,33 +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 %root-account %setuid-programs @@ -192,29 +171,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 @@ -356,236 +312,6 @@ (define* (operating-system-kernel-arguments (append (bootable-kernel-arguments os root-device version) (operating-system-user-kernel-arguments os))) - -;;; -;;; 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)) - (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) - '()))))) ;;; @@ -726,17 +452,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..df27b8aea4 --- /dev/null +++ b/gnu/system/boot.scm @@ -0,0 +1,341 @@ +;;; 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 + + boot-parameters->menu-entry + + 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 (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 +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 Fri Sep 20 04:15:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68146 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 C116527BBEE; Fri, 20 Sep 2024 05:18: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 5731B27BBE2 for ; Fri, 20 Sep 2024 05:18:12 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5c-0008Cu-Pj; Fri, 20 Sep 2024 00:17:52 -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 1srV5X-0008BH-L5 for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17:48 -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 1srV5X-0006Fe-5j; Fri, 20 Sep 2024 00:17: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=rF0HxWCgcf/VEP5PbScOUADP1Ar6Ys6Ha2KztD/zTHU=; b=pm8Snc3uHCralgc7uGSdNAU29/Xf9p+bAogp1XLXcRgq22aX5i9IqMmfwSxfp9U7qYH9Z2oRYhrxx1JEsogjVIMdQqlSHLr9eOGx2tzym6QDrx4KUTZv+xhHgHg7GTzQZrHu4VC11h3v18i7Rf2Unf90BMvYc+zqNiI1gB+vdYvXkOGOxNCPwcqy5xFBsQvDJkJCxmxO4C6JHs8HGhiu4jBWXUR6d/QJCS4M4sDuoWVVTJBVYWzCaz7Sm8CHlJTKXkyQF4I0NaVa8B7ZQirr0mTcVZLvp1Cgg53YaDy9nC7gqNam/6HYeD27dF9G8niVD4hdkTFG74Oa3qGclXl3/A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5m-0005T7-VN; Fri, 20 Sep 2024 00:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 03/11] 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: Fri, 20 Sep 2024 04:18: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: Herman Rimm , 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.172680586220891 (code B ref 69343); Fri, 20 Sep 2024 04:18:02 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:17:42 +0000 Received: from localhost ([127.0.0.1]:33731 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5R-0005Qn-GY for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:42 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:45754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5P-0005QO-RQ for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:40 -0400 DKIM-Signature: a=rsa-sha256; b=CinEWg1/fo6rZjJ/cktAFSA03u/uDFxqCVdVIfO2NEPDx8O1ufSiMSl6RdlXNfODcwoRZEUaSQs10Kd/RBq2jRq4oxLZTHcfehyJZW/YMIREVeIUg93IfKbdVlMzYpiybXh1isqg+SVJ7dva9Jh1v8kybGVzJR7qUnKAvdMXFekcUfuOoS+8Ip3kPZn8xBBnlpPNP332ZWq0y4UVHFy5UKIgZEDh9M5b27eO8nmBFfwJNI9M3MFeunIrXht28K7JH+RI5FGFTsltH7JSGL9iZqYbsH7AY9b84rGucGa8o+FqFBKVL7D3GxGNLH5kkev2AB4s7R0bzugh1EYUotznMg==; s=purelymail3; d=lunabee.space; v=1; bh=oThLW0/lymMCVSVmKwy8oE8qI6vmgdd2ZBmkRVkECVU=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=NFzsX89HWFlnQN804A4t8wKigefZSiJUr/mnKT5eWcWlrn11xv+uP5XvMGlyVFY2cyvwRaNjMXZxaShbkyir0CehKXQzEVMOFbEudo5ahC8pIj71eA4vynT1MUvNITUsRuHvojQeJ0cX4TKL21R6Fy9+OAG9dgkcRmfZtyiFtqyik7YfwhdKj0jkCJ9H1S6VPWiD5zlV3VvjFyxwutJ4OT2pfT6LvPqdQRrS6eK2VxH6cUJlpmfeUOvaXTgqilOnQ7aBfg3ra/hkUopNauhuleXdNQGd/lO0limpzuSvG4NwOe6RtHOXeLfGZi+6PXYj9j4JFLAB6L0rUT/gDhMUkw==; s=purelymail3; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:14 +0000 (UTC) Date: Thu, 19 Sep 2024 23:15:57 -0500 Message-ID: <26815704b0d1122f45aeaca6e30438c713cf76c1.1726805765.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 (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 Fri Sep 20 04:15:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68151 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 9113327BBEA; Fri, 20 Sep 2024 05:18: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 EC1EF27BBE2 for ; Fri, 20 Sep 2024 05:18:34 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5f-0008Dq-Oy; Fri, 20 Sep 2024 00:17:55 -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 1srV5Y-0008BO-GA for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17:49 -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 1srV5Y-0006Fy-6x; Fri, 20 Sep 2024 00:17: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=GkXQmKfGKePQaC1SQcLmSTKCPVMRu4FhXICXbMjDOng=; b=ZJkiNwQQX+t5CPoCdy2s1oiv7Q7KRi3NvwAxyU9l8qfRpiK1syfRYhdEdoxJywGmKNPb7fggbqqvZSTqAbSAUzhy2NPMViVfQEAzNPY6C6gsqntd93TANvR7Ugp/utAxcuSmfbZIL2R5RGty+JvLfPr5vxzRbXOXDq6QYAb5LoOu8jnTGEaivsmHu8h/IvZrAMpaATD6L9cP4s1F0i7iXTjniVpRqG3DWi845zj+Oc0cYyjRSFvmA5OYjysGjnF2wvyPuWnTgaIImwEd1fs7u9KsQF80YayC22tWsyZTMGu/7rt1pP2PkbIsUOqta4rhDOiLB2CTrdc/Xt7Hd8RmwQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5o-0005TX-9f; Fri, 20 Sep 2024 00:18:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 04/11] 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: Fri, 20 Sep 2024 04:18: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: Herman Rimm , 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.172680586820926 (code B ref 69343); Fri, 20 Sep 2024 04:18:04 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:17:48 +0000 Received: from localhost ([127.0.0.1]:33744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5X-0005RL-CH for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:47 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:51944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5S-0005QY-I5 for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:43 -0400 DKIM-Signature: a=rsa-sha256; b=DRfMk84p82UX/K2rmbkOnkdwuIX8muIvBUYGZ4GrCrKNGInGpsxaBf2Ymy/+nUiNghJ7LQRmJSJ0I/3uZdNQIFOZJpdTTFYTDRMTpzvUqTzE30TDBCJb70PcMJ2ZlEIpFHFtlDiXY+UpyjMcuMvP+6lM1iB0zCkZKl+yv7DIQhU/1MrvHWC6ob7a/9KaZxzZvL2Z+Q9ApRP3Twc1JMNzIRDA7p4JhQFk5pEhi1Nmhl7gL3iMjVCgx+Znx7kcl+k7lh0srP/uKRCsSJ1EzSMOLlm2VhwP5EwB2jlO3uae/AJ8h8IHTKQp1KsBxvkRvTHV5YpvRY+tzLld7dfykeY+/Q==; s=purelymail3; d=lunabee.space; v=1; bh=fwzoCc7y6ItU44Puf4gL6wng+1TnmX0zYcUUjQTfsJo=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=CekFazb7fA3XR71mlpWngRa4CS9SttCb+p2ZuzLutZ5aiflPwK2HdvYhyQrzPl4qLXHY/YXaqbr3omSWFF5cmUyKkfLWNBDN0d67qh8HWyWUaL+hVIPwOjIp9RehJM136sptuDUbUpC/kTNQd3C4z7mMp0uqu4aQxmc29iU8J9hLvJTfdcmB+v/LquT0uHqm55WjNdEcUfeS+6Gg2HtWZV1jQi7iMKodnG8Ifao7E2oAfeKKyMNLSMNzF13/cGXZuxFQsnBNEzMUD5QxF9w/FPo9ORKGovIhyZbuN9aQ7l4YYtq+Q3e0NCyGd5IzuxHggYxvsNLdOHzDmH8f5zEkVw==; s=purelymail3; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:15 +0000 (UTC) Date: Thu, 19 Sep 2024 23:15:58 -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 Fri Sep 20 04:15:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68155 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 9877327BBEA; Fri, 20 Sep 2024 05:18: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=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 1011E27BBE9 for ; Fri, 20 Sep 2024 05:18:50 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5d-0008DE-Rq; Fri, 20 Sep 2024 00:17:53 -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 1srV5X-0008BI-MN for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17:48 -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 1srV5X-0006Fi-Cv; Fri, 20 Sep 2024 00:17: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=THcAq8t8oXrBea0PUfva4NVotH+M6T/0nB34dP5viQE=; b=BK4pvX5VcNl17RATegG4qe0NVJPqwx/kn1BTwGhS1KPBT/gbyx9TKBlwoG4i4SJp7F3Ywu5fAdkHEKRCaMQx+Mn0alN8xMr4Sn+T5AS6ESaJL6Oj00DnYTSwbCKS8x8xuY1Rv+0/D9bYTFSFLhWNG9KDVoX2CwsPMMcPFWY9qln83TtpYEtGz85vB/3girP4tRPpHobd6DcD3WZuhGXqHtkAHQ6vKsI8T8+064ap1Nki30AfQBdN69GiLfsQuQWWu+AGxa3G/oe6swAid+K7X9mTWqQz2P9yphK6rcLHTn7xcG88VCaX85O6cXds/yaYrN1vUTXB++iXtQgKwDX9EQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5o-0005To-VT; Fri, 20 Sep 2024 00:18:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 05/11] 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: Fri, 20 Sep 2024 04:18: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: Herman Rimm , 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.172680586820932 (code B ref 69343); Fri, 20 Sep 2024 04:18:04 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:17:48 +0000 Received: from localhost ([127.0.0.1]:33746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5X-0005RT-Vu for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:48 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:51946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5S-0005QZ-Iy for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:43 -0400 DKIM-Signature: a=rsa-sha256; b=j8pFk7UnVdJi9iShP3cXbSDFylTTvL48ob2hYvrR4z+XTbx6Zy/KHrTSZILGZEY5NVFd6ESINsb1lO/V/lvF0/cPCH8luFEwHySppo6cktjg5RywzJrRqsom5577wwpBrh7cBurZfxs5ZmSU2meJOm/KuSVY+GlVpE4z/v2hWvQRFb8i62X0F6iRJ63DCUNqkTfg/AnDNIxD+tCw/Y8WNDbiE8LOpaWC5zr6PGNlvAuZY+OWVag5RlbAZy99ZlAQgFEPY8Btvd0+u5tMmYZ8U8apgM+tqwa8C2VNSQR4Y41wr0D5KM6V5zf6zuTqUvoAO4yo9DKik3/8QUxsIWYgcg==; s=purelymail3; d=lunabee.space; v=1; bh=NOK0PWiSFHSzFTSi+M9ZXWQ8KB3bs8kYvKUPY7tzJ48=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=i6eEhq/b1nSjPtmBtgky8f+ZQXPaIVlhemKp5HTnxtv+yP/8XuBMEFfejKggrpdbiliqlOjccNOIICUGqW2115YRRjciPoQoCfco4vs3BfoF6KBwEIFhe/8HtkN5B17SNEh3Xs9n/CGMH7ar0m3sE1zQZtTuGV13tYB9RFV01MSJstgYkmHRYlWHS+bqbX82Yp+oSRSDwfLYHxoYc6yGTVKaRe5qHFsCbOvUa6SxcEU3yzKfn3pdQ5EI2mR9oPtTuA/c0uJTmJII8ncirQZ9keMOzVvWP3lCHYkpNyZL7iYNyMIX0wTxpR0E42ilRp6fyhRiOvyH224ZfvWM0hnyDA==; s=purelymail3; d=purelymail.com; v=1; bh=NOK0PWiSFHSzFTSi+M9ZXWQ8KB3bs8kYvKUPY7tzJ48=; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:16 +0000 (UTC) Date: Thu, 19 Sep 2024 23:15:59 -0500 Message-ID: <8715f3e79e6b1dff09eb2c4c04d23af14b1247ba.1726805765.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..82ca353cb3 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 (num) (string-append "#" (number->string num)))) + (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 Fri Sep 20 04:16:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68153 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 1B1B427BBEA; Fri, 20 Sep 2024 05:18:40 +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 754A727BBE2 for ; Fri, 20 Sep 2024 05:18:39 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5k-0008GU-Bm; Fri, 20 Sep 2024 00:18: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 1srV5Z-0008BZ-O4 for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17:49 -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 1srV5Z-0006GX-E4; Fri, 20 Sep 2024 00:17: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=xH6N3KcjXiHGSeavyBCwt+jekQZziNo2tyGwxHomiik=; b=vAlNRH3gLivrLYtWea1wARNNbH3tFPFV5K36AJzew7TBO9efso+fKQYGCcKYccu1eMG/kuhKzmIYtKHnl/YBCZmhNx7oeb+BqyYdevw9+qZgCvAvPtC5W1uG3xWg0PQM7wTJ+YhUzL+IJCVYpOhcxT7IHdi4DYG9SKrMk8UCw0bsqq+mMr6StIViPfFJhnitWLezEVEyhmKC+of9K8nBVx/AoLwINRJIupwhW9uA49e0vmKYUrO3dqHG29J8leb23kiA7/O/d5HE4vVdeRr1TFBO6GGj8Wdx+AdhglkqPJKHZ0MO2x8AXKfb5I0GzXrqD9k3v6LZYbjy/UQLRkn0jg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5p-0005UA-Mq; Fri, 20 Sep 2024 00:18:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 06/11] 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: Fri, 20 Sep 2024 04:18: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: Herman Rimm , 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.172680587420954 (code B ref 69343); Fri, 20 Sep 2024 04:18:05 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:17:54 +0000 Received: from localhost ([127.0.0.1]:33748 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5d-0005Rq-Jl for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:54 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:49248) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5V-0005Qg-Ch for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:46 -0400 DKIM-Signature: a=rsa-sha256; b=PFoFvbhxhXpudpc0chA2aUkQAkQjVl4iZwsA6FBnPBgJxBlUv3STqMLDq3rH5PcZvwSTZw5pwwABIMgLomOxGSQzkJJoeWZtw2xt9sfGgA/+L+J+Pry9NT1l6EzAibs7LfGHqTh/k2drwmpf7gRLocX2wJNmInVMU941hAZtse3dqNchidnJdEvAGB2KQP4T3rdLEP97jKN5uifqhpEUPF1gOTVbbkeuBD2BcnvG/8K15cic8fygNSOSZB+PqwT/WJyw7b1h+Wh3iLcIcVHbRfdG3QvOWYCN2dLJIJ/2M2VMRGJH/iGSF3u8wHvZIoiwzM8hTRoy+WHkLYVx88URvQ==; s=purelymail3; d=lunabee.space; v=1; bh=y5Tz2MCs2MM3YaWA05pWXrUKfFWXWXur/6HXGs15djE=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=t7+HQQ6w0Qa46wTRAnrmWhWOMheiInqJcLztutUHUJ0YvFyF+dLHggyRVZphWpLwlojodegpZ0gVhGDNObCtCleGPBInsfTPdYATgbOK19yd0J2slsvpFOtKRKbHCUJ0FFo9wRkDbcmVXBlwjTeaL0N7mnlfrUL4SsoIkxPnJgkEvvT2KJeTavtwirxdKo4IwfNeKlws1xpV505FWF552Vm9L8MNM62hJ9vPWrkE3KflCeGvPnNPvlLI+QhTVZLOe/29Cr8zSjzzTBNMTxYylY54GBBHM1wtEnIgX5DQx3/M+TNBlGyeYn4nz9b/omkepMI1zer+KJqrKwDXahPJZg==; s=purelymail3; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:16 +0000 (UTC) Date: Thu, 19 Sep 2024 23:16:00 -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 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 Fri Sep 20 04:16:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68152 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 819C827BBEA; Fri, 20 Sep 2024 05:18:37 +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 3B21D27BBE2 for ; Fri, 20 Sep 2024 05:18:37 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5k-0008Gc-Vo; Fri, 20 Sep 2024 00:18: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 1srV5Y-0008BP-II for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17:49 -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 1srV5Y-0006Fx-8w for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17: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=80icGfl2or1lrriWwrT/nYDSX0I4T4OlYt4mLJtIZf0=; b=TzcuADFMizGiY0jV9ZX8FXq78h/fltsculty2S7VRP6C55zQbhDoRJWIj/+dRizN+mhEZAvKztxSPKO03H5RPs+dMeAVXD7Ee+Gelac9paFh+1ithRzUymnZaNIQwia1AgrvSISYRY+B+rMj6yvWFXL/+puZEOdpIqMFgvkT86j8Nd7eJP4w0m+kK6s4iynmQal0dccz+MttWE0fxamXb4E5hI5o6XtXf8r6MEBhIiry53EzIDh4EBukf+/isBj+gDYB005M053Gzc8ntquw/qKTsuLDd8OdE83JRaQZp7ouZzN+1hZkMswbDjb1m9hvCIqzTkOw8IvUUAdAoXzWNQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5q-0005UT-ET for guix-patches@gnu.org; Fri, 20 Sep 2024 00:18:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 07/11] Rename two remote variables confusingly named 'generations'. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 20 Sep 2024 04:18: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: Herman Rimm , Felix Lechner Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172680587820981 (code B ref 69343); Fri, 20 Sep 2024 04:18:06 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:17:58 +0000 Received: from localhost ([127.0.0.1]:33759 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5h-0005SJ-Jl for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:57 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:52036) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5e-0005Rh-Uj for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:55 -0400 DKIM-Signature: a=rsa-sha256; b=bjjMk8lD0P/x7H/CdQBpYAgNqU/XI8b08yQkmm6cGaqNDmPS0w5RmpefFS/DEbGT4C/rLBQj8sO3J5yyXLIUO44jul0daosFhNHFotasRtIkRsEI91OAdx3nyPryxwK8GU254Uk5RRR3fo8bEq9g/st38ytnAaq/9c2SZrwIvC+uWJCUK1boeGgNDa96AvxXsgID2P9JI9C34g3kss75XHRabqI2TWJvWPgsBaK8CHAZZdgz39UU4M37W01k+vYkXNZ8wC62cWxRZuFz0lD1lpLxxI7fH3Rp5GXpgs0io/A9ivdi069OnJNUhhdoTqyAq8X5EIeAGFqRXWBvmuYXrA==; s=purelymail3; d=lunabee.space; v=1; bh=zyS70lqfQXnJ0l6hxl0r9f5BP9QpTTTkEhs2PRCAb+I=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=G3Pt1eEHDWK4/MTy1sQECvKa5CXCtyfy2ssJ9BkKPWejQg12V/8TIOCfhDvKwxoLlc6L+L1W3WcXLVsoIlev1Zrfm4PVnBx9FsMn3+RRCVwfULsBhMUgv4JcFYd/M2NFHfmkuXqcTFHxEZqRA47QeLMC9zJGwpTotc3AuHoiu3X0slOc9yK344dyFkdEGOpOjVAfPoKxocXEBasxBBfD52wV+m8dP6csNWlU9+Xfk5C7vwyzTlXVpVaA0YN8mMdiqzZ2bu9CqfzjAhnq/hkv0fpuK9+j0BeAISa5gC7BBEBajaPQo37IUOsgSgowwkY0DGqWQx5+wki0sZd0T0v/kw==; s=purelymail3; d=purelymail.com; v=1; bh=zyS70lqfQXnJ0l6hxl0r9f5BP9QpTTTkEhs2PRCAb+I=; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:17 +0000 (UTC) Date: Thu, 19 Sep 2024 23:16:01 -0500 Message-ID: <849f65d3453b94dcef8c572a8486196695d865bb.1726805765.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 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index f3d2a77625..a96ca68f47 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -449,10 +449,11 @@ (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 +466,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 Fri Sep 20 04:16:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68156 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 29CD927BBEA; Fri, 20 Sep 2024 05:18: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=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 9EF9D27BBE2 for ; Fri, 20 Sep 2024 05:18:51 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5l-0008Gn-EN; Fri, 20 Sep 2024 00:18: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 1srV5Z-0008BX-Fa for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17:49 -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 1srV5Z-0006GT-6o for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17: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=mJb8zogLkciBCSKtTzIaU7yL8M3u+6r2DO6mrNaoYOk=; b=b9aF5/nD7nFgu+tXSn7/8WhzuwFe649wmag2fNG+lCMTb8yiTATwhS19DJTyFok81M6X7vCPMntcai8S6cs9byDDVyGMdfqS2PVHHkOC8tVlIuVrmMTB1TZubuTdSop12t4XSQYMY5QIrz0paX0O6ie4/nFqJinO6YzVGqzF6qeLG2SIic6PAHpE4UuwRB24EIDTPmx0k8h9EO4EcYjF3bTCtCA3gekKjwz/XQWSXsSbvUKXsIk88PxwxhXdAP2ZrlCmnQYbTPWwabQ6GRIP/QksPYBnCpnnW2cSXQkk8E8Fn9Pam62NGgjVgWddwPqi6a3RL83sbikQ/ck3mQGOBA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5r-0005Uq-GE for guix-patches@gnu.org; Fri, 20 Sep 2024 00:18:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 08/11] 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: Fri, 20 Sep 2024 04:18: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: Herman Rimm , Felix Lechner Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172680588421062 (code B ref 69343); Fri, 20 Sep 2024 04:18:07 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:18:04 +0000 Received: from localhost ([127.0.0.1]:33777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5n-0005TT-Lx for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:18:04 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:45866) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5g-0005Rm-Ns for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:57 -0400 DKIM-Signature: a=rsa-sha256; b=n7Dc9fsCHGIqmT8CxI+iNHoZLp1ykUQRibyYyj2WwNd77X7q4pgZ6xCiMJm0noQjei06SWyLB6MqKaRa6yafZGmnWz5dOk7LzRWuFp9Hp/ADVyENGPTZRGI0UBSg7f0A/xXq0cBmNxQjrVtOfz+wTKTyie/hFCJfcM+eci4oN7Grl0bJrwb+ElXHYSj6h2nc6IaDh9rkIZ/jnYZqaufSZ4lgYr85Q1mi4EmErMmyUTJ4dLLfIGnnFpGn8xFTDE/w5+LkDwoYVAxGSe15yw61NBLA9MiFf/JFKPXuRcwxDNA2aappiwOuve8RX9YWTC5RW03q3mk2mB2Ji11XYvqrTQ==; s=purelymail3; d=lunabee.space; v=1; bh=tUvD0ZLiDclvWKVBcWJbB0D6FAVkMJQpUX9BbzR++hc=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=uzb+BWicjSXZXDruVLtzb8B05JHGjR7yxe+/ldYuN2F23qvetEKzZWzSmLMfUaDvhQkVF1fVuE6mXu6PjMtR/GsLYU0fBPWONuOBxMU3eFMs/LWdDY/gWy6m0KCjihyDq6uGOQ09Ez/gRGYpD1ZVq9E0/LLGsNZCW8yX4bcsXl9X/vszAnttsTMWZB+F7yE2jg1jMRkkcNwHuBRbv9O+l758doTM5rqT1b0vCuJQAXxfeQHUm8nOxp8hqhCWA2ycoITwnque3dfS+gznDjPGNTX+BKQvV30yXZBkd5HfYwIEtxAjTak36uCDQ/A0P2OBlOEj0MkwXOb/Hhn8N+5tCA==; s=purelymail3; d=purelymail.com; v=1; bh=tUvD0ZLiDclvWKVBcWJbB0D6FAVkMJQpUX9BbzR++hc=; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:18 +0000 (UTC) Date: Thu, 19 Sep 2024 23:16:02 -0500 Message-ID: <6e4fc53df2ff12590bfa557c38f4ea03446f5749.1726805765.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 | 47 +++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index a96ca68f47..37806a2e1b 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -580,31 +580,28 @@ (define (roll-back-managed-host machine) (define roll-back-failure (condition (&message (message (G_ "could not roll-back 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))) - (old-entries -> (map boot-parameters->menu-entry - (drop boot-alternatives 2))) - (bootloader -> (operating-system-bootloader - (machine-operating-system machine))) - (bootcfg (lower-object - ((bootloader-configuration-file-generator - (bootloader-configuration-bootloader - bootloader)) - bootloader entries - #:locale locale - #:store-crypto-devices crypto-dev - #:store-directory-prefix store-dir - #:old-entries old-entries))) - (remote-result (machine-remote-eval machine remote-exp))) + (mlet* %store-monad + ((boot-alternatives (machine->boot-alternatives machine)) + (_ -> (if (< (length boot-alternatives) 2) (raise roll-back-failure))) + (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 + (machine-operating-system machine))) + (bootcfg (lower-object + ((bootloader-configuration-file-generator + (bootloader-configuration-bootloader + bootloader)) + bootloader entries + #:locale locale + #:store-crypto-devices crypto-dev + #:store-directory-prefix store-dir + #:old-entries old-entries))) + (remote-result (machine-remote-eval machine remote-exp))) (when (eqv? 'error remote-result) (raise roll-back-failure)))) From patchwork Fri Sep 20 04:16:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68149 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 AC04427BBEA; Fri, 20 Sep 2024 05:18:14 +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 6DCE027BBE2 for ; Fri, 20 Sep 2024 05:18:14 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5f-0008DO-4m; Fri, 20 Sep 2024 00:17:55 -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 1srV5a-0008Ck-Lt for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17: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 1srV5a-0006Go-CF; Fri, 20 Sep 2024 00:17: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=3vJs6hPqNL85y9eyKAWNH9jAawLjkkIzXe+vUd+liNM=; b=Jb+rP136NbRbEt5vBVaJD/X5xEL+kWxZ5v+rlStGp5VK8rCMqgroYxp7a9Zx6kyVzWCnY60w8NPP15zlk3eO9Q0bM/9unt564aEsYoymnLIXIzZouct0r18vpC6a+vyjaZKC7zTSQLUPeTMu37Nuokt9X65z7JEu9EhrsmWv8NKnL0JJWUFpZyT/35fnLusEpfFCZbbg+0s7CK8/9xYGajVexo/0G0o4gK/P1NikigS8V9HVoGf5Fuz9L8QMD5K6vM+WEMxTnBb4rNCKcG4ZuFj0QWSftD6gaKLVZrbOQHan6mSFgdHHDhT89UgoJ6DlIS42b2v98vRxGJsgnYiMEQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5r-0005Ug-0T; Fri, 20 Sep 2024 00:18:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 09/11] 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: Fri, 20 Sep 2024 04:18: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: Herman Rimm , 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.172680587820989 (code B ref 69343); Fri, 20 Sep 2024 04:18:06 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:17:58 +0000 Received: from localhost ([127.0.0.1]:33761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5h-0005SM-Vj for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:58 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:49290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5f-0005Ri-TA for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:56 -0400 DKIM-Signature: a=rsa-sha256; b=Z7gGcFRH42ouJUBrC0jepZS1ktTdpjQhORxFfBFBLpWlncOMnbP8Rz04cfhh45Eiurg8iJmPA+dKZAvogpbMiKuXWoXUbkxuss+YVqejdPGsw92v052pT/T/knsXrzFJ4xqS/68JujQXjpCdI6dMIrUAajq+JV0dAIgI15W9yr3xJpjJkIPqkF3UQmm5DD1rNEQekbTDk8D7gkK+hXSUUR1zwOxq5Dr017hEeBryVGyZl0SrB6xHKYs0W7cFcsFjbhBe0523PL3NCduxLXyYu08aevVmSFQdzy7c/VheittESOV7QRHqYMcypPs5rzfHO5GuTtS25cmWcbHFkBpcyw==; s=purelymail3; d=lunabee.space; v=1; bh=NWG6NUH0mK7gkG+sq9A+xR0W0wwVR7O7WawedBxVieU=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=XqSx6r2ltKsSS4M22PWdusyBYhIN86heZBGfEsSRrAoIXK1MPzDFg4RIkyzTQ8Oc1iTKKMiBatLD880f5PiFXntZxjS1JQ3aPugLYOoC5/rBm4J5EsezitYfcMsHp6ICaklJTUXvZsm9kwaF5tooHyIvGzN17W9AHWnkQg+PBoaMyL9am9yKcXYwjIREW0RBMB8Fjbp7mid7ogPk4iPzCFkoQNON2hXJnYTYalXOVi4Y+0oNsiypQgryPYM6j2CygsAke0/ZkHW+/c+7B+uu79E9+eV7lk1JQQv8TG6sOZbPwXJLMlTEEECP3a/t9S8LcvOdvGoXMeFvlpK1h/61/g==; s=purelymail3; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:19 +0000 (UTC) Date: Thu, 19 Sep 2024 23:16:03 -0500 Message-ID: <5cfea442dfbae70e44123556783d4df9e69113be.1726805765.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 Fri Sep 20 04:16:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68148 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 CB7EA27BBE9; Fri, 20 Sep 2024 05:18:13 +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 5BA3E27BBEB for ; Fri, 20 Sep 2024 05:18:12 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5f-0008DQ-4l; Fri, 20 Sep 2024 00:17:55 -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 1srV5a-0008Cs-W4 for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17:52 -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 1srV5a-0006Gx-MS; Fri, 20 Sep 2024 00:17: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=T7BKkIrypFS3jrOnHYS9zc/rfHl2KYrYktxjcyxu/0M=; b=RPtdRsXud2QWX1OFCcgByCqpZfyBRDbvT5VA8O6CjSOMuFX3FUa0G2HNP24G0DBkSGSRqWqA9v3iPRzGdey7DglDGbqLL9kK9Sz7F9JYWdRJvmgcvd80nLb2NDmbscGfHJfzzDGt7RuiPXB1tzGQm8ZoUksbmJz5GXko+JNyP9WFjcCjRrWYPW5YDSRejVpSx/Vdf3oo2EErk9GCcBQflc95LUExRh7ehbBYtz7lmfJhO5cHlRBFwIHBmkoZmr6iIP7dWJ/IPlN6bK2TD1kytVV365N6X3QAhAMXKPO1Uvx7dITJANTeMxpYl6OdamXcYzo3BOLfzruhBeLU/itTSg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5s-0005Uz-08; Fri, 20 Sep 2024 00:18:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 10/11] 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: Fri, 20 Sep 2024 04:18: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: Herman Rimm , 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.172680588521080 (code B ref 69343); Fri, 20 Sep 2024 04:18:07 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:18:05 +0000 Received: from localhost ([127.0.0.1]:33780 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5o-0005Tc-Ce for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:18:05 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:49292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5j-0005Rt-4j for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:59 -0400 DKIM-Signature: a=rsa-sha256; b=FJJaHPka5raJy0dM+yvNeaYzw4YT9n+yuKWeG6yCqXieSfuyg0MLFKCnSG/zBfPeKrwxIF5y1urkjN8KFSHQxymj5p20Ascsz3+FfCpfq9EoZkBtI8RBsPXtE8ExTg7kUd1hhFHxqIefFYIrxDnVvrg2QmF3kFklUcC+ElAbDVEn4wGlRs9bZX5/CAeCzxc6bajwPtVjbnKX+RjqpOjcZRa8BbZ4x7nd9lVD6ZAOE27n84YK34uoyiY4Nn9SK+Dgqvt9aWwYvP0Y8i/qOAVPOHyXRRfRNqIBPkzmoVgb+4G6jE+SzF8sMW8U+gkLudVIusuofHgTfy2K7pyqs50YDg==; s=purelymail3; d=lunabee.space; v=1; bh=Tk8W7qM2jR/8/MeUJ1Qk7Yr0/D33pJMJPZnx9XqDdmw=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=PTgqHIDGIOm+kFyj20z10vUOjUvP0dSv9SHdHwKVA1lkG/kFUH/OUktY5agBvK0Lwfv2qE3tvfC3xkevWHhps35tfzKPyFTaHMtQCdMK1A6KH44c3pEQONZ0yooj29rtJqrilSggBnayYuI/4bU4u1jyMZTEZEPcAdzKx5mlxOgR4tJU1vyaL857FXDnY/ZN8cumSNd59txSKru6kjv1AUizG7eGQu3QNiDTqBekK7wvNQwFPMMSO2nE/p1nqVWkbEl2SfQ5Ta6tLD//MeE/6YnSW/DndrcPdd4rWeJQ+zaLsQBAiOwF0aljXfRjCd0T5p32pooy6+8J2MFUmAI9MQ==; s=purelymail3; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:20 +0000 (UTC) Date: Thu, 19 Sep 2024 23:16:04 -0500 Message-ID: <852043d05b73160c4613e209130a527fb1f7a5ce.1726805765.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 Fri Sep 20 04:16:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68150 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 290AC27BBEA; Fri, 20 Sep 2024 05:18:20 +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 689C427BBE2 for ; Fri, 20 Sep 2024 05:18:19 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5g-0008EI-1W; Fri, 20 Sep 2024 00:17:56 -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 1srV5b-0008Ct-BM for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17:52 -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 1srV5b-0006HB-2V; Fri, 20 Sep 2024 00:17:51 -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=CVCi42lFimSRcTBveBAN2e7asJDrqVnuPKZEwLFRcJE=; b=PUC+BIvBVLhJLaguTGnyTVAI+tlFM+zBCFBPCeqR/pPYD4fIj2/OK3p23Ro6bqeqP0dqjlvVbWUKVzSdSPvsfUe/vHGqS7rRsTsHRr3njHYLciv+cpWbPGdMlLrWQViAU6+T1zVWqJLSk/T5lgyn21+W/EMBtK3CTxv90iubnDylIsYXj+QOcy6TAiWAcqCBs1ZrjWsLo9fbg8EvNbSc3u0tXfSr0Jv2IjvhQh+BTBwItG1lkBoJ/Fb2I02yxmkkyNt6A0G6qPZV4igiPq8NRv2yWUApv48FI8IrwgSyD0dSxv4GtGZWQgy0zVwfnRaq6VoykOu5n/JXT8uWVpRT4w==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5s-0005V9-Gw; Fri, 20 Sep 2024 00:18:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 11/11] 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: Fri, 20 Sep 2024 04:18: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: Herman Rimm , 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.172680588621103 (code B ref 69343); Fri, 20 Sep 2024 04:18:08 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:18:06 +0000 Received: from localhost ([127.0.0.1]:33785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5p-0005Tu-3B for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:18:06 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:52048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5k-0005S7-LB for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:18:01 -0400 DKIM-Signature: a=rsa-sha256; b=DibIcuQEXQw7YTzXyFPqPopKEUwmgrll1ZZCjnacTamT2mBRszLQYeNtIzdwamPFcaGAXRAUFG/8rei1WalRFz0WN7pONEXN3UeIoMYbz0cPeUmiwhbrzHpPkJMlQUmnnZsaHlROh4UnwYjSc5N1WaFLx1lm6QFyzS8/Fqm96N3D+8hBxH2vbHXvFGq+fwA4UXY+2AAxxMX6PcLAyFvUbPoIz1jgmv9UWuEPqUT63qCAyRLxpEYYthC1BfnbNPY9O/W8nJTkMfurapYIGpNHHJiRYzUlBcNjbH5MAMozA73AlDYxo9YBVOE5xD4S7yI7yuYrYcHMNQ+4oHk43zxeDg==; s=purelymail3; d=lunabee.space; v=1; bh=Wdaw++7Zd+Ll/cgrIr/flJd7mddXi3SKccGFa4Iyfic=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=jjjxJhFB7gvW4QvYIzVy5d73/DU21x1JUnPaRjEO430WssxEqEL6o9DnNm9sKxvO3MhA1/Z/GHQjTyPr7HU9oV5czRujCYX/eLdNdBnlr8ab5s7+gx9RhJl2Pz2/3m6fhGAEvRBCMeVQvY+XuPMstnPWF9rGyagwNz+WJ+pHO+xt+K6oXx28ixrVmcTpsl5XS+FRPpKHDxuiG4JhxnUU8SAx/lcRA8tHL9wVE593QODXnT/CPErM34MLcfjTIvGLsYS935E5H/d8LrZuvFxj5gDu0PQGQubBu89Q6popvRg8bb1qHSRMiDfWeHxm+1a8D5IMe5Rnchj92BxR5QQ+aw==; s=purelymail3; d=purelymail.com; v=1; bh=Wdaw++7Zd+Ll/cgrIr/flJd7mddXi3SKccGFa4Iyfic=; 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 -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:21 +0000 (UTC) Date: Thu, 19 Sep 2024 23:16:05 -0500 Message-ID: <5440f547c4fd458acdc327afeded9a6067e98124.1726805765.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 | 29 ++++++++++++++++++----------- gnu/system/boot.scm | 14 ++++++++++++++ guix/scripts/system.scm | 32 +++++++++++++++++++++----------- 3 files changed, 53 insertions(+), 22 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 37806a2e1b..ca0f3483a4 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)) @@ -459,13 +459,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 ...) @@ -509,7 +514,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 ...) @@ -583,7 +589,8 @@ (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)) diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index 82ca353cb3..c29e48d607 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)