From patchwork Fri Mar 8 08:11: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: 61517 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 F067127BBE2; Fri, 8 Mar 2024 08:26:25 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 858CD27BBEA for ; Fri, 8 Mar 2024 08:26:24 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVXz-0003xd-ME; Fri, 08 Mar 2024 03:25:43 -0500 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 1riVXr-0003u1-F1 for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:36 -0500 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 1riVXn-00017j-TY; Fri, 08 Mar 2024 03:25:33 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYH-0002d8-R6; Fri, 08 Mar 2024 03:26:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 01/12] Fix bug where the extra menu entries for a bootloader were shown twice. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.17098863129829 (code B ref 69343); Fri, 08 Mar 2024 08:26:01 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:12 +0000 Received: from localhost ([127.0.0.1]:56366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXU-0002YP-AU for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:12 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:50346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXR-0002Xf-Of for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:11 -0500 DKIM-Signature: a=rsa-sha256; b=pdcFJh5Fc8pKi2pNnxOxq5vAZFLBnShAyu4z1xS8PUwIDq45BBpiPSLlS6cMYZHWjSG3oaEtPfJbkKQUWRbw2z+lpVlp1J+LNiskJEFuXBKXJLgLw1w3D/I1dEtJ2ei3g/mS58AyMJv4zBjIyWnVgPEE50zxoCDYtblbD1IoXCD3igUqIGf97W7AzSYs75bdia6iYIWeEvyGEXz3kHW68/47ihDfEm/QdWSXss/4QxSXluEQ3Zzwg009OjkIQCLEYkoCA/XT4Zi5fIxUTL4KyZRPBhwm1A/SbIE9hRrIejKRAha6m+EHvdanv6XlJF8ayaUPj0mpJnVCitm4UJzCog==; s=purelymail2; d=lunabee.space; v=1; bh=fCEMsAZDlsjjuNAiHe2ZCGN4mX7EqE0z1rJPWXBnl3o=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=KS1khdGaxkbH2I0kmQ/I2NB05kcxslg8Zl5T5oDQsSTBqQAowMUcL0WRd9rGNb6lOU0utJPRLjQ0SsJlyCQIqE+E8O+H46UX2W4648tDAzPAG3/v62ezCnOlVYDTlwNg2lj0Ds5z8K8O1t31WZrN73rimPWmuCZKfyiO9DZh4fVKqZIF8ysW59EJ24OofRAMECUap9vUgHDLYJIU5dPxDKfttUwhDVhVHDCcv5Xw9x1U87aEmSE7Tn8JxwOsaLw/SDN0fYMLFu8LBStTRkipKo7dl8YFZvI299+wCMtkTthXGGYQCwkV5joSje30rCD5VNZs09bz8LOrX570TMe0Kg==; s=purelymail2; d=purelymail.com; v=1; bh=fCEMsAZDlsjjuNAiHe2ZCGN4mX7EqE0z1rJPWXBnl3o=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:16 +0000 (UTC) Date: Fri, 8 Mar 2024 02:11:57 -0600 Message-ID: <8dc29d9f104ed8b62c7b952b5dcc99de8c216c8a.1709885528.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 bf3d2f9044..955dfa618d 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -407,8 +407,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 Mar 8 08:11:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 61511 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 7955E27BBEA; Fri, 8 Mar 2024 08:26:03 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 C4BBF27BBE2 for ; Fri, 8 Mar 2024 08:26:00 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVY0-0003yM-8M; Fri, 08 Mar 2024 03:25:44 -0500 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 1riVXr-0003u0-Er for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:36 -0500 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 1riVXn-00017i-Q6; Fri, 08 Mar 2024 03:25:31 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYI-0002dI-C2; Fri, 08 Mar 2024 03:26:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 02/12] Move record to a separate file. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.17098863159839 (code B ref 69343); Fri, 08 Mar 2024 08:26:02 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:15 +0000 Received: from localhost ([127.0.0.1]:56368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXV-0002Ya-MF for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:15 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:50344) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXR-0002Xe-OE for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:11 -0500 DKIM-Signature: a=rsa-sha256; b=RjSiK+MgUddl1a9F9XMtBhKj/vu9JAbHLRx95ted8ja7xzo5/PfK3YiUZGw35SxHub+5GPPKDf2o0EiXSoOGOIhvMqhYIVfcFoPR6MXTr3cF8IYactiddRs5/cY/GF45zPVx6Z5jMoN9BAizuEyv9z5YXRraCyah6PFPCOyT+QRGsIjHML2MfCP/WhOVA4vctq9rX97849SmT3Nxsh0cp6pg9Byj3Gcj8YPKESYkuHqCIWyvacSOYXkJmf/WEaV/9Rd6FBM5o0dt0RElSY48iDByPyoitX0cZ3U7TNq69JIxlSdna4msyoC0+JDNx3VMakvVNoXWVkFON5rm493TEg==; s=purelymail2; d=lunabee.space; v=1; bh=LlLVHVpoc6KGb1tSNTAA3cHJ7lukUtLNNYgewojkPGs=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=QSbiSDnpvjPKEg6Yl7zAt5+nyGPx8MSFIoLz1dKwSQWH6iVbclu6NqZMc4XCNpXMdEjHLjqNnc85mHomFJGrRKNu4Jguro4Udh4dCgChcqZ5Y+f0q70fFhY1hSMhmUTZL4FHrBPmO451f7NzydAgUpqYVeGDODDL0FFhPjzXh/VNL0u1MXS3/24FZNRNpcJl2lddmIXPSK58NJi0iSsFccLKCxzzxTnSlKW7NvrvthTtAvC+rhhbK0o7AUjBQ3yY64OBfck8Xo6sKbisax9Ff1eXL1DacPQaFMjekI2hWu1qzcTHepWWvVTYze82bY27B6+5vgU1Z5BrGdasFR8s+w==; s=purelymail2; d=purelymail.com; v=1; bh=LlLVHVpoc6KGb1tSNTAA3cHJ7lukUtLNNYgewojkPGs=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:17 +0000 (UTC) Date: Fri, 8 Mar 2024 02:11:58 -0600 Message-ID: <3dd7292b65fad15b1f808a22a7cc73560ee7d4b4.1709885528.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, ensure-not-/dev, read-boot-parameters, read-boot-parameters-file): ...these procedures, to... * gnu/system/boot.scm: ...this new file. * gnu/machine/ssh.scm, gnu/system.scm, guix/scripts/system.scm, tests/boot-parameters.scm: Use new module above. Change-Id: I6944ffd4c323c776005b0cef23218bffae59be23 --- gnu/machine/ssh.scm | 1 + gnu/system.scm | 236 +----------------------------- gnu/system/boot.scm | 296 ++++++++++++++++++++++++++++++++++++++ guix/scripts/system.scm | 1 + tests/boot-parameters.scm | 1 + 5 files changed, 300 insertions(+), 235 deletions(-) create mode 100644 gnu/system/boot.scm diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index b47ce7c225..0ffe71367c 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)) diff --git a/gnu/system.scm b/gnu/system.scm index aede35775e..048f9090e0 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -70,6 +70,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) @@ -143,31 +144,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 @@ -327,210 +308,6 @@ (define* (operating-system-kernel-arguments ;;; Boot parameters ;;; -;;; Version 1 was introduced early 2022 to mark the departure from long option -;;; names such as '--load' to the more conventional initrd option names like -;;; 'gnu.load'. -;;; -;;; When bumping the boot-parameters version, increment it by one (1). -(define %boot-parameters-version 1) - -(define-record-type* - boot-parameters make-boot-parameters boot-parameters? - (label boot-parameters-label) - ;; Because we will use the 'store-device' to create the GRUB search command, - ;; the 'store-device' has slightly different semantics than 'root-device'. - ;; The 'store-device' can be a file system uuid, a file system label, or #f, - ;; but it cannot be a device file name such as "/dev/sda3", since GRUB would - ;; not understand that. The 'root-device', on the other hand, corresponds - ;; exactly to the device field of the object representing the - ;; OS's root file system, so it might be a device file name like - ;; "/dev/sda3". The 'store-directory-prefix' field contains #f or the store - ;; file name inside the 'store-device' as it is seen by GRUB, e.g. it would - ;; contain "/storefs" if the store is located in that subvolume of a btrfs - ;; partition. - (root-device boot-parameters-root-device) - (bootloader-name boot-parameters-bootloader-name) - (bootloader-menu-entries ;list of - boot-parameters-bootloader-menu-entries) - (store-device boot-parameters-store-device) - (store-mount-point boot-parameters-store-mount-point) - (store-directory-prefix boot-parameters-store-directory-prefix) - (store-crypto-devices boot-parameters-store-crypto-devices - (default '())) - (locale boot-parameters-locale) - (kernel boot-parameters-kernel) - (kernel-arguments boot-parameters-kernel-arguments) - (initrd boot-parameters-initrd) - (multiboot-modules boot-parameters-multiboot-modules) - (version boot-parameters-version ;positive integer - (default %boot-parameters-version))) - -(define (ensure-not-/dev device) - "If DEVICE starts with a slash, return #f. This is meant to filter out -Linux device names such as /dev/sda, and to preserve GRUB device names and -file system labels." - (if (and (string? device) (string-prefix? "/" device)) - #f - device)) - -(define (read-boot-parameters port) - "Read boot parameters from PORT and return the corresponding - object. Raise an error if the format is unrecognized." - (define device-sexp->device - (match-lambda - (('uuid (? symbol? type) (? bytevector? bv)) - (bytevector->uuid bv type)) - (('file-system-label (? string? label)) - (file-system-label label)) - ((? bytevector? bv) ;old format - (bytevector->uuid bv 'dce)) - ((? string? device) - (if (string-contains device ":/") - device ; nfs-root - ;; It used to be that we would not distinguish between labels and - ;; device names. Try to infer the right thing here. - (if (string-prefix? "/" device) - device - (file-system-label device)))))) - (define uuid-sexp->uuid - (match-lambda - (('uuid (? symbol? type) (? bytevector? bv)) - (bytevector->uuid bv type)) - (x - (warning (G_ "unrecognized uuid ~a at '~a'~%") x (port-filename port)) - #f))) - - ;; New versions are not backward-compatible, so only accept past and current - ;; versions, not future ones. - (define (version? n) - (member n (iota (1+ %boot-parameters-version)))) - - (match (read port) - (('boot-parameters ('version (? version? version)) - ('label label) ('root-device root) - ('kernel kernel) - rest ...) - (boot-parameters - (version version) - (label label) - (root-device (device-sexp->device root)) - - (bootloader-name - (match (assq 'bootloader-name rest) - ((_ args) args) - (#f 'grub))) ; for compatibility reasons. - - (bootloader-menu-entries - (match (assq 'bootloader-menu-entries rest) - ((_ entries) (map sexp->menu-entry entries)) - (#f '()))) - - ;; In the past, we would store the directory name of linux instead of - ;; the absolute file name of its image. Detect that and correct it. - (kernel (if (string=? kernel (direct-store-path kernel)) - (string-append kernel "/" - (system-linux-image-file-name)) - kernel)) - - (kernel-arguments - (match (assq 'kernel-arguments rest) - ((_ args) args) - (#f '()))) ;the old format - - (initrd - (match (assq 'initrd rest) - (('initrd ('string-append directory file)) ;the old format - (string-append directory file)) - (('initrd (? string? file)) - file) - (#f #f))) - - (multiboot-modules - (match (assq 'multiboot-modules rest) - ((_ args) args) - (#f '()))) - - (locale - (match (assq 'locale rest) - ((_ locale) locale) - (#f #f))) - - (store-device - ;; Linux device names like "/dev/sda1" are not suitable GRUB device - ;; identifiers, so we just filter them out. - (ensure-not-/dev - (match (assq 'store rest) - (('store ('device #f) _ ...) - root-device) - (('store ('device device) _ ...) - (device-sexp->device device)) - (_ ;the old format - root-device)))) - - (store-directory-prefix - (match (assq 'store rest) - (('store . store-data) - (match (assq 'directory-prefix store-data) - (('directory-prefix prefix) prefix) - ;; No directory-prefix found. - (_ #f))) - (_ - ;; No store found, old format. - #f))) - - (store-crypto-devices - (match (assq 'store rest) - (('store . store-data) - (match (assq 'crypto-devices store-data) - (('crypto-devices (devices ...)) - (map uuid-sexp->uuid devices)) - (('crypto-devices dev) - (warning (G_ "unrecognized crypto-devices ~S at '~a'~%") - dev (port-filename port)) - '()) - (_ - ;; No crypto-devices found. - '()))) - (_ - ;; No store found, old format. - '()))) - - (store-mount-point - (match (assq 'store rest) - (('store ('device _) ('mount-point mount-point) _ ...) - mount-point) - (_ ;the old format - "/"))))) - (x ;unsupported format - (raise - (make-compound-condition - (formatted-message - (G_ "unrecognized boot parameters at '~a'~%") - (port-filename port)) - (condition - (&fix-hint (hint (format #f (G_ "This probably means that this version -of Guix is older than the one that created @file{~a}. To address this, you -need to update Guix: - -@example -guix pull -@end example") - (port-filename port)))))))))) - -(define (read-boot-parameters-file system) - "Read boot parameters from SYSTEM's (system or generation) \"parameters\" -file and returns the corresponding object or #f if the -format is unrecognized. -The object has its kernel-arguments extended in order to make it bootable." - (let* ((file (string-append system "/parameters")) - (params (call-with-input-file file read-boot-parameters)) - (root (boot-parameters-root-device params)) - (version (boot-parameters-version params))) - (boot-parameters - (inherit params) - (kernel-arguments (append (bootable-kernel-arguments system root version) - (boot-parameters-kernel-arguments params)))))) - (define (boot-parameters->menu-entry conf) "Return a instance given CONF, a instance." (let* ((kernel (boot-parameters-kernel conf)) @@ -692,17 +469,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..3f227ab801 --- /dev/null +++ b/gnu/system/boot.scm @@ -0,0 +1,296 @@ +;;; 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 + + 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 (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 955dfa618d..40df166fd7 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -66,6 +66,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 Mar 8 08:11: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: 61515 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 CCDA827BBE2; Fri, 8 Mar 2024 08:26:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 D189F27BBE9 for ; Fri, 8 Mar 2024 08:26:16 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVXz-0003xe-Lz; Fri, 08 Mar 2024 03:25:43 -0500 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 1riVXr-0003tz-EJ for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:36 -0500 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 1riVXn-00017f-JD for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:33 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYJ-0002da-7v for guix-patches@gnu.org; Fri, 08 Mar 2024 03:26:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 03/12] Also move boot-parameters->menu-entry. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.17098863169856 (code B ref 69343); Fri, 08 Mar 2024 08:26:03 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:16 +0000 Received: from localhost ([127.0.0.1]:56372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXX-0002Yp-MH for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:16 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:44420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXR-0002Xh-Pf for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:12 -0500 DKIM-Signature: a=rsa-sha256; b=NYjvTWOoNOHhobAvEz2lexrd02AD9HC6rlcjEnVLFvkkOHYsCL+RX1YU3bfvgIAoCgPTGB7WUF/gYr8K3F44C3yRJKSH873Gw1ZvVpGwc1iU0bIhd3xNPBfNX/U/3tG1jW9tq+oaCWgVm522fgXPqnVWCI9qo78supkvdU1GATnjNcfFigK6StSDQIjbKXO2POcN+Q5w4feAVTcgIK/kXqA0OingClJy56YGYPW+FlcKXwx5vqlliU+upajFOVS1dEENuwCr/3wggxaWGwvkIQMoDEp26ihV8zocWsDrnSxhG8pqSz9gIyKMt08HCCI5moqqtpJMhxkBzRlOM1iUNA==; s=purelymail2; d=lunabee.space; v=1; bh=/VJhDQboy/jow/7qyOsO5u1Zdw4fsR4EolZBMKglkVY=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=IdIhwC0pornuvEjfXN/L3xm+Dx18ygeWnHXFLnABey5XTPsL6+DlMIMyEk2BKvxasB1e/Uhiuwd4G4CJMQE5BQnU/R8kPpHAF3HitSaBlmsaGHlC06qsfdStWEIalvnrjSQ2fTQSlwybPsLNBF9f+16PsbwIsndWRQ8Cj9fWaPRrk/3SuRwNvZz/8JbOm3ScJgvbxqtVsLu2+QelyjojicXXneAnfyrcVqadnsS11qXzvtxOBjgpEzfBIx7Vt+8hcgK8SyykDeCZJS7O43DyU9SYT5FLm3Y6h/hMdH97JDhg+aF1TXR8/8PUYdvld401ZqNpNyeWXv6n3RtX6l1HCw==; s=purelymail2; d=purelymail.com; v=1; bh=/VJhDQboy/jow/7qyOsO5u1Zdw4fsR4EolZBMKglkVY=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:18 +0000 (UTC) Date: Fri, 8 Mar 2024 02:11:59 -0600 Message-ID: <3ea3ac3e5c436726d19ea4df603f88d0bc861c2e.1709885528.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Felix Lechner * gnu/system.scm (boot-parameters->menu-entry): Move to... * gnu/system/boot.scm (boot-parameters->menu-entry): ...here. Change-Id: I794198e074b6d3012526a3056599ee3db1f1cdba --- gnu/system.scm | 28 ---------------------------- gnu/system/boot.scm | 25 ++++++++++++++++++++++++- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index 048f9090e0..11f8e06cc0 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -149,8 +149,6 @@ (define-module (gnu system) hurd-default-essential-services - boot-parameters->menu-entry - local-host-aliases ;deprecated %root-account %setuid-programs @@ -303,32 +301,6 @@ (define* (operating-system-kernel-arguments (append (bootable-kernel-arguments os root-device version) (operating-system-user-kernel-arguments os))) - -;;; -;;; Boot parameters -;;; - -(define (boot-parameters->menu-entry conf) - "Return a instance given CONF, a instance." - (let* ((kernel (boot-parameters-kernel conf)) - (multiboot-modules (boot-parameters-multiboot-modules conf)) - (multiboot? (pair? multiboot-modules))) - (menu-entry - (label (boot-parameters-label conf)) - (device (boot-parameters-store-device conf)) - (device-mount-point (boot-parameters-store-mount-point conf)) - (linux (and (not multiboot?) kernel)) - (linux-arguments (if (not multiboot?) - (boot-parameters-kernel-arguments conf) - '())) - (initrd (boot-parameters-initrd conf)) - (multiboot-kernel (and multiboot? kernel)) - (multiboot-arguments (if multiboot? - (boot-parameters-kernel-arguments conf) - '())) - (multiboot-modules (if multiboot? - (boot-parameters-multiboot-modules conf) - '()))))) ;;; diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index 3f227ab801..a3b9cce7d2 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -69,6 +69,8 @@ (define-module (gnu system boot) read-boot-parameters read-boot-parameters-file + boot-parameters->menu-entry + ensure-not-/dev system-linux-image-file-name)) @@ -272,6 +274,28 @@ (define (read-boot-parameters-file system) (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) + '()))))) + (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 @@ -292,5 +316,4 @@ (define* (system-linux-image-file-name #:optional ((string-prefix? "riscv64" target) "Image") (else "bzImage"))) - ;;; boot.scm ends here From patchwork Fri Mar 8 08:12: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: 61514 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 817E527BBEA; Fri, 8 Mar 2024 08:26:16 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 042F527BBE2 for ; Fri, 8 Mar 2024 08:26:16 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVY0-0003z5-E3; Fri, 08 Mar 2024 03:25:44 -0500 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 1riVXr-0003u3-Gh for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:36 -0500 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 1riVXo-00017p-KV; Fri, 08 Mar 2024 03:25:33 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYI-0002dR-SF; Fri, 08 Mar 2024 03:26:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 04/12] Rename seconds->string procedure to epoch->date-string. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.17098863159848 (code B ref 69343); Fri, 08 Mar 2024 08:26:02 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:15 +0000 Received: from localhost ([127.0.0.1]:56370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXX-0002Ye-4I for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:15 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:44418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXR-0002Xg-Of for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:11 -0500 DKIM-Signature: a=rsa-sha256; b=gLVzM1zGhiQ9WgYBAy29LSF4viAbJoH+TXnDBOVDpjTFKbmnnTsI86nGoQwwiJhdhVE1aS4hsR6TkmTjAJH691b1NRKccnosAHmG8OTQNgk0Mm2ch5vkrHgKVJCqkTxUTcRJQD8fq7FWRg+KRH5GWlnYayqWj1pT+RpLWQNVXiovzK9Xy67b7PyIvcvrM14ggnkTSSaHBbLN7PpctB6Uh2F+fK98WCVsrnw+T6/eq0AzRxM/l8Kb7OEoFS1TSt5tfJ4qJQQRuCzQerqdbVd42vcjODKcbqEtW9605EenIHBhy27SWRrCf4sN5z073O9WrmwAa00Kp0ZiA4um1VbN3w==; s=purelymail2; d=lunabee.space; v=1; bh=yEDLaxiClk5A/4ERY/W66d4e66DIcQftqZRfjB50bwM=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=aP8vWf5YA0ex2gT6ZsOOA3LiN9pAJceEOtSx/MZjRADqqIYVOuhjKEePLCFSHBUPFFAsv/LqLeO8EeZoLGlazoNVW3YMLcjwoDb8mQCdXzuD6c2QGh3jNW7TqJE5SIBuFoQV9so+3KJDb3BMzrbjknybkCO3RyEUIb/s58qT6s0V0b+ON2IEMmWacbQoj1bZKj3bpdjwvkAHLCPlQjZppXeCsFZjIe6K3nW4fazGUBKD5hZp6Kc70FV8nfVcR6QaYltnwdcIiPAj5YufUkKWK4JgLr7Ygc6E39XISg6Wm/LO4hjMMkqQhpI6j9DH7N0gw0sZyjHO0rSdvAKBgFBXAw==; s=purelymail2; d=purelymail.com; v=1; bh=yEDLaxiClk5A/4ERY/W66d4e66DIcQftqZRfjB50bwM=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:18 +0000 (UTC) Date: Fri, 8 Mar 2024 02:12:00 -0600 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Felix Lechner * guix/scripts/system.scm (seconds->string): Rename to epoch->date-string. (profile-boot-parameters)[boot-parameters]: Update as above. Change-Id: I2b9aaa816b3ca84c32f7d6fa690245b149228310 --- guix/scripts/system.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 40df166fd7..86ee2ddc76 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -323,9 +323,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"))) @@ -343,7 +343,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 Mar 8 08:12: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: 61510 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 C8C3827BBE9; Fri, 8 Mar 2024 08:25:48 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 D141427BBE2 for ; Fri, 8 Mar 2024 08:25:47 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVXx-0003wW-KF; Fri, 08 Mar 2024 03:25:41 -0500 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 1riVXr-0003tx-1f for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:36 -0500 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 1riVXq-00018A-PO; Fri, 08 Mar 2024 03:25:34 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYK-0002e2-JG; Fri, 08 Mar 2024 03:26:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 05/12] Move epoch->date-string to gnu/system/boot.scm and use it elsewhere. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.17098863369983 (code B ref 69343); Fri, 08 Mar 2024 08:26:04 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:36 +0000 Received: from localhost ([127.0.0.1]:56397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXr-0002aq-DF for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:35 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:44438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXl-0002ZY-Rj for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:31 -0500 DKIM-Signature: a=rsa-sha256; b=a/mtnkgkfR/0eO3QiWJRxvHMOyodg5X5B+DJf6x3uBi8VwO3SUwDjBwtWqxqnodMsVVn16RqvORVnLoUiBfmhqS6FaaJKahVm/cneqfHprFICnyyqou/j6PPbWU2lyFyzRaf3yghLD0wSOMlunxL0OiKUKh370kIwX3TPDYgStRG2tk3kpb642NJTkes25iNomK+Ml+hr2cJk3iDLsn34kDs+rKvZK+uyo5gY/Tp6WaN7bTAxJJQ0LSr8s8lM0EYqyXISznbF0liQGxcaZBZ4pz1qkrRvSI46ONnJez02tY9YqxVL/RXbWAUwNRGAFufV+cvZsUL1kEIeazPw6ZtZQ==; s=purelymail2; d=lunabee.space; v=1; bh=8pgH/zbPYXM0QMGXUemLtKnPF06UTcb0u9vzXSKrLN0=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=GUsx9cuALA7aHLV3omLNVwySEA5Bgzfw0S9NQTTVTwH7GaUzSlPzxhXGsjov2T87Z7B4rO183CQQed+LJyNliW+TlYEVKRp1XIsTuU9v3lgRJQN/h9DpUlfzt50xB0H//BITIddoxWa0+fPyDkwCJSTcCd67C0+pE1Dj9fznvo5LhsNAUIXfXwps1IOEffQqU3wF4a2xJ4hZez/Ac2f8bqVIBwjF5vmOKb+oV2nE8k1bVfMTPVPU3lV44IIzHuKv8Xgo8kYGw36IgJe4LcL8nD+Z7Q6dGMgUsbjDeEHiHXig6+F3EUacH9sZRpgBDAnafpfQvxsQiYld2ebQzqPmgw==; s=purelymail2; d=purelymail.com; v=1; bh=8pgH/zbPYXM0QMGXUemLtKnPF06UTcb0u9vzXSKrLN0=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:19 +0000 (UTC) Date: Fri, 8 Mar 2024 02:12:01 -0600 Message-ID: <7adf6f188991d9d7052adb0056c0fb8b618c5059.1709885528.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-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 0ffe71367c..449b65dbfb 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -444,10 +444,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))))))) @@ -455,7 +455,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)) @@ -466,9 +466,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 a3b9cce7d2..972f83febc 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) @@ -69,6 +70,7 @@ (define-module (gnu system boot) read-boot-parameters read-boot-parameters-file + epoch->date-string boot-parameters->menu-entry ensure-not-/dev @@ -274,6 +276,12 @@ (define (read-boot-parameters-file system) (kernel-arguments (append (bootable-kernel-arguments system root version) (boot-parameters-kernel-arguments params)))))) +(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 86ee2ddc76..47c072ba5c 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -323,19 +323,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))) @@ -343,7 +337,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 Mar 8 08:12: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: 61509 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 AA16827BBEA; Fri, 8 Mar 2024 08:25:45 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 CCE3727BBE2 for ; Fri, 8 Mar 2024 08:25:44 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVXt-0003vU-Po; Fri, 08 Mar 2024 03:25:37 -0500 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 1riVXr-0003uC-I6 for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:36 -0500 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 1riVXq-00017v-9P; Fri, 08 Mar 2024 03:25:34 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYJ-0002dj-Nk; Fri, 08 Mar 2024 03:26:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 06/12] Offer a uniform decorated-boot-label and use it. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.17098863329957 (code B ref 69343); Fri, 08 Mar 2024 08:26:03 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:32 +0000 Received: from localhost ([127.0.0.1]:56393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXn-0002aM-9M for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:31 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:50366) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXl-0002ZW-Qo for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:30 -0500 DKIM-Signature: a=rsa-sha256; b=mU98KtS29DZEdku2rgYteoeMmM+q/In207TJ8QM4Gg6AqE2272Qc/HJSJJqwvdEvU2w+BO2ocJen0XA3aJV57HXFHGLsKj3a+9BJiuYvlc8L7yjmYiSMCfJbBnSo0dRJ9OHaXhoZm7gLU9jeWEZV4tN4gT2XGJfQv9+Vk2j9H4YM6pFe7CrogTt+mEgLP60O+WfjIAD7TW9CCwBmM4LweEDj2fjkREIM/DvG71+wrz5DN1H28qG2G0sWvxaK5yVDrsrxrxaq2yoqejfBX7D+OrbyMHyoeW3wOp3pILROHKn3go3Mr40M06fUG9U9TmJ1IACekVTWlCqiaImDK4Goyw==; s=purelymail2; d=lunabee.space; v=1; bh=poPtLk1Ci8MIhvsA44gDhFg36hV5E3a1KO86FEWjKME=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=XCl2T1RDXJpQXc7rVElhMEjjOoFOm/V+a6z7lrtZtKBKA1iMDTW7WctFOyXoiFoziJhDIezquTofrLubekR1gYZ7WoVA7BTYZqj8BOcpE9/U8YRf5s9+EOWY58wvB/rSqA6QaZh1V+JZoSVAO5Zn5l4rmBhf83bQuz0hyzqHnydbjE/JM8HKwaUUTYN7H5mUheR2ISeDiNCOS8tXlA1f3mgHvh18F1Wx5N7/a9Hb+S7oKr1NQpQ7y2MlFdmuH2EEk11eg1R3aE5KyTh+AwgHa4PLEgXWGKj7FLeHRMh0pPDNlUZFXc4SH6ZDy232aWSFp+mqq7OxTDOTmcy18FQC4A==; s=purelymail2; d=purelymail.com; v=1; bh=poPtLk1Ci8MIhvsA44gDhFg36hV5E3a1KO86FEWjKME=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:19 +0000 (UTC) Date: Fri, 8 Mar 2024 02:12:02 -0600 Message-ID: <1aa5fb52ea0aaf3cffc990737140d7c169cb96c2.1709885528.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 449b65dbfb..fe47474470 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -459,15 +459,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 972f83febc..b39e7d8610 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -71,6 +71,7 @@ (define-module (gnu system boot) read-boot-parameters-file epoch->date-string + decorated-boot-label boot-parameters->menu-entry ensure-not-/dev @@ -282,6 +283,18 @@ (define (epoch->date-string epoch) (date->string (time-utc->date time) "~Y-~m-~d ~H:~M"))) +(define (decorated-boot-label text generation epoch) + "Return a string for a nice boot label that includes TEXT, a numbered GENERATION, +and a timestamp derived from EPOCH seconds." + (let* ((numbered (lambda (number) (string-append "#" (number->string number)))) + (count (and=> generation numbered)) + (timestamp (and=> epoch epoch->date-string)) + (extras (filter identity (list count timestamp))) + (helpful (if (null? extras) + "" + (string-append "(" (string-join extras ", ") ")")))) + (string-join (list text helpful)))) + (define (boot-parameters->menu-entry conf) "Return a instance given CONF, a instance." (let* ((kernel (boot-parameters-kernel conf)) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 47c072ba5c..09d29dbbb1 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -332,12 +332,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 Mar 8 08:12: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: 61516 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 4145A27BBE9; Fri, 8 Mar 2024 08:26:25 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 22D6327BBE2 for ; Fri, 8 Mar 2024 08:26:24 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVY5-00043f-Ah; Fri, 08 Mar 2024 03:25:49 -0500 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 1riVXt-0003vd-Vs for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:39 -0500 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 1riVXr-00018N-7d; Fri, 08 Mar 2024 03:25:36 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYL-0002eE-1o; Fri, 08 Mar 2024 03:26:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 07/12] Rename boot-parameters to boot-alternatives when appropriate. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170988634710009 (code B ref 69343); Fri, 08 Mar 2024 08:26:04 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:47 +0000 Received: from localhost ([127.0.0.1]:56399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXs-0002ay-0D for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:47 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:44440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXl-0002ZZ-RS for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:31 -0500 DKIM-Signature: a=rsa-sha256; b=VCBDmbAzDpm1+GscOp0HM5+FD1tjKb5jWK495M+btMuQmzfg4bRS50cXPzB01TK5d0HxQ7d+Cs91nfDx6MJIkoD44iiTrqY4J3i+kRbl28ApD5ov5NOGajg/TsUNbZG6Z/w5F05LgqhMeIskzaQ9OR4mFMFMkqOejkjo0C/GWrwSQKZgMtZvcTXGswFyYWMnmRrNVkhaWiokYqrl0bvQnw9PRwk8YtB/c5upVKrR/Y3IT17U0OnYpoZfhX4E2FTO+bsgxrbcptQpDlM/3InhczuUpleYdMWWeoOGeBsdv0TXglDVNIEqKPchDQdW9hv5vNkZx23hJmOnX5ybSvUn0w==; s=purelymail2; d=lunabee.space; v=1; bh=rFFcUIqkRFPoM5KPTV8rG+ifOA7euPpBC2XLOfoRREs=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=r8+Wa08tsjVUxHc8wh9GOc56Vpu4oWBFwe2RHajK075P/mf47QPKHQzvrzxXzxbnxkUn1lHDjN+SYn+mgCtCU3RfXY4bSZAjvcZG+B/+2cUUpXYH0g9dHCsW0oAbOB64xJ332o32hK0h/Vv0bj4z7alYn1mCSSO0YhdM3dyNdT1wTXXmJSRwd2hWg69TCxLfFknmooFumv5bKUFB+UotVA5W8VkSbdJZkhBg328WUmQtc+61bYe4o4LQmO45BppJtpL4lHz1l53vdGqFU4E2liaYMSAgbeEUtKxDN3uRYWxEd7hjUHfyIqFvQF/fEpC63ZCAHRk9NlHOqte+bMc6kQ==; s=purelymail2; d=purelymail.com; v=1; bh=rFFcUIqkRFPoM5KPTV8rG+ifOA7euPpBC2XLOfoRREs=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:20 +0000 (UTC) Date: Fri, 8 Mar 2024 02:12:03 -0600 Message-ID: <7c47238a38488fdb2f509c2a021c183f645cbc11.1709885528.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Felix Lechner Throughout the code base, the token 'boot-parameters' refers to collection of data that is stored on disk for each system generation. It was confusing to use it for a list of such records. This comment imposes an alternative name. * gnu/machine/ssh.scm (machine-boot-parameters): Rename to machine->boot-alternatives. (machine->boot-alternatives, roll-back-managed-host): Use boot-alternatives instead of boot-parameters as appropriate. * guix/scripts/system.scm (profile-boot-parameters): Rename to profile->boot-alternatives. (reinstall-bootloader, perform-action): Use boot-alternatives instead of boot-parameters as appropriate. Change-Id: Iabb04dbb39f42f989692bede7304f20a69bef9fb --- gnu/machine/ssh.scm | 20 ++++++++++---------- guix/scripts/system.scm | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index fe47474470..11534c6740 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -414,7 +414,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 bootable-kernel-arguments @@ -503,14 +503,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 ...) @@ -581,19 +581,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 09d29dbbb1..fd9f0727ee 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -323,9 +323,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." @@ -390,18 +390,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 @@ -817,7 +818,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 Mar 8 08:12: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: 61519 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 41D2927BBEA; Fri, 8 Mar 2024 08:26:28 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 D087627BBE2 for ; Fri, 8 Mar 2024 08:26:27 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVXz-0003y6-V3; Fri, 08 Mar 2024 03:25:43 -0500 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 1riVXr-0003u2-Fo for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:36 -0500 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 1riVXo-00017o-8Y for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:33 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYK-0002du-49 for guix-patches@gnu.org; Fri, 08 Mar 2024 03:26:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 08/12] Rename two remote variables confusingly named 'generations'. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.17098863359975 (code B ref 69343); Fri, 08 Mar 2024 08:26:04 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:35 +0000 Received: from localhost ([127.0.0.1]:56395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXr-0002ao-07 for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:35 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:50368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXl-0002ZX-RH for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:30 -0500 DKIM-Signature: a=rsa-sha256; b=yauvRq6S7ong9hwsJ/XkFL29LKQKXxt5mEzes9e65OFhAuWKpTbxapjIsqZD66/prGoKWqYFg1tXz2BdeOrHM4hbpV5f4Gm0mshT7h1N+ivGf46pzJudGorf8XXIY1hucjnTg2DL4IiFH4CqwCSz3Is18IoWIQe2ZzXjvqqAzM2PL/OzrgKfJrME7BTdLz/IiWpIHP6Ixa1ErTLtPwzkDsWy9QOUZopB7Qqpk/kr7iekGM0adG+43g1Vw8RjEECbXJXiBnPVGuINYm2qofWNq48Kz9rLevAmeVYWGDI8o1YUm/Zs9kjyLp0CkdrrptfOx1NjBTSdpDdM1xozmSurHw==; s=purelymail2; d=lunabee.space; v=1; bh=fPRYDQ1t4FGIKh4qAc65pN2usoZ60twgiozHdseL2O0=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=MvzJidm7h4m60otIxRO2/hkFrTqWzNXV2rCf7OaDpIGgyRgUkoKXvO6Opl5yIPDHoYylnsKmsbWI0clJeM0tRvrbVvCLsT9kpEJ9/imWrrOsWBAZeAUH5IsD8J6Y46FZvyM44hy0JY2CwE4gF8PI1fOMWeHm/RAj4S9EfWKAJelkK+mvLuzSybOiO9Qi1UVW5/Jl79z1TnddqXcrrW9lZShSfRzQxy0IAF0oHgi+OUzFcoL6RNWP/rxIGyfq1eTlL4X9N6tn/enAXdmHNXLGqkp0g2nttFckq079sIdmdQ0ARjbkFE9HKgpYWzq/L+VPxBIC8ynjxPsHOqtk87kL/Q==; s=purelymail2; d=purelymail.com; v=1; bh=fPRYDQ1t4FGIKh4qAc65pN2usoZ60twgiozHdseL2O0=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:21 +0000 (UTC) Date: Fri, 8 Mar 2024 02:12:04 -0600 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Felix Lechner Both refer to data sets returned from the remote expression, and one of them shadowed an element of itself. * gnu/machine/ssh.scm (machine->boot-alternatives): Rename generations to remote-results. Change-Id: Ibd8a3036126d9da1215cfc191884c0f54df637df --- gnu/machine/ssh.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 11534c6740..9adb5e79b9 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -451,10 +451,10 @@ (define (machine->boot-alternatives machine) (read-file boot-parameters-path)))) (reverse (generation-numbers %system-profile))))))) - (mlet* %store-monad ((generations (machine-remote-eval machine remote-exp))) + (mlet* %store-monad ((remote-results (machine-remote-eval machine remote-exp))) (return - (map (lambda (generation) - (match generation + (map (lambda (remote-result) + (match remote-result ((generation system-path epoch serialized-params) (let* ((params (call-with-input-string serialized-params read-boot-parameters)) @@ -467,7 +467,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 Mar 8 08:12: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: 61512 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 3683227BBEA; Fri, 8 Mar 2024 08:26:05 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 B451727BBE2 for ; Fri, 8 Mar 2024 08:26:04 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVY0-0003zR-Ue; Fri, 08 Mar 2024 03:25:44 -0500 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 1riVXt-0003vY-U5 for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:39 -0500 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 1riVXr-00018i-Kb for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:37 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYM-0002f0-Gq for guix-patches@gnu.org; Fri, 08 Mar 2024 03:26:06 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 09/12] Give a separate name to a commonly used expression. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170988635610079 (code B ref 69343); Fri, 08 Mar 2024 08:26:06 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:56 +0000 Received: from localhost ([127.0.0.1]:56422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVYC-0002cU-5h for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:56 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:44466) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVY5-0002bK-Uu for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:51 -0500 DKIM-Signature: a=rsa-sha256; b=NMoVXHLnPS5hREIX+sKQ34tJ6EqWG+rKKlzj19qlGfUrezUatkBQTte+APW6agaWqaapP7btPZEvi149KZNwSZVjjMaR1BPwSFyVwLBtrqE4nl6WYd+9/e53W59TVrdNr3qeaYOUl0fM5CNwcqxC9j4m9hIO1yA70DCdlrRe8Ik9jiaYNFS11M0UmhUvOgpaOBwFznpJAHOdwXR0ubaF47wCEdIV1kTvxRTM9dOm0+J9i7XXf/vxRCCme/cVWnC4Xaq1pDTwPPfgxdtWnMWHKXq/BDHTAMSPVGJfIJBUB/mzgI+Dgt7nJD8nRewSpopIQqR8wuazZZ6Dkn6LPXKoIQ==; s=purelymail2; d=lunabee.space; v=1; bh=44udMxD4fW29ObvpvJVxkvSnP+DqxG0lHbpJHjb3WRc=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=yPOZ4PL1K5T8ZSnLTFEXZUgis383kRkzgBM1LnPYndh4KfbKklaKokZF7Tma1/OAjaSmvO24lhQ0B1gcEZ3Kd+DYQfvNKzJYN7DqC0li13+kQFnzA2aLHov1rije1Gf9rY8dIImAzUwkR4Wdk6lVdrtfWizcjuo3v98rAZkYxuc6L66z62LKawLvuUWsIdGWruvFdUB5N8WjN9YT39ElhNHWlyHMxGViiCZLl2FNJQH2LLvETkQkMx6AJxyKMDwZ/A3aCOudpu7JwxM1lg+fz/K4LnuI7Cx0b8WCqBnK6ug5NQYoB8m3xK0q6pTRL3TEVY1pAMDzbTnXdffcSNSGZg==; s=purelymail2; d=purelymail.com; v=1; bh=44udMxD4fW29ObvpvJVxkvSnP+DqxG0lHbpJHjb3WRc=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:21 +0000 (UTC) Date: Fri, 8 Mar 2024 02:12:05 -0600 Message-ID: <6b8cc8a8b8b13d0c06ffba22585a485bb96fd562.1709885528.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Felix Lechner * gnu/machine/ssh.scm (roll-back-managed-host): Factor out a subexpression into new variable parameters. Change-Id: I8d70684142bea736042d6c9dc8276ea7bdb9c181 --- gnu/machine/ssh.scm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 9adb5e79b9..45ab8b9868 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -584,14 +584,11 @@ (define (roll-back-managed-host machine) (mlet* %store-monad ((boot-alternatives (machine->boot-alternatives machine)) (_ -> (if (< (length boot-alternatives) 2) (raise roll-back-failure))) - (entries -> (map boot-parameters->menu-entry - (list (second boot-alternatives)))) - (locale -> (boot-parameters-locale - (second boot-alternatives))) - (crypto-dev -> (boot-parameters-store-crypto-devices - (second boot-alternatives))) - (store-dir -> (boot-parameters-store-directory-prefix - (second boot-alternatives))) + (parameters (second boot-alternatives)) + (entries -> (list (boot-parameters->menu-entry parameters))) + (locale -> (boot-parameters-locale parameters)) + (crypto-dev -> (boot-parameters-store-crypto-devices parameters)) + (store-dir -> (boot-parameters-store-directory-prefix parameters)) (old-entries -> (map boot-parameters->menu-entry (drop boot-alternatives 2))) (bootloader -> (operating-system-bootloader From patchwork Fri Mar 8 08:12:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 61513 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 3A7E127BBEA; Fri, 8 Mar 2024 08:26:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 D6E9127BBE2 for ; Fri, 8 Mar 2024 08:26:14 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVXz-0003y8-Vk; Fri, 08 Mar 2024 03:25:44 -0500 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 1riVXr-0003ty-BA for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:36 -0500 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 1riVXq-00018E-Ur; Fri, 08 Mar 2024 03:25:35 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYL-0002eR-Gv; Fri, 08 Mar 2024 03:26:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 10/12] Simplify profile->boot-alternatives. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170988635210060 (code B ref 69343); Fri, 08 Mar 2024 08:26:05 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:52 +0000 Received: from localhost ([127.0.0.1]:56417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVY7-0002c7-Uy for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:52 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:44464) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVY5-0002bH-Sr for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:50 -0500 DKIM-Signature: a=rsa-sha256; b=kgxa3xss7MFHtzV2fVT/hznNTG3DYmZkmXw0YSacjKY57Qmk8VE3xSdyCRtsf/ljt+Vx36UqaRCYTjiYkGcMTiXvEnmi5Aw6MWIMIqrFYXc3yjnpXTviG0M5WxOQ9UIh3hK6gz/9aJ8rD4ZEk9mHX5K2Yu20Tu6NeRxoZ5oX5QqseRLJHviupBbYwPk6PqjKFRKDGK84Jf3bt3OeupZDsVPQcUJ9+BPOaNuoFaI1ollrG2YxSJRAx18fqOwWuqXxJc9iWDzOGl3ZmwA5Y5ca6wkyqRoH7CebQZ2ttnj/CgkEM6liCEtrV3V2nHe6ejqYrvoNUxXf1yvOag5S/pRsWw==; s=purelymail2; d=lunabee.space; v=1; bh=KW0ToLgREhXbLWcQyyoGKh1GojWNPReOJ75CIYnPaeE=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=BmPDFmTQDKaWRFWubW9Pymg1kyuBL2rLvWtj/EXLNJyMkS25gEbnqjJlu2/IawY5ACGFdGAK1qAAr5FbQiLXAiw0nQVqYxCdVO8oUcybcSJg0iz0oL3KGIIQ2eCAnuCNBZKvi/G4NGlYy0E+/q3JkEU//Tw5oBsjlOS4/504aTyWml/LgbLNfR+gBjGI1ot/FLQRmqQZTGkX6KCns7hC/T2lHgMNz/3wx5y9xJm48et3E0dVVE/tSeU7ADupPbDkLSQwNKKjuJ42MWLvrx4xwmiJnSyGJfyuTb/sUMdb5K0FB7slaDd2Ok5cOG+VERPu3bBHs13roCxKEhdy1NiZtw==; s=purelymail2; d=purelymail.com; v=1; bh=KW0ToLgREhXbLWcQyyoGKh1GojWNPReOJ75CIYnPaeE=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:22 +0000 (UTC) Date: Fri, 8 Mar 2024 02:12:06 -0600 Message-ID: <12f5292170b873f491330a10a048af52232405aa.1709885528.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 fd9f0727ee..3df37e5510 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -329,20 +329,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 Mar 8 08:12:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 61518 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 ECF5927BBE2; Fri, 8 Mar 2024 08:26:26 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 4332427BBE9 for ; Fri, 8 Mar 2024 08:26:26 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVY2-00041X-Mn; Fri, 08 Mar 2024 03:25:46 -0500 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 1riVXt-0003vZ-VM for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:39 -0500 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 1riVXr-00018e-Gx; Fri, 08 Mar 2024 03:25:37 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYM-0002ed-0T; Fri, 08 Mar 2024 03:26:06 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 11/12] Split generation->boot-parameters out of profile->boot-alternatives. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170988635310066 (code B ref 69343); Fri, 08 Mar 2024 08:26:05 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:53 +0000 Received: from localhost ([127.0.0.1]:56420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVY8-0002cD-JA for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:53 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:50396) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVY5-0002bI-Tg for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:50 -0500 DKIM-Signature: a=rsa-sha256; b=hkdDqvCMtz2dd3BAWcoSDDCeDPLZ98bwf2fFwSHThkG25QTkgMyJAKJkiENZE+FW12hSzqUeYjNLUXy4XVLFKasjchc9HYw0q+SOmIKOngW5ZTcKbZgpKjeP/ZxguZ5MUzGr3RS82sJ8LZxiQgo+ZNn7pvbVtTOy9xEIR+p5hu1zE/KWt2tzx7dPCeX3EcJAykq+dQNYqC3QDXZxomiBKSoHraQlwqkVYcDOhnPL5/382sX3fhoMZM4vOZRcGxJdRHI3z3HZnE3566GUtmn53AYZhrmI+2R5zQ5CvPu5C2ZluxRHeigG7MawVk1U6qKU61DXwM9uMb3I3c4E59gc3A==; s=purelymail2; d=lunabee.space; v=1; bh=xV+lOLd6iNvU3oJkT/bpIgQUVgjNLSk62TWGjnt/+cY=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=CYlIEP51ICodUdpAsQx5NbbR4TSd1s1HE+oWcHIHZ3gankqOJMIOAZ+KzOi3lgW7gaG3Uxja3RiUfIRkcPFRmZF964kaI77ueslXkKmsmlL0HzSBCH5zDmdY5xOxzatklPeWnejkUK2ubtZ1IIhRReTvfhlFTw7kfbUZnLDW7D/K/wWmqRs7hq68/BbziHO60ICSObX7muTx0e9EPs8dXPqYanGBuD0vjgCXonE52leiVNDSy0RWn9tXKmxMLf8RpUvo9oclcmyVIGX0g7SYjjdJ3o+tE4Fu7GWqxUHUCtZ5KC7JYNXsw63J9Tvaq4kPZd+bUcw6tr3paltOFfVA2g==; s=purelymail2; d=purelymail.com; v=1; bh=xV+lOLd6iNvU3oJkT/bpIgQUVgjNLSk62TWGjnt/+cY=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:23 +0000 (UTC) Date: Fri, 8 Mar 2024 02:12:07 -0600 Message-ID: <05ea87298e8731b00fa7127e97a6b497ae391695.1709885528.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 3df37e5510..7f6ba20ef9 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -323,22 +323,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)) ;;; @@ -386,8 +391,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 Mar 8 08:12:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 61520 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 4311D27BBEA; Fri, 8 Mar 2024 08:26:44 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 EFAD427BBE2 for ; Fri, 8 Mar 2024 08:26:42 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVY3-00042P-9f; Fri, 08 Mar 2024 03:25:47 -0500 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 1riVXv-0003vs-T9 for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:41 -0500 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 1riVXu-00018t-E0; Fri, 08 Mar 2024 03:25:39 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYM-0002fB-Vy; Fri, 08 Mar 2024 03:26:07 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 12/12] Encapsulate to retain generation, system-path and epoch. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170988635710086 (code B ref 69343); Fri, 08 Mar 2024 08:26:06 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:57 +0000 Received: from localhost ([127.0.0.1]:56424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVYC-0002cW-IX for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:57 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:50398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVY5-0002bJ-UQ for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:51 -0500 DKIM-Signature: a=rsa-sha256; b=TSrlKwYMvaiAH4jB5Mes/kd5usj3qi4eBxQG+gLqGTBfp32raYaIsvzsJq3lomiKU8Avhh4h8HjW+vo2ukj2YRDOSCmQmB4mA1phIkA8El/9SMsbELpEKdocPR9SstzvU9plAR5K0KnmgPCeym/vh/Tu+7Dgjq2nQQeEvN4/OfLeQzTIHP4qDwQqmVQdFk76zAxO9TWVXEBJzNXDJaXhVIKAIZQSnynY90eAm8mvin9uBq9XO4I3nEJtYDj+lqK1dpUpUCe69isQ3E/Uu61mlxNhbVMYDSKC9x1SEn2KvndadHtfbdpy9kFoYvpWoW4/AsEfiH1jDzWSylJ5FA+7iA==; s=purelymail2; d=lunabee.space; v=1; bh=NMujglk2l9ZujaqjgcerdFyC1t4oJvu/cL9oS6fEb3E=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=KzSwqPXgJf3LiCNG6XMlI1Ech4CmUw/Fcx1RNPg1WdA62bnAhqkd/Jn3VipTLySaCioGNyuETAEy90hSdVIxVFjuOCRyr+RjPPqDiZTVXiXe6nlgLIan3D2o/CBxN0yTetk5lsva5qrQfmsYuEH3rEPxl4fCtSmKJ+/jRmPzybbuwyLRDusJJ6P+3wTSeraokOMEJUEyncnVuddWAz5suEejcxjxPqJDgxPZ7oO8YgA+cNKfQ4p0PTy6IxVx5Unf7YMqCmkjphkUyTFdYdQ+0CEsie66RJb/ibDJLiNTPcUSWh8tMpyv34xiDkSOtG1Lvy+DJ+GUroJymRarO+ASsA==; s=purelymail2; d=purelymail.com; v=1; bh=NMujglk2l9ZujaqjgcerdFyC1t4oJvu/cL9oS6fEb3E=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:23 +0000 (UTC) Date: Fri, 8 Mar 2024 02:12:08 -0600 Message-ID: <1242fe7e331528023c6d2a4768256d8f48607b34.1709885528.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Felix Lechner * gnu/system/boot.scm (): New record. * gnu/machine/ssh.scm (machine->boot-alternatives): Return a boot-alternative encapsulating previous return value. (with-roll-back, roll-back-managed-host): Get parameters from boot-alternatives. * guix/scripts/system.scm (generation->boot-parameters): Rename to... (generation->boot-alternative): ...this. Return a boot-alternative encapsulating previous return value. (profile->boot-alternatives): Rename uses as above. (reinstall-bootloader, perform-action): Get parameters from boot-alternatives. Change-Id: Iaef0b0a3fa9240ca8315a9699bcf4a7bfe908e33 --- gnu/machine/ssh.scm | 32 ++++++++++++++++++++------------ gnu/system/boot.scm | 14 ++++++++++++++ guix/scripts/system.scm | 32 +++++++++++++++++++++----------- 3 files changed, 55 insertions(+), 23 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 45ab8b9868..61125dddce 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -415,8 +415,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 bootable-kernel-arguments (@@ (gnu system) bootable-kernel-arguments)) @@ -460,13 +460,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 ...) @@ -510,7 +515,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 ...) @@ -584,13 +590,15 @@ (define (roll-back-managed-host machine) (mlet* %store-monad ((boot-alternatives (machine->boot-alternatives machine)) (_ -> (if (< (length boot-alternatives) 2) (raise roll-back-failure))) - (parameters (second boot-alternatives)) + (chosen-alternative (second boot-alternatives)) + (parameters (boot-alternative-parameters chosen-alternative)) (entries -> (list (boot-parameters->menu-entry parameters))) (locale -> (boot-parameters-locale parameters)) (crypto-dev -> (boot-parameters-store-crypto-devices parameters)) (store-dir -> (boot-parameters-store-directory-prefix parameters)) (old-entries -> (map boot-parameters->menu-entry - (drop boot-alternatives 2))) + (map boot-alternative-parameters + (drop boot-alternatives 2)))) (bootloader -> (operating-system-bootloader (machine-operating-system machine))) (bootcfg (lower-object diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index b39e7d8610..edb4d213b9 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -70,6 +70,13 @@ (define-module (gnu system boot) read-boot-parameters read-boot-parameters-file + 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 @@ -277,6 +284,13 @@ (define (read-boot-parameters-file system) (kernel-arguments (append (bootable-kernel-arguments system root version) (boot-parameters-kernel-arguments params)))))) +(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 7f6ba20ef9..97804ad736 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -323,26 +323,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)) @@ -391,7 +396,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 @@ -402,7 +409,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 @@ -818,7 +826,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)