From patchwork Sun Aug 4 03:13:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lilah Tascheter X-Patchwork-Id: 66644 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 D88DD27BBEA; Sun, 4 Aug 2024 04:17:45 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 135A527BBEA for ; Sun, 4 Aug 2024 04:17:42 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjw-0003mM-Hz; Sat, 03 Aug 2024 23:17:00 -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 1saRji-0003kM-Is for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:50 -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 1saRji-0002QA-8S; Sat, 03 Aug 2024 23:16:46 -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=6LoXyj9UOcexnup6hT4O6jhziYxcYAq98lt6s/cozcc=; b=JR2IJ+aeLmf3TrvQyb8NUC3lK1EXvWJFP4j0aTVXGYs3Kb53GEa6cOa8ES3CHbgJ0uecOxoMFAYjxGhXuQJSoYX1zOShzlsJBgDA5VUNqtbENggWQYonklq+y93pde/TiC4AFn39dJiknW3S233+Ax9/IbvqTQU8cv8349wbMS7m8BkL2dcPhccIKHOnyZWOqA2pexZuj/Z34XdsC2ZScJMguyDp13dGZ5JADFqz9j5zbyViICXHKIYpV3u6CDKoK6/NtmGpKpX4WHLorfOlFZhRrwjuaWvev1o6T91Qv5FYBbuJRYTUSR3pbe8uyPsNI6Y5qJF2Hmt9un9n7+3Ygg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk1-0007nr-I2; Sat, 03 Aug 2024 23:17:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 06/12] Offer a uniform decorated-boot-label and use it. Resent-From: Lilah Tascheter Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sun, 04 Aug 2024 03:17:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69343 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69343@debbugs.gnu.org Cc: Felix Lechner , Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.172274139829786 (code B ref 69343); Sun, 04 Aug 2024 03:17:05 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:38 +0000 Received: from localhost ([127.0.0.1]:55007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjZ-0007kJ-KD for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:38 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:51806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjX-0007jW-I3 for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:36 -0400 DKIM-Signature: a=rsa-sha256; b=YWXon0l1i47J4x8o/ysxps2DDy1sdjpRFwkHSxHoje2Dmt/Sp6KMyUxfBhAouzKeXtQNccfBrQHVJTRGvsjbaRUf0WU+RtN7IEfg3TBrcwB1l5Ru1Jk7Vuo9LTGG8e7vL5ZbdkAuQJfS61QM5+U2+0W/Kxw8ApMrPy98phcBTyqXqJKw+XwdyDF56PnuYOXg/t1Dg8+JM1f0glHO3R53ecLtPULzt+nWVOHE1jLGEgL3oJI49SEqRlj/iCUpLgCVU8OJ8Igjl7aOtryuihMYi+ezzltGJjBqfAGImemmtlSOnxn3GC3U/dsGt6fXPKLQw/LHMxBgyWWrTwjIcCbIjg==; s=purelymail2; d=lunabee.space; v=1; bh=fU4zrS3h+RESWGPofXsOm6UJWY6GaeME8xd4jKqnYus=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=DhnSa8QVVsVDa6xyGvjdBobFM3gYy5tXyUS9N/ujn/2QhShCpuwRSSGUoImGGHzqyPNkyoYQID1V+/6HC02AdoeECS5a69vsxa/6Y27PnIG1kXoh6dj4lCmrqQEAz/lMN/Vgqd+DQ/tiz0Hqw+dhGPwsrrGTf6/bEZehQ7/9A5FFGhFhRW+7rugO88nnWYMvUQJOPHogze5WIwjWjzPY2oGg8ttwP4Jk4LQvGoanuoy9koytuMP6plYNQIt5o/jYOZB818IasBWqnAVARVRNDtV8x1tEskdcRT+1y0FsrcAKVJar943H7VXkeNh5vWejY+qR2M5KPToh/1yHjwh0/Q==; s=purelymail2; d=purelymail.com; v=1; bh=fU4zrS3h+RESWGPofXsOm6UJWY6GaeME8xd4jKqnYus=; h=Feedback-ID:Received:From:To:Subject:Date; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -2124817350; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 04 Aug 2024 03:15:38 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:28 -0500 Message-ID: <1cd48d746543091532044ffa979cacc17f725cc7.1722741214.git.lilah@lunabee.space> In-Reply-To: References: MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lilah Tascheter via Guix-patches From: Lilah Tascheter Reply-To: Lilah Tascheter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Felix Lechner * 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 e68e64527e..3971469e33 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -457,15 +457,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 01e3a965e4..b1302b8786 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -72,6 +72,7 @@ (define-module (gnu system boot) bootable-kernel-arguments epoch->date-string + decorated-boot-label boot-parameters->menu-entry ensure-not-/dev @@ -304,6 +305,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 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)