From patchwork Fri Sep 20 04:16:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 68148 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CB7EA27BBE9; Fri, 20 Sep 2024 05:18:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5BA3E27BBEB for ; Fri, 20 Sep 2024 05:18:12 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srV5f-0008DQ-4l; Fri, 20 Sep 2024 00:17:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srV5a-0008Cs-W4 for guix-patches@gnu.org; Fri, 20 Sep 2024 00:17:52 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srV5a-0006Gx-MS; Fri, 20 Sep 2024 00:17:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=T7BKkIrypFS3jrOnHYS9zc/rfHl2KYrYktxjcyxu/0M=; b=RPtdRsXud2QWX1OFCcgByCqpZfyBRDbvT5VA8O6CjSOMuFX3FUa0G2HNP24G0DBkSGSRqWqA9v3iPRzGdey7DglDGbqLL9kK9Sz7F9JYWdRJvmgcvd80nLb2NDmbscGfHJfzzDGt7RuiPXB1tzGQm8ZoUksbmJz5GXko+JNyP9WFjcCjRrWYPW5YDSRejVpSx/Vdf3oo2EErk9GCcBQflc95LUExRh7ehbBYtz7lmfJhO5cHlRBFwIHBmkoZmr6iIP7dWJ/IPlN6bK2TD1kytVV365N6X3QAhAMXKPO1Uvx7dITJANTeMxpYl6OdamXcYzo3BOLfzruhBeLU/itTSg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srV5s-0005Uz-08; Fri, 20 Sep 2024 00:18:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v4 10/11] Split generation->boot-parameters out of profile->boot-alternatives. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 20 Sep 2024 04:18:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Herman Rimm , Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172680588521080 (code B ref 69343); Fri, 20 Sep 2024 04:18:07 +0000 Received: (at 69343) by debbugs.gnu.org; 20 Sep 2024 04:18:05 +0000 Received: from localhost ([127.0.0.1]:33780 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5o-0005Tc-Ce for submit@debbugs.gnu.org; Fri, 20 Sep 2024 00:18:05 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:49292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srV5j-0005Rt-4j for 69343@debbugs.gnu.org; Fri, 20 Sep 2024 00:17:59 -0400 DKIM-Signature: a=rsa-sha256; b=FJJaHPka5raJy0dM+yvNeaYzw4YT9n+yuKWeG6yCqXieSfuyg0MLFKCnSG/zBfPeKrwxIF5y1urkjN8KFSHQxymj5p20Ascsz3+FfCpfq9EoZkBtI8RBsPXtE8ExTg7kUd1hhFHxqIefFYIrxDnVvrg2QmF3kFklUcC+ElAbDVEn4wGlRs9bZX5/CAeCzxc6bajwPtVjbnKX+RjqpOjcZRa8BbZ4x7nd9lVD6ZAOE27n84YK34uoyiY4Nn9SK+Dgqvt9aWwYvP0Y8i/qOAVPOHyXRRfRNqIBPkzmoVgb+4G6jE+SzF8sMW8U+gkLudVIusuofHgTfy2K7pyqs50YDg==; s=purelymail3; d=lunabee.space; v=1; bh=Tk8W7qM2jR/8/MeUJ1Qk7Yr0/D33pJMJPZnx9XqDdmw=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=PTgqHIDGIOm+kFyj20z10vUOjUvP0dSv9SHdHwKVA1lkG/kFUH/OUktY5agBvK0Lwfv2qE3tvfC3xkevWHhps35tfzKPyFTaHMtQCdMK1A6KH44c3pEQONZ0yooj29rtJqrilSggBnayYuI/4bU4u1jyMZTEZEPcAdzKx5mlxOgR4tJU1vyaL857FXDnY/ZN8cumSNd59txSKru6kjv1AUizG7eGQu3QNiDTqBekK7wvNQwFPMMSO2nE/p1nqVWkbEl2SfQ5Ta6tLD//MeE/6YnSW/DndrcPdd4rWeJQ+zaLsQBAiOwF0aljXfRjCd0T5p32pooy6+8J2MFUmAI9MQ==; s=purelymail3; d=purelymail.com; v=1; bh=Tk8W7qM2jR/8/MeUJ1Qk7Yr0/D33pJMJPZnx9XqDdmw=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -100958845; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 20 Sep 2024 04:17:20 +0000 (UTC) Date: Thu, 19 Sep 2024 23:16:04 -0500 Message-ID: <852043d05b73160c4613e209130a527fb1f7a5ce.1726805765.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Felix Lechner * guix/scripts/system.scm (profile->boot-alternatives)[generation->boot-parameters]: Move to... (generation->boot-parameters): ...here. (reinstall-bootloader): Use procedure above. Change-Id: I51ef1a4fa8fd18104d28a6a845707d7dedde3782 --- guix/scripts/system.scm | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index a4dd7a8054..0c69f6d90b 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -328,22 +328,27 @@ (define-syntax-rule (unless-file-not-found exp) #f (apply throw args))))) +(define (generation->boot-parameters profile number) + "Return the 'boot-parameters' for the generation of PROFILE specified +by NUMBER." + (unless-file-not-found + (let* ((system (generation-file-name profile number)) + (params (read-boot-parameters-file system)) + (epoch (stat:mtime (lstat system))) + (text (boot-parameters-label params))) + (boot-parameters + (inherit params) + (label (decorated-boot-label text number epoch)))))) + (define* (profile->boot-alternatives #:optional (profile %system-profile) (numbers (reverse (generation-numbers profile)))) "Return a list of 'boot-parameters' for the generations of PROFILE specified by NUMBERS, which is a list of generation numbers. The list is ordered from the most recent to the oldest profiles." - (define (generation->boot-parameters number) - (unless-file-not-found - (let* ((system (generation-file-name profile number)) - (params (read-boot-parameters-file system)) - (epoch (stat:mtime (lstat system))) - (text (boot-parameters-label params))) - (boot-parameters - (inherit params) - (label (decorated-boot-label text number epoch)))))) - (filter-map generation->boot-parameters numbers)) + (filter-map (lambda (number) + (generation->boot-parameters profile number)) + numbers)) ;;; @@ -391,8 +396,7 @@ (define (reinstall-bootloader store number) (bootloader bootloader))) ;; Make the specified system generation the default entry. - (params (first (profile->boot-alternatives %system-profile - (list number)))) + (params (generation->boot-parameters %system-profile number)) (locale (boot-parameters-locale params)) (store-crypto-devices (boot-parameters-store-crypto-devices params)) (store-directory-prefix