From patchwork Sun Aug 4 03:13:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66650 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B193D27BBEA; Sun, 4 Aug 2024 04:17:52 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D3AD927BBE2 for ; Sun, 4 Aug 2024 04:17:50 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjx-0003mT-9e; Sat, 03 Aug 2024 23:17:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1saRjk-0003kV-MI for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:50 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saRjk-0002Qz-2o; Sat, 03 Aug 2024 23:16:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=xH6N3KcjXiHGSeavyBCwt+jekQZziNo2tyGwxHomiik=; b=sVqUSWK44KIQw6GajxMMdQu/67j/FNyNJRwRADQDoJU9pMq2YPN9mZEevbLqYy+OXfdr/DnbdvmZn8H9JwXyxEKd9KMWV0dzZSZI79gIyAQteSFJ2pAdfMPbieugkS3QPJw9ODnI01knGeCrM4YOmXavsMlCDg+EwXZT7myyXTxXbsl05eXi8g94y28uIzmKTlY4R+6AXKQ06BtMezsEBJSl0S7mPgaOCr+YOLq7vZHJAnhzFyZGPVDT2ZVDbhWQb61iX/3zda699gzeZdtO2VNz8Is2rrIkUXhh2GHkw1qJ7pbzCZu9QvxDUFO6sQh5KqPcQQhiFyCy/z6f2VG9CA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk2-0007o6-2Z; Sat, 03 Aug 2024 23:17:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 07/12] Rename boot-parameters to boot-alternatives when appropriate. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sun, 04 Aug 2024 03:17:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274140229807 (code B ref 69343); Sun, 04 Aug 2024 03:17:06 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:42 +0000 Received: from localhost ([127.0.0.1]:55012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRje-0007kg-47 for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:42 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:51810) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjc-0007k3-JW for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:41 -0400 DKIM-Signature: a=rsa-sha256; b=q2CM70bFf/bT5SsHpAYk/IZA4mhFV82oVVM1rV+riK8ZsCtsLV9ABNefDlKMXWUA4lemmAwBkk8oVAXOCNy/dqaahl0ogzHzXWuMcNSttU/D25qqd1MYKPuYPLp1hJfIp+m0kdHOpVOFGbvTFbu9To06P6NDHCn6oAYCQLD7K0SSSow5TtDF9m36ZrGMzV0rh3aQy8fR/r0vnhTYx/9W3UuQ8hZvKw7DELdv0H9GdEBtabSH47jeUzNCLS2nGp5y4yo1PK8TJ1b2N6ivYyKoL43QwoCo7LGb1KtQuxh8ixnAKWiHpqWN23TonlC+hFbujq0s+uFSpu1IJsawqYKWfw==; s=purelymail2; d=lunabee.space; v=1; bh=y5Tz2MCs2MM3YaWA05pWXrUKfFWXWXur/6HXGs15djE=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=IZgdHsiuGExBfhHonsIeDJvx7dFsKCMz6JtcqYgzeqZb9slc7w9UaRW7wlVIBxXSYig+S9epRA44S9sFMepyB+nVPT0a/gibzB/soYAXTWCpKm0UsfcFPLGC/4bq8PTiaWiBNpYDqFNe0cBlp99L3VK0XE1InQKQWTK3XZeLZEofrGI3CoG1kI+TTOTQptjEQvQmFsFKosZt/5itV9JltqGOypkj5ledsNtKGXsQGjWThcTPcwpF30Mdw/4aOn+tW3FdyHwsPXUhFNB9OrtateQmD78ZYL9EmY9vR2eUCITJOFXewh+ilUNGabvC4H37OOo90MNdWM20pU3y2cPxSw==; s=purelymail2; d=purelymail.com; v=1; bh=y5Tz2MCs2MM3YaWA05pWXrUKfFWXWXur/6HXGs15djE=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:39 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:29 -0500 Message-ID: <0bc81e0b885d720e8b094a64f22253248425e787.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Felix Lechner Throughout the code base, the token 'boot-parameters' refers to collection of data that is stored on disk for each system generation. It was confusing to use it for a list of such records. This comment imposes an alternative name. * gnu/machine/ssh.scm (machine-boot-parameters): Rename to machine->boot-alternatives. (machine->boot-alternatives, roll-back-managed-host): Use boot-alternatives instead of boot-parameters as appropriate. * guix/scripts/system.scm (profile-boot-parameters): Rename to profile->boot-alternatives. (reinstall-bootloader, perform-action): Use boot-alternatives instead of boot-parameters as appropriate. Change-Id: Iabb04dbb39f42f989692bede7304f20a69bef9fb --- gnu/machine/ssh.scm | 20 ++++++++++---------- guix/scripts/system.scm | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 3971469e33..f3d2a77625 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -415,7 +415,7 @@ (define not-config? (('gnu _ ...) #t) (_ #f))) -(define (machine-boot-parameters machine) +(define (machine->boot-alternatives machine) "Monadic procedure returning a list of 'boot-parameters' for the generations of MACHINE's system profile, ordered from most recent to oldest." (define remote-exp @@ -501,14 +501,14 @@ (define (deploy-managed-host machine) (machine-become-command machine))) (mlet %store-monad ((_ (check-deployment-sanity machine)) - (boot-parameters (machine-boot-parameters machine))) + (boot-alternatives (machine->boot-alternatives machine))) ;; Make sure code that check %CURRENT-SYSTEM, such as ;; %BASE-INITRD-MODULES, gets to see the right value. (parameterize ((%current-system system) (%current-target-system #f)) (let* ((os (machine-operating-system machine)) (eval (cut machine-remote-eval machine <>)) - (menu-entries (map boot-parameters->menu-entry boot-parameters)) + (menu-entries (map boot-parameters->menu-entry boot-alternatives)) (bootloader-configuration (operating-system-bootloader os)) (bootcfg (operating-system-bootcfg os menu-entries))) (define-syntax-rule (eval/error-handling condition handler ...) @@ -579,19 +579,19 @@ (define (roll-back-managed-host machine) (define roll-back-failure (condition (&message (message (G_ "could not roll-back machine"))))) - (mlet* %store-monad ((boot-parameters (machine-boot-parameters machine)) - (_ -> (if (< (length boot-parameters) 2) + (mlet* %store-monad ((boot-alternatives (machine->boot-alternatives machine)) + (_ -> (if (< (length boot-alternatives) 2) (raise roll-back-failure))) (entries -> (map boot-parameters->menu-entry - (list (second boot-parameters)))) + (list (second boot-alternatives)))) (locale -> (boot-parameters-locale - (second boot-parameters))) + (second boot-alternatives))) (crypto-dev -> (boot-parameters-store-crypto-devices - (second boot-parameters))) + (second boot-alternatives))) (store-dir -> (boot-parameters-store-directory-prefix - (second boot-parameters))) + (second boot-alternatives))) (old-entries -> (map boot-parameters->menu-entry - (drop boot-parameters 2))) + (drop boot-alternatives 2))) (bootloader -> (operating-system-bootloader (machine-operating-system machine))) (bootcfg (lower-object diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 84eb99b938..cdd78a7849 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -328,9 +328,9 @@ (define-syntax-rule (unless-file-not-found exp) #f (apply throw args))))) -(define* (profile-boot-parameters #:optional (profile %system-profile) - (numbers - (reverse (generation-numbers profile)))) +(define* (profile->boot-alternatives #:optional (profile %system-profile) + (numbers + (reverse (generation-numbers profile)))) "Return a list of 'boot-parameters' for the generations of PROFILE specified by NUMBERS, which is a list of generation numbers. The list is ordered from the most recent to the oldest profiles." @@ -395,18 +395,19 @@ (define (reinstall-bootloader store number) (bootloader bootloader))) ;; Make the specified system generation the default entry. - (params (first (profile-boot-parameters %system-profile - (list number)))) + (params (first (profile->boot-alternatives %system-profile + (list number)))) (locale (boot-parameters-locale params)) (store-crypto-devices (boot-parameters-store-crypto-devices params)) (store-directory-prefix (boot-parameters-store-directory-prefix params)) (old-generations (delv number (reverse (generation-numbers %system-profile)))) - (old-params (profile-boot-parameters - %system-profile old-generations)) + (previous-boot-alternatives (profile->boot-alternatives + %system-profile old-generations)) (entries (list (boot-parameters->menu-entry params))) - (old-entries (map boot-parameters->menu-entry old-params))) + (old-entries (map boot-parameters->menu-entry + previous-boot-alternatives))) (run-with-store store (mlet* %store-monad ((bootcfg (lower-object @@ -823,7 +824,7 @@ (define* (perform-action action image os (if (eq? action 'init) '() - (map boot-parameters->menu-entry (profile-boot-parameters)))))) + (map boot-parameters->menu-entry (profile->boot-alternatives)))))) (when (eq? action 'reconfigure) (maybe-suggest-running-guix-pull)