From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id GDQ2LRaf7mZnOAEAqHPOHw:P1 (envelope-from ) for ; Sat, 21 Sep 2024 10:25:26 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id GDQ2LRaf7mZnOAEAqHPOHw (envelope-from ) for ; Sat, 21 Sep 2024 12:25:26 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=vU+EbqRy; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b="k4S4f/z+"; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1726914326; 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-type:content-type: 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=vmkvk3CV8fWlh/vuzi8ThlKTTK4EJQFZPqNcin3KiIY=; b=rryzhAltIZjPRXxwqnjxsesGYOhzqRDBsEPPgwmDfWQ6DMv/0pvZCWSpgVHVmZ8lXy2CH8 Vzg+JrnRZpM9yAUH5mA1sn3HUyvECr3blCVruOUrIMjWjxYrWyMwAypDJrXcw+sxDTo/z8 d7c4F71ytBNC1OGLbHLvKaquhnCuwCUE0Qec58FPDgT4t8yGVwLBCA/HEFVYuLcEd9yQwh vIHpnnx/qzkat2T72ttMAdPUXQVFAdmBn6OyaebhljNZfqsi6LYFImpVNgscM/hmYo9d45 m2gQPmb2i24AmAzkwuFbzfEZmgfs6bL5pX5Phj2V0wo5VNaHfMbUZgHmbYi3lg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=vU+EbqRy; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b="k4S4f/z+"; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1726914326; a=rsa-sha256; cv=none; b=jIlUn0u6rpB6kKqWDw5LJwerz4vllIbuEzWrJw5SqzxNnYJSXC2CIP1T9wrhpzRoJSijWK pUmfaSpx1lavyYC92yESW9cIvrt/gVrkbneilfGS5uvfsrpxSuGThjVkTKbfZY5jU9/V1Z I9lTYv4yB40YDFfYAooYv7LwziPmbLjsQX5m0UGjLRNBVo89hD1bG6Ey9qavIErbiYMD+U 9CbSPpSN6+hrw1cfZIBr6hLvoSdIwzk+dxDF8yRPiP+8R8k3CvmTEtdc5gotKeyjAWj87U V0Z6JNuGVx3xQ5l84e4Go1SkqiCWlvJIII4EE2BRt2j1+sSoOWHSWd29yHrmcg== 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 59D7D68D00 for ; Sat, 21 Sep 2024 12:25:26 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srxIG-00005W-E9; Sat, 21 Sep 2024 06:24:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srxIE-0008W0-5F for guix-patches@gnu.org; Sat, 21 Sep 2024 06:24:47 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srxID-0004ck-S6; Sat, 21 Sep 2024 06:24:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=vmkvk3CV8fWlh/vuzi8ThlKTTK4EJQFZPqNcin3KiIY=; b=vU+EbqRy6IXOzkROvpBeXgHuoQ98CiE/dkutNUJJyIbe8JzQ7w2VOj8vOtobfcLNViNfwN/wx6e0kDfyRNCz9++JFlJ6HkCFuMtlisAFJKXLjm6l5nhxyHlTsO7K8XmujuPz7iHvLzq7+PBUQJx8tiGsxArD35Au9sK33Sks4SsKYBndx/DsbF4USqrahdHuT1tPiFlXEkGAsEZ271ES9IOxBadQIwRy7RbyQ9ztswgit72LMaeL184Lo6qxdbWMrqeWEu4DuHBw/tOrwU6v61esa1hMiybbvc/iXMpOKXkUw/2c6Mre4KRFYHeYuN/IvO/JPueVAVWsoJB0jCx3+A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srxIW-0005pB-OT; Sat, 21 Sep 2024 06:25:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v5 05/10] Offer a uniform decorated-boot-label and use it. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2024 10:25: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 , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172691429322301 (code B ref 69343); Sat, 21 Sep 2024 10:25:04 +0000 Received: (at 69343) by debbugs.gnu.org; 21 Sep 2024 10:24:53 +0000 Received: from localhost ([127.0.0.1]:37294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srxIK-0005nX-Gf for submit@debbugs.gnu.org; Sat, 21 Sep 2024 06:24:53 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:57083 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srxIE-0005li-Ku for 69343@debbugs.gnu.org; Sat, 21 Sep 2024 06:24:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1726914253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vmkvk3CV8fWlh/vuzi8ThlKTTK4EJQFZPqNcin3KiIY=; b=k4S4f/z+8unbKZAegYatspSEgjQ3xxYjDuYp05N+KIyzDLhw3ttP1xBseX29hbgDox1TrK a5P61EC/+VcoCiMk+5q2CuPLOSWhPGGKEIln1MG4Hed7nbdsi61wQGGAkSKOq+A8Xrupr5 6SHzaGc/mp6O1rEdySmxfzCEkKk3MKrM4ZNgE5DnOLE3+Jwoq2PNahrCPoKBZj71erJYdy Nz2Crp8zZMQ097c/3Efjx90f8s+t9MKuoF5OFal8CiCpcGkkYUFGvfaR7G53EH9k3oT3KS URECTaT2oHdjaRd12PNCP59KSa99IomXTKvoL+4/PhsbiVn1nlcNg2GwAM30ZQ== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 6784f214 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 21 Sep 2024 10:24:13 +0000 (UTC) Date: Sat, 21 Sep 2024 12:23:18 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches From: Herman Rimm 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-Queue-Id: 59D7D68D00 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -5.51 X-Migadu-Spam-Score: -5.51 X-TUID: 5PNojqJj9kMA From: Felix Lechner * gnu/system/boot.scm (decorated-boot-label): New procedure. * gnu/machine/ssh.scm (machine-boot-parameters): Use decorated-boot-label. * guix/scripts/system.scm (profile-boot-parameters)[system->boot-parameters]: Use decorated-boot-label. 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 86c21256eb..3a0116ac0d 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 c1d58a2743..1e0d75212f 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -10,6 +10,8 @@ ;;; Copyright © 2020 Janneke Nieuwenhuizen ;;; Copyright © 2020, 2022 Efraim Flashner ;;; Copyright © 2024 Nicolas Graves +;;; Copyright © 2024 Felix Lechner +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -66,6 +68,7 @@ (define-module (gnu system boot) bootable-kernel-arguments epoch->date-string + decorated-boot-label boot-parameters->menu-entry ensure-not-/dev @@ -298,6 +301,16 @@ (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 ((count (and generation + (string-append "#" (number->string generation)))) + (timestamp (and=> epoch epoch->date-string))) + (match (filter identity (list count timestamp)) + (() text) + (extras (string-append text "(" (string-join extras ", ") ")"))))) + (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 b197812e63..84eb99b938 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -337,12 +337,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) -- 2.45.2