From patchwork Sun Aug 4 03:13:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66642 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1577F27BBEA; Sun, 4 Aug 2024 04:17:35 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5903627BBE2 for ; Sun, 4 Aug 2024 04:17:34 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRkB-0003sW-KJ; Sat, 03 Aug 2024 23:17:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1saRjn-0003kl-1T for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:51 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saRjk-0002RQ-TL; Sat, 03 Aug 2024 23:16:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=T7BKkIrypFS3jrOnHYS9zc/rfHl2KYrYktxjcyxu/0M=; b=paFCu8yLchzm2Nd28ZXVjYj6C10RFFHp19BnFfHaOsuNAdHIv/ly1do67RR6IAWTHZ+PxxYpkA8sfwCXZh7jlmOo8G++y3YLGaa9+TGmXQoyQGn9jzjnv0cTAvlQcs0ICt+EWrbcy2js0recNDJDpBO28RYDeaSuyjEmSNUCATl+wDswQd1E+ic+8MWpP9mmMQAYL8GFbpsj+kQg1jDKACUVBnZ5YGm9K+TlAfwwhRq8VE0kQEU4sy0dx435Odow/T6HvfJ50p1zI2ppgtTPUarY4ngvfvXJjFe9fLr8t6AbozyvyTkqEa8njWpGlZXNWF98CLL4Ba5VNoPxTpDhCA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk4-0007ov-5w; Sat, 03 Aug 2024 23:17:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 11/12] Split generation->boot-parameters out of profile->boot-alternatives. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sun, 04 Aug 2024 03:17:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274141429894 (code B ref 69343); Sun, 04 Aug 2024 03:17:08 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:54 +0000 Received: from localhost ([127.0.0.1]:55032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjq-0007m4-4q for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:54 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:56598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjo-0007lI-1D for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:52 -0400 DKIM-Signature: a=rsa-sha256; b=AUYz0YWWI1AApKqX96bJ9Nq7zoRzSAcFJO1cpsi2GnOpFokmq3+/+FIqAtHBwtOA57A1DYb3B25M2x5Lf89NvMxVv1pYY6egD+Pg2FWRw92Bqb/4yNPdjSExqmyeX2eEe6FY75FFt1jOdzKQZ3ECawim2GXR0w+MPe1t63Dy5mFMNY1jbdNL6c+s//srFqxw0RdPr7adnDVmIR0KLf2oVmuHl2arxmWrUXucwdM0n8W1l8+gvxORFOvlkrSsf6tN/nmpBzKtvoqZtu0K6XBEMyaex9gfO8WZFfj4M9gJRY/OoFdCfOGfv965bz0TsUhlDnF5J8W/k2rK+cw+Hpoupw==; s=purelymail2; d=lunabee.space; v=1; bh=Tk8W7qM2jR/8/MeUJ1Qk7Yr0/D33pJMJPZnx9XqDdmw=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=eLDUIkKaUdaHDLWbs2bUrI2TNJGcMaDh8E6qgLIdX1+4d2LVbO3CY1N9O4fDYlrtnWiLz4CscqZjXABHWB+qtovGxg6THvngQz5Cg4DpYeCg4oKEIL4D0EQq1YtxwSaboJaWDXmheNeKGKcF7XGNLhkgxINYUy/GP2ZUkzU4T0a2yV7ag0cDA7FuRyh/psapK88pkvSbyEOgZNtdcLy8B9QkGW3k5+tsATeAECD7PX2FrnFvG5vVYOXTlW2XAgNpQiFBzj5SG8yHSYF8ns3WNb833/Q7hDiKVPcMQWikXTl7isNwhPCFcGdV16d++Arp6cGpXWEcrjVsqc5IA2CnUQ==; s=purelymail2; d=purelymail.com; v=1; bh=Tk8W7qM2jR/8/MeUJ1Qk7Yr0/D33pJMJPZnx9XqDdmw=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:41 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:33 -0500 Message-ID: <009964ba87f3458ce70ce14f3106c46971cb57ef.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Felix Lechner * guix/scripts/system.scm (profile->boot-alternatives)[generation->boot-parameters]: Move to... (generation->boot-parameters): ...here. (reinstall-bootloader): Use procedure above. Change-Id: I51ef1a4fa8fd18104d28a6a845707d7dedde3782 --- guix/scripts/system.scm | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index a4dd7a8054..0c69f6d90b 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -328,22 +328,27 @@ (define-syntax-rule (unless-file-not-found exp) #f (apply throw args))))) +(define (generation->boot-parameters profile number) + "Return the 'boot-parameters' for the generation of PROFILE specified +by NUMBER." + (unless-file-not-found + (let* ((system (generation-file-name profile number)) + (params (read-boot-parameters-file system)) + (epoch (stat:mtime (lstat system))) + (text (boot-parameters-label params))) + (boot-parameters + (inherit params) + (label (decorated-boot-label text number epoch)))))) + (define* (profile->boot-alternatives #:optional (profile %system-profile) (numbers (reverse (generation-numbers profile)))) "Return a list of 'boot-parameters' for the generations of PROFILE specified by NUMBERS, which is a list of generation numbers. The list is ordered from the most recent to the oldest profiles." - (define (generation->boot-parameters number) - (unless-file-not-found - (let* ((system (generation-file-name profile number)) - (params (read-boot-parameters-file system)) - (epoch (stat:mtime (lstat system))) - (text (boot-parameters-label params))) - (boot-parameters - (inherit params) - (label (decorated-boot-label text number epoch)))))) - (filter-map generation->boot-parameters numbers)) + (filter-map (lambda (number) + (generation->boot-parameters profile number)) + numbers)) ;;; @@ -391,8 +396,7 @@ (define (reinstall-bootloader store number) (bootloader bootloader))) ;; Make the specified system generation the default entry. - (params (first (profile->boot-alternatives %system-profile - (list number)))) + (params (generation->boot-parameters %system-profile number)) (locale (boot-parameters-locale params)) (store-crypto-devices (boot-parameters-store-crypto-devices params)) (store-directory-prefix