From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id wJTOLLJN2WUQTgAAqHPOHw:P1 (envelope-from ) for ; Sat, 24 Feb 2024 03:00:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id wJTOLLJN2WUQTgAAqHPOHw (envelope-from ) for ; Sat, 24 Feb 2024 03:00:18 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=Pg7+mAiC; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708740018; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=AWnRGmIvp4voDVEaK8PxI+jNmJUoVytHNW9PaJes/JU=; b=hpJBjoznoNPwQxoNG3DhlNDfNMneGlsmKkxT8LeQAWlGRJKDivOgEdiZVe4gE2XGKRPsQp KSa6Takz0FIGG6sTb+SI5uFXqyT0eiKp7PAgLmUtI4c6Ul0Zl6epOSiDDjcI31riUICTvL ClmCVRgh2Nh1v3ldR+rl7d9/D4KYoq5fXVtcH0okfiFRoxxbp94NYftTnujgd2J3GsBTON E8g2htCFAXFH5o9A1b+6rzitUihlZRlymoX24fjZBBt0nGCTVIvhZTi19hGKu/zi632qQd YNHPKti3py6B8f9fPhCMEycubaxGRVetR9H22Hkc54DCUzbfLLHdsk3SR8pQtQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=Pg7+mAiC; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708740018; a=rsa-sha256; cv=none; b=B1o71tVUkV+rjxdyAe3HF+SoW+Vj4sxdQLSJBq5uL2Fqi2hcx3ithsQAMD9ghDfDyFU84l dbOCZTrjfMq0Zav4vhRfSPQvgAqkgH6b9Q/y8qNGtkgapYcjGEmBpBa5c2Y8kty+wad3Jz HJTpblD9Q8V+9qIymqsnNJYu9B3W2igMAjMUXXu5yCOsQ9dTxOUP9673u+7Z5Nb4DaLj6X w+kRgORFn9zclY7vmAWBxDt5YeW3ptPH3sEfpgF0XmERmKp26m+re26SCA7Sy6DKA4j6wj rSPHWvFbxcm5FTzritSp01qpqFXkSIeVH3uHdtkWAt0uEIeGCJMQITruypMIeQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A5B5D15C67 for ; Sat, 24 Feb 2024 03:00:18 +0100 (CET) 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 Content-Transfer-Encoding: 8bit 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 From: Felix Lechner via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.77 X-Spam-Score: -4.77 X-Migadu-Queue-Id: A5B5D15C67 X-Migadu-Scanner: mx13.migadu.com X-TUID: h4CIJa9JeLYz 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 -- 2.41.0