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