From patchwork Sat Feb 24 01:51:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60950 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 6DB7427BBEB; Sat, 24 Feb 2024 02:00:23 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 13C3127BBE2 for ; Sat, 24 Feb 2024 02:00:23 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKV-0004VU-H0; Fri, 23 Feb 2024 20:59:55 -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 1rdhKK-0004Qf-Bc for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:45 -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 1rdhKJ-0006l6-DY; Fri, 23 Feb 2024 20:59:43 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKd-0003e0-HX; Fri, 23 Feb 2024 21:00:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 01/12] Fix bug where the extra menu entries for a bootloader were shown twice. Resent-From: Felix Lechner 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: Sat, 24 Feb 2024 02:00: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 =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873995313765 (code B ref 69343); Sat, 24 Feb 2024 02:00:03 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:13 +0000 Received: from localhost ([127.0.0.1]:36539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJo-0003Zp-5E for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:12 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:37576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJh-0003YB-8Q for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=EFWZ6M0fHdrIxDF yhRF0gEG8ruIshyAhIa7hcTQka/E=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=kaPS6VvRJVNh+gT/uGZXn0kr5pD0XkTIlRmjsgWd lD0EsGTgpKzSaA6Qk0dTHsmASFq0hp+DfnwnqJkc/xjW9msKkTT8v5w9U2lgU2jUKwa8b+ 3wfBHbhdaSgpdI2jYqgWxi8eckX5bi8zVt0BuSDseYLTdDpdHmGW80n1xPyyI= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id c1670776 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:55 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 057730c4; Sat, 24 Feb 2024 01:51:55 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:34 -0800 Message-ID: <25f1480b74f37095077b2cbbb8b0a169a272365d.1708736440.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 The extra menu entries are already being added in each bootloaders, as applicable. --- 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 Sat Feb 24 01:51:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60957 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 ACA3E27BBEA; Sat, 24 Feb 2024 02:11:11 +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=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,PDS_BTC_ID,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 687F327BBE2 for ; Sat, 24 Feb 2024 02:11:07 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhUy-0007Pl-MB; Fri, 23 Feb 2024 21:10: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 1rdhUw-0007PV-N2 for guix-patches@gnu.org; Fri, 23 Feb 2024 21:10:42 -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 1rdhUv-0000M1-Bf; Fri, 23 Feb 2024 21:10:41 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhVG-0004F2-2c; Fri, 23 Feb 2024 21:11:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 02/12] Move record to a separate file. Resent-From: Felix Lechner 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: Sat, 24 Feb 2024 02:11: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 =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170874062616191 (code B ref 69343); Sat, 24 Feb 2024 02:11:02 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 02:10:26 +0000 Received: from localhost ([127.0.0.1]:37506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhUc-0004Cw-MI for submit@debbugs.gnu.org; Fri, 23 Feb 2024 21:10:25 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:37576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJc-0003YB-KO for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=7mwMWjx9X+yNhTC FjbJ6qHa+qRKgO9k1KcpZ4YuX/wU=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=KVSiadOxM769kZnIJ3tDpDdPVxCroCq8OCtFSADs 2tU6tylZAvqbt5pEOlCTy2a+68U7DaVYVEYsrAxUKe+vvUWEC0uG7eMDogYxpJ8wwvR7xF 6H61SBIzi1REXBIXYNR0JlBWLdcLOkGtdNoveQ71lGY207N9+gWlVQ7xogq74= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id ac71c734 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:55 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 2966fb71; Sat, 24 Feb 2024 01:51:55 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:35 -0800 Message-ID: <42a9d53a4de3788e22b953927abb1a9723921e87.1708736440.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 Without it, the following commit following this one causes 'guix pull' to fail with this message: [ 0/ 50] loading... 0.0% of 25 files [ 1/ 50] loading... 4.0% of 25 files [ 2/ 50] loading... 8.0% of 25 files [ 3/ 50] loading... 12.0% of 25 files [ 4/ 50] loading... 16.0% of 25 files [ 5/ 50] loading... 20.0% of 25 files [ 6/ 50] loading... 24.0% of 25 files [ 7/ 50] loading... 28.0% of 25 files [ 8/ 50] loading... 32.0% of 25 files [ 9/ 50] loading... 36.0% of 25 files [ 10/ 50] loading... 40.0% of 25 files [ 11/ 50] loading... 44.0% of 25 files [ 12/ 50] loading... 48.0% of 25 files [ 13/ 50] loading... 52.0% of 25 files [ 14/ 50] loading... 56.0% of 25 files [ 15/ 50] loading... 60.0% of 25 files [ 16/ 50] loading... 64.0% of 25 files [ 17/ 50] loading... 68.0% of 25 files [ 18/ 50] loading... 72.0% of 25 files [ 19/ 50] loading... 76.0% of 25 files [ 20/ 50] loading... 80.0% of 25 files [ 21/ 50] loading... 84.0% of 25 files [ 22/ 50] loading... 88.0% of 25 files [ 23/ 50] loading... 92.0% of 25 files [ 24/ 50] loading... 96.0% of 25 files [ 25/ 50] loading... 100.0% of 25 files [ 25/ 50] compiling... 0.0% of 25 files [ 26/ 50] compiling... 4.0% of 25 files [ 27/ 50] compiling... 8.0% of 25 files [ 28/ 50] compiling... 12.0% of 25 files [ 29/ 50] compiling... 16.0% of 25 files [ 30/ 50] compiling... 20.0% of 25 files [ 31/ 50] compiling... 24.0% of 25 files [ 32/ 50] compiling... 28.0% of 25 files [ 33/ 50] compiling... 32.0% of 25 files [ 34/ 50] compiling... 36.0% of 25 files [ 35/ 50] compiling... 40.0% of 25 files [ 36/ 50] compiling... 44.0% of 25 files [ 37/ 50] compiling... 48.0% of 25 files [ 38/ 50] compiling... 52.0% of 25 files [ 39/ 50] compiling... 56.0% of 25 files [ 40/ 50] compiling... 60.0% of 25 files [ 41/ 50] compiling... 64.0% of 25 files [ 42/ 50] compiling... 68.0% of 25 files [ 43/ 50] compiling... 72.0% of 25 files [ 44/ 50] compiling... 76.0% of 25 files [ 45/ 50] compiling... 80.0% of 25 files [ 46/ 50] compiling... 84.0% of 25 files [ 47/ 50] compiling... 88.0% of 25 files [ 48/ 50] compiling... 92.0% of 25 files [ 49/ 50] compiling... 96.0% of 25 files [ 50/ 50] compiling... 100.0% of 25 files [ 0/ 50] loading... 0.0% of 25 files [ 1/ 50] loading... 4.0% of 25 files [ 2/ 50] loading... 8.0% of 25 files [ 3/ 50] loading... 12.0% of 25 files [ 4/ 50] loading... 16.0% of 25 files [ 5/ 50] loading... 20.0% of 25 files [ 6/ 50] loading... 24.0% of 25 files [ 7/ 50] loading... 28.0% of 25 files [ 8/ 50] loading... 32.0% of 25 files [ 9/ 50] loading... 36.0% of 25 files [ 10/ 50] loading... 40.0% of 25 files [ 11/ 50] loading... 44.0% of 25 files [ 12/ 50] loading... 48.0% of 25 files [ 13/ 50] loading... 52.0% of 25 files [ 14/ 50] loading... 56.0% of 25 files [ 15/ 50] loading... 60.0% of 25 files [ 16/ 50] loading... 64.0% of 25 files [ 17/ 50] loading... 68.0% of 25 files [ 18/ 50] loading... 72.0% of 25 files [ 19/ 50] loading... 76.0% of 25 files [ 20/ 50] loading... 80.0% of 25 files [ 21/ 50] loading... 84.0% of 25 files [ 22/ 50] loading... 88.0% of 25 files [ 23/ 50] loading... 92.0% of 25 files [ 24/ 50] loading... 96.0% of 25 files [ 25/ 50] loading... 100.0% of 25 files [ 25/ 50] compiling... 0.0% of 25 files [ 26/ 50] compiling... 4.0% of 25 files [ 27/ 50] compiling... 8.0% of 25 files [ 28/ 50] compiling... 12.0% of 25 files [ 29/ 50] compiling... 16.0% of 25 files [ 30/ 50] compiling... 20.0% of 25 files [ 31/ 50] compiling... 24.0% of 25 files [ 32/ 50] compiling... 28.0% of 25 files [ 33/ 50] compiling... 32.0% of 25 files [ 34/ 50] compiling... 36.0% of 25 files [ 35/ 50] compiling... 40.0% of 25 files [ 36/ 50] compiling... 44.0% of 25 files [ 37/ 50] compiling... 48.0% of 25 files [ 38/ 50] compiling... 52.0% of 25 files [ 39/ 50] compiling... 56.0% of 25 files [ 40/ 50] compiling... 60.0% of 25 files [ 41/ 50] compiling... 64.0% of 25 files [ 42/ 50] compiling... 68.0% of 25 files [ 43/ 50] compiling... 72.0% of 25 files [ 44/ 50] compiling... 76.0% of 25 files [ 45/ 50] compiling... 80.0% of 25 files [ 46/ 50] compiling... 84.0% of 25 files [ 47/ 50] compiling... 88.0% of 25 files [ 48/ 50] compiling... 92.0% of 25 files [ 49/ 50] compiling... 96.0% of 25 files [ 50/ 50] compiling... 100.0% of 25 files [ 0/ 50] loading... 0.0% of 25 files [ 1/ 50] loading... 4.0% of 25 files [ 2/ 50] loading... 8.0% of 25 files [ 3/ 50] loading... 12.0% of 25 files [ 4/ 50] loading... 16.0% of 25 files [ 5/ 50] loading... 20.0% of 25 files [ 6/ 50] loading... 24.0% of 25 files [ 7/ 50] loading... 28.0% of 25 files [ 8/ 50] loading... 32.0% of 25 files [ 9/ 50] loading... 36.0% of 25 files [ 10/ 50] loading... 40.0% of 25 files [ 11/ 50] loading... 44.0% of 25 files [ 12/ 50] loading... 48.0% of 25 files [ 13/ 50] loading... 52.0% of 25 files [ 14/ 50] loading... 56.0% of 25 files [ 15/ 50] loading... 60.0% of 25 files [ 16/ 50] loading... 64.0% of 25 files [ 17/ 50] loading... 68.0% of 25 files [ 18/ 50] loading... 72.0% of 25 files [ 19/ 50] loading... 76.0% of 25 files [ 20/ 50] loading... 80.0% of 25 files [ 21/ 50] loading... 84.0% of 25 files [ 22/ 50] loading... 88.0% of 25 files [ 23/ 50] loading... 92.0% of 25 files [ 24/ 50] loading... 96.0% of 25 files [ 25/ 50] loading... 100.0% of 25 files [ 25/ 50] compiling... 0.0% of 25 files [ 26/ 50] compiling... 4.0% of 25 files [ 27/ 50] compiling... 8.0% of 25 files [ 28/ 50] compiling... 12.0% of 25 files [ 29/ 50] compiling... 16.0% of 25 files [ 30/ 50] compiling... 20.0% of 25 files [ 31/ 50] compiling... 24.0% of 25 files [ 32/ 50] compiling... 28.0% of 25 files [ 33/ 50] compiling... 32.0% of 25 files [ 34/ 50] compiling... 36.0% of 25 files [ 35/ 50] compiling... 40.0% of 25 files [ 36/ 50] compiling... 44.0% of 25 files [ 37/ 50] compiling... 48.0% of 25 files [ 38/ 50] compiling... 52.0% of 25 files [ 39/ 50] compiling... 56.0% of 25 files [ 40/ 50] compiling... 60.0% of 25 files [ 41/ 50] compiling... 64.0% of 25 files [ 42/ 50] compiling... 68.0% of 25 files [ 43/ 50] compiling... 72.0% of 25 files [ 44/ 50] compiling... 76.0% of 25 files [ 45/ 50] compiling... 80.0% of 25 files [ 46/ 50] compiling... 84.0% of 25 files [ 47/ 50] compiling... 88.0% of 25 files [ 48/ 50] compiling... 92.0% of 25 files [ 49/ 50] compiling... 96.0% of 25 files [ 50/ 50] compiling... 100.0% of 25 files [ 0/ 50] loading... 0.0% of 25 files [ 1/ 50] loading... 4.0% of 25 files [ 2/ 50] loading... 8.0% of 25 files [ 3/ 50] loading... 12.0% of 25 files [ 4/ 50] loading... 16.0% of 25 files [ 5/ 50] loading... 20.0% of 25 files [ 6/ 50] loading... 24.0% of 25 files [ 7/ 50] loading... 28.0% of 25 files [ 8/ 50] loading... 32.0% of 25 files [ 9/ 50] loading... 36.0% of 25 files [ 10/ 50] loading... 40.0% of 25 files [ 11/ 50] loading... 44.0% of 25 files [ 12/ 50] loading... 48.0% of 25 files [ 13/ 50] loading... 52.0% of 25 files [ 14/ 50] loading... 56.0% of 25 files [ 15/ 50] loading... 60.0% of 25 files [ 16/ 50] loading... 64.0% of 25 files [ 17/ 50] loading... 68.0% of 25 files [ 18/ 50] loading... 72.0% of 25 files [ 19/ 50] loading... 76.0% of 25 files [ 20/ 50] loading... 80.0% of 25 files [ 21/ 50] loading... 84.0% of 25 files [ 22/ 50] loading... 88.0% of 25 files [ 23/ 50] loading... 92.0% of 25 files [ 24/ 50] loading... 96.0% of 25 files [ 25/ 50] loading... 100.0% of 25 files [ 25/ 50] compiling... 0.0% of 25 files [ 26/ 50] compiling... 4.0% of 25 files [ 27/ 50] compiling... 8.0% of 25 files [ 28/ 50] compiling... 12.0% of 25 files [ 29/ 50] compiling... 16.0% of 25 files [ 30/ 50] compiling... 20.0% of 25 files [ 31/ 50] compiling... 24.0% of 25 files [ 32/ 50] compiling... 28.0% of 25 files [ 33/ 50] compiling... 32.0% of 25 files [ 34/ 50] compiling... 36.0% of 25 files [ 35/ 50] compiling... 40.0% of 25 files [ 36/ 50] compiling... 44.0% of 25 files [ 37/ 50] compiling... 48.0% of 25 files [ 38/ 50] compiling... 52.0% of 25 files [ 39/ 50] compiling... 56.0% of 25 files [ 40/ 50] compiling... 60.0% of 25 files [ 41/ 50] compiling... 64.0% of 25 files [ 42/ 50] compiling... 68.0% of 25 files [ 43/ 50] compiling... 72.0% of 25 files [ 44/ 50] compiling... 76.0% of 25 files [ 45/ 50] compiling... 80.0% of 25 files [ 46/ 50] compiling... 84.0% of 25 files [ 47/ 50] compiling... 88.0% of 25 files [ 48/ 50] compiling... 92.0% of 25 files [ 49/ 50] compiling... 96.0% of 25 files [ 50/ 50] compiling... 100.0% of 25 files [ 0/ 50] loading... 0.0% of 25 files [ 1/ 50] loading... 4.0% of 25 files [ 2/ 50] loading... 8.0% of 25 files [ 3/ 50] loading... 12.0% of 25 files [ 4/ 50] loading... 16.0% of 25 files [ 5/ 50] loading... 20.0% of 25 files [ 6/ 50] loading... 24.0% of 25 files [ 7/ 50] loading... 28.0% of 25 files [ 8/ 50] loading... 32.0% of 25 files [ 9/ 50] loading... 36.0% of 25 files [ 10/ 50] loading... 40.0% of 25 files [ 11/ 50] loading... 44.0% of 25 files [ 12/ 50] loading... 48.0% of 25 files [ 13/ 50] loading... 52.0% of 25 files [ 14/ 50] loading... 56.0% of 25 files [ 15/ 50] loading... 60.0% of 25 files [ 16/ 50] loading... 64.0% of 25 files [ 17/ 50] loading... 68.0% of 25 files [ 18/ 50] loading... 72.0% of 25 files [ 19/ 50] loading... 76.0% of 25 files [ 20/ 50] loading... 80.0% of 25 files [ 21/ 50] loading... 84.0% of 25 files [ 22/ 50] loading... 88.0% of 25 files [ 23/ 50] loading... 92.0% of 25 files [ 24/ 50] loading... 96.0% of 25 files [ 25/ 50] loading... 100.0% of 25 files [ 25/ 50] compiling... 0.0% of 25 files [ 26/ 50] compiling... 4.0% of 25 files [ 27/ 50] compiling... 8.0% of 25 files [ 28/ 50] compiling... 12.0% of 25 files [ 29/ 50] compiling... 16.0% of 25 files [ 30/ 50] compiling... 20.0% of 25 files [ 31/ 50] compiling... 24.0% of 25 files [ 32/ 50] compiling... 28.0% of 25 files [ 33/ 50] compiling... 32.0% of 25 files [ 34/ 50] compiling... 36.0% of 25 files [ 35/ 50] compiling... 40.0% of 25 files [ 36/ 50] compiling... 44.0% of 25 files [ 37/ 50] compiling... 48.0% of 25 files [ 38/ 50] compiling... 52.0% of 25 files [ 39/ 50] compiling... 56.0% of 25 files [ 40/ 50] compiling... 60.0% of 25 files [ 41/ 50] compiling... 64.0% of 25 files [ 42/ 50] compiling... 68.0% of 25 files [ 43/ 50] compiling... 72.0% of 25 files [ 44/ 50] compiling... 76.0% of 25 files [ 45/ 50] compiling... 80.0% of 25 files [ 46/ 50] compiling... 84.0% of 25 files [ 47/ 50] compiling... 88.0% of 25 files [ 48/ 50] compiling... 92.0% of 25 files [ 49/ 50] compiling... 96.0% of 25 files [ 50/ 50] compiling... 100.0% of 25 files [ 0/ 50] loading... 0.0% of 25 files [ 1/ 50] loading... 4.0% of 25 files [ 2/ 50] loading... 8.0% of 25 files [ 3/ 50] loading... 12.0% of 25 files [ 4/ 50] loading... 16.0% of 25 files [ 5/ 50] loading... 20.0% of 25 files [ 6/ 50] loading... 24.0% of 25 files [ 7/ 50] loading... 28.0% of 25 files [ 8/ 50] loading... 32.0% of 25 files [ 9/ 50] loading... 36.0% of 25 files [ 10/ 50] loading... 40.0% of 25 files [ 11/ 50] loading... 44.0% of 25 files [ 12/ 50] loading... 48.0% of 25 files [ 13/ 50] loading... 52.0% of 25 files [ 14/ 50] loading... 56.0% of 25 files [ 15/ 50] loading... 60.0% of 25 files [ 16/ 50] loading... 64.0% of 25 files [ 17/ 50] loading... 68.0% of 25 files [ 18/ 50] loading... 72.0% of 25 files [ 19/ 50] loading... 76.0% of 25 files [ 20/ 50] loading... 80.0% of 25 files [ 21/ 50] loading... 84.0% of 25 files [ 22/ 50] loading... 88.0% of 25 files [ 23/ 50] loading... 92.0% of 25 files [ 24/ 50] loading... 96.0% of 25 files [ 25/ 50] loading... 100.0% of 25 files [ 25/ 50] compiling... 0.0% of 25 files [ 26/ 50] compiling... 4.0% of 25 files [ 27/ 50] compiling... 8.0% of 25 files [ 28/ 50] compiling... 12.0% of 25 files [ 29/ 50] compiling... 16.0% of 25 files [ 30/ 50] compiling... 20.0% of 25 files [ 31/ 50] compiling... 24.0% of 25 files [ 32/ 50] compiling... 28.0% of 25 files [ 33/ 50] compiling... 32.0% of 25 files [ 34/ 50] compiling... 36.0% of 25 files [ 35/ 50] compiling... 40.0% of 25 files [ 36/ 50] compiling... 44.0% of 25 files [ 37/ 50] compiling... 48.0% of 25 files [ 38/ 50] compiling... 52.0% of 25 files [ 39/ 50] compiling... 56.0% of 25 files [ 40/ 50] compiling... 60.0% of 25 files [ 41/ 50] compiling... 64.0% of 25 files [ 42/ 50] compiling... 68.0% of 25 files [ 43/ 50] compiling... 72.0% of 25 files [ 44/ 50] compiling... 76.0% of 25 files [ 45/ 50] compiling... 80.0% of 25 files [ 46/ 50] compiling... 84.0% of 25 files [ 47/ 50] compiling... 88.0% of 25 files [ 48/ 50] compiling... 92.0% of 25 files [ 49/ 50] compiling... 96.0% of 25 files [ 50/ 50] compiling... 100.0% of 25 files [ 0/ 50] loading... 0.0% of 25 files [ 1/ 50] loading... 4.0% of 25 filesBacktrace: In ice-9/boot-9.scm: 222:29 19 (map1 (((gnu packages nano)) ((gnu packages nvi)) ((gnu packages package-management)) ((gnu packages pciutils)) ((gnu packages texinfo)) ((gnu packages text-editors)) ((gnu # wget)) ?)) 222:29 18 (map1 (((gnu packages nvi)) ((gnu packages package-management)) ((gnu packages pciutils)) ((gnu packages texinfo)) ((gnu packages text-editors)) ((gnu packages wget)) ((gnu #)) ((?)) ?)) 222:29 17 (map1 (((gnu packages package-management)) ((gnu packages pciutils)) ((gnu packages texinfo)) ((gnu packages text-editors)) ((gnu packages wget)) ((gnu services)) ((gnu services #)) ?)) 222:29 16 (map1 (((gnu packages pciutils)) ((gnu packages texinfo)) ((gnu packages text-editors)) ((gnu packages wget)) ((gnu services)) ((gnu services shepherd)) ((gnu services base)) ((# ?)) ?)) 222:29 15 (map1 (((gnu packages texinfo)) ((gnu packages text-editors)) ((gnu packages wget)) ((gnu services)) ((gnu services shepherd)) ((gnu services base)) ((gnu bootloader)) ((gnu # #)) # ?)) 222:29 14 (map1 (((gnu packages text-editors)) ((gnu packages wget)) ((gnu services)) ((gnu services shepherd)) ((gnu services base)) ((gnu bootloader)) ((gnu system shadow)) ((gnu system #)) ?)) 222:29 13 (map1 (((gnu packages wget)) ((gnu services)) ((gnu services shepherd)) ((gnu services base)) ((gnu bootloader)) ((gnu system shadow)) ((gnu system nss)) ((gnu system locale)) ((?)) ?)) 222:17 12 (map1 (((gnu services)) ((gnu services shepherd)) ((gnu services base)) ((gnu bootloader)) ((gnu system shadow)) ((gnu system nss)) ((gnu system locale)) ((gnu system pam)) ((gnu ?)) ?)) 3327:17 11 (resolve-interface (gnu services) #:select _ #:hide _ #:prefix _ #:renamer _ #:version _) In ice-9/threads.scm: 390:8 10 (_ _) In ice-9/boot-9.scm: 3253:13 9 (_) In ice-9/threads.scm: 390:8 8 (_ _) In ice-9/boot-9.scm: 3544:20 7 (_) 2836:4 6 (save-module-excursion #) 3564:26 5 (_) In unknown file: 4 (primitive-load-path "gnu/services" #) In ice-9/eval.scm: 626:19 3 (_ #) 159:9 2 (_ #) 213:37 1 (_ #) In guix/modules.scm: 157:28 0 (loop ((gnu build hurd-boot) (guix build syscalls)) ((guix build utils)) #< vhash: # insert: #) guix/modules.scm:157:28: In procedure loop: ERROR: 1. &missing-dependency-error: module: (gnu build hurd-boot) search-path: ("." "/gnu/store/11i4vribdynrxkp4ppilkjp9y9jshaxq-guix-core-source" "/gnu/store/avd0dsg9rixk3djls8ikzphfjbl227za-guix-extra-source" "/gnu/store/vdi10jyhr1igrkdgnsjj09krjx1jkzkm-guix-packages-base-source" "/gnu/store/l8sdgq6cpnxyk732w23p7mhq6sial0vm-guile-gcrypt-0.4.0/share/guile/site/3.0" "/gnu/store/0i81lpfnn05pmjc5f43q4nfvd27r08f7-guile-gnutls-3.7.12/share/guile/site/3.0" "/gnu/store/rm803mxjvr9zamg1226dl9zf2275yjzg-guile-git-0.5.2/share/guile/site/3.0" "/gnu/store/bxvl7w7q66gbk7qkkhsiq30vl69jj4x7-guile-bytestructures-1.0.10/share/guile/site/3.0" "/gnu/store/q91hbi8yc2jnx0hlk6zb6vlkrw3xm0yx-guile-avahi-0.4.1/share/guile/site/3.0" "/gnu/store/p5f006jcr83jc7m731vhvjdkr2j0hnp3-guile-json-4.7.3/share/guile/site/3.0" "/gnu/store/d75xpk3qxw7na6zgbf2dw3asqhwifd6a-guile-semver-0.1.1/share/guile/site/3.0" "/gnu/store/19m9xm33jq34nb64z11q5bph85ff6gyd-guile-ssh-0.16.3/share/guile/site/3.0" "/gnu/store/r8izi6mi1mjl7s1kn20q1hxmy3jg2bxc-guile-sqlite3-0.1.3/share/guile/site/3.0" "/gnu/store/bc3zzjych6jyp4ph2af9k3w8qcs3nsn2-guile-lib-0.2.7/share/guile/site/3.0" "/gnu/store/w6gpivr3421wbzkjg6qlc95sv1srz15a-guile-zlib-0.1.0/share/guile/site/3.0" "/gnu/store/1zlqd5240mq0dwwig9bv1cg4zjf092h9-guile-lzlib-0.0.2/share/guile/site/3.0" "/gnu/store/rqd5wpa09fizcb211p78g6f2f5jb2lwg-guile-zstd-0.1.1/share/guile/site/3.0" "/gnu/store/xfd68fq6vmali9wqivg84baqp4n4maqx-guix-packages-source" "/gnu/store/a7sykpl77z61sr0dv034rpwby9bz8zwm-module-import" "/gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/share/guile/3.0" "/gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/share/guile/site/3.0" "/gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/share/guile/site" "/gnu/store/4gvgcfdiz67wv04ihqfa8pqwzsb0qpv5-guile-3.0.9/share/guile") Change-Id: I6944ffd4c323c776005b0cef23218bffae59be23 --- gnu/machine/ssh.scm | 1 + gnu/system.scm | 224 +----------------------------- gnu/system/boot.scm | 277 ++++++++++++++++++++++++++++++++++++++ guix/scripts/system.scm | 1 + tests/boot-parameters.scm | 1 + 5 files changed, 281 insertions(+), 223 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..a438137731 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) @@ -149,25 +150,6 @@ (define-module (gnu system) 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 +309,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)) diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm new file mode 100644 index 0000000000..87b0184f98 --- /dev/null +++ b/gnu/system/boot.scm @@ -0,0 +1,277 @@ +;;; 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 store) + #:use-module (guix gexp) + #:use-module (guix records) + #:use-module (gnu bootloader) + #:use-module (gnu system file-systems) + #:use-module (ice-9 format) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #: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)) + +;;; +;;; 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)) + +;;; 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 Sat Feb 24 01:51:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60946 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 DBFBE27BBE2; Sat, 24 Feb 2024 02:00:00 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 59EFB27BBE9 for ; Sat, 24 Feb 2024 01:59:51 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKG-0004Q5-Ic; Fri, 23 Feb 2024 20:59:40 -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 1rdhKF-0004Pu-BF for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59: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 1rdhKF-0006ky-0f for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:39 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKc-0003dl-Hl for guix-patches@gnu.org; Fri, 23 Feb 2024 21:00:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 03/12] Also move boot-parameters->menu-entry. Resent-From: Felix Lechner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 24 Feb 2024 02:00: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 Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873995213756 (code B ref 69343); Sat, 24 Feb 2024 02:00:02 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:12 +0000 Received: from localhost ([127.0.0.1]:36535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJn-0003Zb-CD for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:12 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:41018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJh-0003Ye-9W for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=LEpLdcDW5XI6JcB iqCxX5+ctUaqlDUajJQiqlHANPlU=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=WwH2RREDzgYR4uM4IDRKwaPbseqOsbFM5cI9exZU UE+SqntpV0vNEXyGi3fazv7mauhKSfvjhye07V1fnRbfTl5HVRT3ezCUacHBvIqUmR0osq eU8eqQqnpbJ/vjHImNGgUibZa/+rG2JUTgWHAeV9ja91+XpWvApyVqQYiVobg= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id e1233e51 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:55 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id cae211ed; Sat, 24 Feb 2024 01:51:55 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:36 -0800 Message-ID: <55f27c88ae2a7d9e6d9b73a306c267e5a312ad2a.1708736440.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 Change-Id: I794198e074b6d3012526a3056599ee3db1f1cdba --- gnu/system.scm | 28 ---------------------------- gnu/system/boot.scm | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index a438137731..e748066e16 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -150,8 +150,6 @@ (define-module (gnu system) hurd-default-essential-services - boot-parameters->menu-entry - local-host-aliases ;deprecated %root-account %setuid-programs @@ -304,32 +302,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 87b0184f98..d3f58e1ade 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -64,6 +64,8 @@ (define-module (gnu system boot) read-boot-parameters read-boot-parameters-file + boot-parameters->menu-entry + ensure-not-/dev)) ;;; @@ -274,4 +276,26 @@ (define (ensure-not-/dev device) #f device)) +(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) + '()))))) + ;;; boot.scm ends here From patchwork Sat Feb 24 01:51:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60947 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 2147527BBEA; Sat, 24 Feb 2024 02:00: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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 B703027BBE2 for ; Sat, 24 Feb 2024 02:00:15 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKS-0004Uo-9q; Fri, 23 Feb 2024 20:59:53 -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 1rdhKK-0004Qh-Bj for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:45 -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 1rdhKI-0006l5-9y; Fri, 23 Feb 2024 20:59:43 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKe-0003e7-EL; Fri, 23 Feb 2024 21:00:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 04/12] Rename seconds->string procedure to epoch->date-string. Resent-From: Felix Lechner 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: Sat, 24 Feb 2024 02:00: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 =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873995313776 (code B ref 69343); Sat, 24 Feb 2024 02:00:04 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:13 +0000 Received: from localhost ([127.0.0.1]:36541 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJo-0003Zx-P0 for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:13 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:37576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJi-0003YB-D5 for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=hVpMq2zykFqmUpw EC8fnoeKZbmuI2fNnQhEl9akmS5Y=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=qUS15gMLd1AhJIiWzQTTWZK3tqjE0QQCqT0xAK31 7uztAuZK5Zsesv4xGh275jrkZvIqhMpAWBa6akLC+V5j+yDimLekGjwZTtDhCcthq4Bu4e Mt51bgbSQjnjO5CkqJuEhjId/h9NZbaowt0q5XBsjhxSAliqW1SWxXk+W2F78= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 31d60c7d (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:56 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 9e826075; Sat, 24 Feb 2024 01:51:55 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:37 -0800 Message-ID: <920e58bf7db229d45e078f1a2e02b6d9052e1915.1708736440.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 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 Sat Feb 24 01:51:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60952 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 9CCD027BBE2; Sat, 24 Feb 2024 02:00: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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 6353727BBEA for ; Sat, 24 Feb 2024 02:00:24 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKR-0004Ti-CE; Fri, 23 Feb 2024 20:59:51 -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 1rdhKK-0004Qc-9k for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:45 -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 1rdhKJ-0006l7-HG; Fri, 23 Feb 2024 20:59:43 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKg-0003ed-3F; Fri, 23 Feb 2024 21:00:06 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 05/12] Move epoch->date-string to gnu/system/boot.scm and use it elsewhere. Resent-From: Felix Lechner 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: Sat, 24 Feb 2024 02:00: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 =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873995513807 (code B ref 69343); Sat, 24 Feb 2024 02:00:06 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:15 +0000 Received: from localhost ([127.0.0.1]:36547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJq-0003aV-Bz for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:14 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:41018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJi-0003Ye-2d for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=TYjSqt20F3oyd/m CHH1WcOjJ0noWTnNh6GAVmwY/EKU=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=RJy5kZ+bA43J6ZUxU9eRGj2ptr8ywM2Wy3Rs8fYV 06tn42rVqMp0tQ44ePzF2QszY1Plcg7hONjbj3LoXQbnBd6/0rlSIm/8+5bNWmHz/htchy GoempgsiNfYQcZPXgdOpDtll1c4XWRdBt0f69mI4z8vjMgl5tN0Vqql/kc0TQ= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 16beef28 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:56 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 267bae45; Sat, 24 Feb 2024 01:51:55 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:38 -0800 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 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 d3f58e1ade..df04ef92da 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -41,6 +41,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-35) #:use-module (rnrs bytevectors) #:export (boot-parameters @@ -64,6 +65,7 @@ (define-module (gnu system boot) read-boot-parameters read-boot-parameters-file + epoch->date-string boot-parameters->menu-entry ensure-not-/dev)) @@ -276,6 +278,12 @@ (define (ensure-not-/dev device) #f device)) +(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 Sat Feb 24 01:51:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60956 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 6112527BBEA; Sat, 24 Feb 2024 02:00:34 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 5096D27BBE2 for ; Sat, 24 Feb 2024 02:00:33 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKT-0004VC-8u; Fri, 23 Feb 2024 20:59:53 -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 1rdhKK-0004Qd-9W for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:45 -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 1rdhKK-0006lL-17; Fri, 23 Feb 2024 20:59:44 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKf-0003eJ-5t; Fri, 23 Feb 2024 21:00:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 06/12] Offer a uniform decorated-boot-label and use it. Resent-From: Felix Lechner 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: Sat, 24 Feb 2024 02:00: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 =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873995413790 (code B ref 69343); Sat, 24 Feb 2024 02:00:05 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:14 +0000 Received: from localhost ([127.0.0.1]:36543 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJp-0003a9-Ew for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:13 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:37576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJj-0003YB-Eh for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=bfr6sfF4lqOSAsu DUIysF5plQBf5x4N2yUHFIeKF+R0=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=d1UtXOHqGfuM8VxVrdi0HbNhxp5rSdL2MQe1zYWo CTKBd9UhsHKD3mmEmcSOfA5K8OZ8ST1GaNAmNgzGy4iLhf+TlVq/vPL406QbNfcd40kgdt zf5S5kWrujSTMxy0POvqu3rm2aQF76g6GXaWhrzHEMUE1mLhC4wXSFgoHpcHE= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 6485b81d (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:56 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id f74d228f; Sat, 24 Feb 2024 01:51:56 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:39 -0800 Message-ID: <0ec0c6abe0ee8020257c599c03485318bf9fd37f.1708736440.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 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 df04ef92da..f5342e06ca 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -66,6 +66,7 @@ (define-module (gnu system boot) read-boot-parameters-file epoch->date-string + decorated-boot-label boot-parameters->menu-entry ensure-not-/dev)) @@ -284,6 +285,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 Sat Feb 24 01:51:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60951 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 DB57A27BBEE; Sat, 24 Feb 2024 02:00:24 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 D103C27BBE2 for ; Sat, 24 Feb 2024 02:00:23 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKV-0004VO-FI; Fri, 23 Feb 2024 20:59:55 -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 1rdhKN-0004SQ-Ia for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:48 -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 1rdhKM-0006mm-SD; Fri, 23 Feb 2024 20:59:47 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKj-0003g4-I7; Fri, 23 Feb 2024 21:00:09 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 07/12] Rename boot-parameters to boot-alternatives when appropriate. Resent-From: Felix Lechner 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: Sat, 24 Feb 2024 02:00:09 +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 =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873997913902 (code B ref 69343); Sat, 24 Feb 2024 02:00:09 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:39 +0000 Received: from localhost ([127.0.0.1]:36586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhKE-0003c3-TL for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:39 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:37576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJl-0003YB-GF for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=fuBUMmGfDL3W87l vpvV4Rrmx/rNjZomQkl40E0+7qw8=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=kQUqC2HecLS/jMfevHVOcayMCIoWmBnZGfP+bQod 9jZCVZ48gQKRQkXJEw+Hkxx45XLV7GqMD2U17JTMRWhODfnDW+yIinoP98ljSjIYxaE+AW 20sVn1cdYZ/YVsfTceEBwJhrBlRNBZ8a2sMhFonsAI9ZxTR/bD1MFMnqJVYCk= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id b48d1f84 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:56 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 532d2ed5; Sat, 24 Feb 2024 01:51:56 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:40 -0800 Message-ID: <4e6ac07abb8ade8d10ce5a7c41836abebfb4ed4a.1708736440.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 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. 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 Sat Feb 24 01:51:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60954 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 5617027BBE2; Sat, 24 Feb 2024 02:00: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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 5210527BBE9 for ; Sat, 24 Feb 2024 02:00:27 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKR-0004Ty-LH; Fri, 23 Feb 2024 20:59:51 -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 1rdhKJ-0004Qb-Qr for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:45 -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 1rdhKH-0006l4-TX for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:43 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKf-0003eT-Jm for guix-patches@gnu.org; Fri, 23 Feb 2024 21:00:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 08/12] Rename two remote variables confusingly named 'generations'. Resent-From: Felix Lechner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 24 Feb 2024 02:00: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 Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873995413798 (code B ref 69343); Sat, 24 Feb 2024 02:00:05 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:14 +0000 Received: from localhost ([127.0.0.1]:36545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJq-0003aO-2S for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:14 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:37576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJk-0003YB-IY for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=G1N8ZklrS4vkAgg +RWhHzTmtfzYctpiC2LGdDiRx8Bc=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=g5t++sRcDu+6TfrUDPVE5Qzep6Heul/GCLOQ5E5J FLcQe7QjK2Ft12fnffMyItvtQuPLd0tW/hwaZDUUWAC07kPqUYxti1xXwokLWH2V58X7zL qbxav2izw6tiKmsHt8dPtiqsUxmw6q3nQnilzRMVWODWrAit3ed6mE/azWv2w= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id b3877c26 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:56 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id e65090a7; Sat, 24 Feb 2024 01:51:56 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:41 -0800 Message-ID: <4fc8cce4e11bad8521b4afb93642de7c872d2d63.1708736440.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 Both refer to data sets returned from the remote expression, and one of them shadowed an element of itself. 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 Sat Feb 24 01:51:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60949 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 A7FD827BBEA; Sat, 24 Feb 2024 02:00:20 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 17DE227BBE2 for ; Sat, 24 Feb 2024 02:00:20 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKR-0004U6-W0; Fri, 23 Feb 2024 20:59:52 -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 1rdhKK-0004Qe-9t for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:45 -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 1rdhKK-0006lM-29 for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:44 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKh-0003fD-RK for guix-patches@gnu.org; Fri, 23 Feb 2024 21:00:07 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 09/12] Give a separate name to a commonly used expression. Resent-From: Felix Lechner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 24 Feb 2024 02:00: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: Felix Lechner Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873995513822 (code B ref 69343); Sat, 24 Feb 2024 02:00:07 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:15 +0000 Received: from localhost ([127.0.0.1]:36551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJr-0003am-Fs for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:15 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:41020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJm-0003ZN-8V for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=3bmMbn8pjpS2E3l 7ZFHNeML7YSmQj/eAxisDQXbLLPc=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=p7rTC1dNsggapIUQQVJfb4eMXbEBD8vQyEDzHfdx wbH3fANerkNphu5+nRG0hKF6abyZMTw7t32LuNWA7yFZF+8S9AkOk0nj9VszepYPXcAJOz IJSZbpkDvobtEsz92O8v2uSQMH/TiISkykt3aJ7GeFCmWJPFPKhVq8VXXaEO0= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 9189a85f (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:57 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 99433eed; Sat, 24 Feb 2024 01:51:56 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:42 -0800 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 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 Sat Feb 24 01:51:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60955 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 483B827BBE9; Sat, 24 Feb 2024 02:00:31 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 63A1627BBE2 for ; Sat, 24 Feb 2024 02:00:30 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKR-0004Sv-4g; Fri, 23 Feb 2024 20:59:51 -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 1rdhKM-0004Rw-Qm for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:47 -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 1rdhKM-0006mb-J3; Fri, 23 Feb 2024 20:59:46 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKj-0003fv-4m; Fri, 23 Feb 2024 21:00:09 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 10/12] Simplify profile->boot-alternatives. Resent-From: Felix Lechner 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: Sat, 24 Feb 2024 02:00:09 +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 =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873997913894 (code B ref 69343); Sat, 24 Feb 2024 02:00:09 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:39 +0000 Received: from localhost ([127.0.0.1]:36584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhKE-0003bv-HU for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:38 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:41020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJn-0003ZN-23 for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=5FUNxGMiszupQFC uJkwVx3EeqqPXt+UZpqA0uAybdpM=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=pPrEKyCAmkW7QrXA2n/TFUyvZsLJYQdoApoAIHwJ M9N83ldUM9WSW/KRqg9Pr+AJHYMQ8W2I4RsnC5lzJsRdR0WWjiN3esfTVAA+qcwckXNqNm sexLs/CTcKhuHZ6X5gvOFsp/dw+iWlxR9IoNye8qZxnVvFBovetnv7eyL2RC4= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id fcde3106 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:57 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id a0f668d3; Sat, 24 Feb 2024 01:51:56 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:43 -0800 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 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 Sat Feb 24 01:51:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60948 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 9943427BBE9; Sat, 24 Feb 2024 02:00:19 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 BD06527BBE2 for ; Sat, 24 Feb 2024 02:00:18 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKP-0004SM-7D; Fri, 23 Feb 2024 20:59: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 1rdhKK-0004Qj-Sr for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:45 -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 1rdhKK-0006ll-JN; Fri, 23 Feb 2024 20:59:44 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKi-0003fS-BS; Fri, 23 Feb 2024 21:00:08 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 11/12] Split generation->boot-parameters out of profile->boot-alternatives. Resent-From: Felix Lechner 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: Sat, 24 Feb 2024 02:00: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 =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873997813886 (code B ref 69343); Sat, 24 Feb 2024 02:00:08 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:38 +0000 Received: from localhost ([127.0.0.1]:36582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhKD-0003br-TL for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:38 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:41018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJm-0003Ye-Tt for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=MD1y2I360PM4KNJ xEsOQSlUegSfyM4yZtDQwM1m0ha4=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=Pg7+mAiCz+oYt4GLSC81S7ees9vOqU9FKdEI5DjZ fkJ/Kg6rP+WPRu7GorYyRcYCemlENuF0ra4uoCtfEDR3u4+Hp6N+5gd3rF65ZsOoOmue4+ KInbZMd15evkkFRK5S2vdyObbC6dAI8zyvqGBnDT/1175PiMY6W/nrMXjps4c= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id c4ab977b (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:57 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 4dd50758; Sat, 24 Feb 2024 01:51:57 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:44 -0800 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 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 Sat Feb 24 01:51:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 60953 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 C2F0C27BBE2; Sat, 24 Feb 2024 02:00:27 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 678F727BBEB for ; Sat, 24 Feb 2024 02:00:24 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdhKR-0004U2-Rq; Fri, 23 Feb 2024 20:59:51 -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 1rdhKL-0004Ql-0E for guix-patches@gnu.org; Fri, 23 Feb 2024 20:59:45 -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 1rdhKK-0006lp-NP; Fri, 23 Feb 2024 20:59:44 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdhKh-0003ev-5Y; Fri, 23 Feb 2024 21:00:07 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH 12/12] Encapsulate to retain generation, system-path and epoch. Resent-From: Felix Lechner 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: Sat, 24 Feb 2024 02:00: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: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.170873995513816 (code B ref 69343); Sat, 24 Feb 2024 02:00:07 +0000 Received: (at 69343) by debbugs.gnu.org; 24 Feb 2024 01:59:15 +0000 Received: from localhost ([127.0.0.1]:36549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJq-0003ad-SG for submit@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:15 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:41018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdhJm-0003Ye-04 for 69343@debbugs.gnu.org; Fri, 23 Feb 2024 20:59:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=47VmDdzPyRcCeXb rRFTGuJwF+jJhlB91vKOm+qu4pyQ=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=RLRxHnuzPnzLdoyLyc+acwXJqOX52Euk+6uhIedH XBycuUllKjlgSk2trkR0KPWAVK0B1X022xVMF0/w9cjcCci07P3G/lby2Hk+IAXlXKwe+e +qV7EYk7Xj5HsorhZ386o6PFJ5+DnDLSWirOTqZoi357wqbtGqzasdALUVqzQ= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 713d875d (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 24 Feb 2024 01:51:57 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 0dd6cad5; Sat, 24 Feb 2024 01:51:57 +0000 (UTC) Date: Fri, 23 Feb 2024 17:51:45 -0800 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner 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 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 f5342e06ca..46aad7eeaa 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -65,6 +65,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 @@ -271,6 +278,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 (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 diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 7f6ba20ef9..8e1f6e8f06 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 generation) + (system-path system-path) + (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)