From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id MFMRDNjyrmbRNgAAqHPOHw:P1 (envelope-from ) for ; Sun, 04 Aug 2024 03:17:44 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id MFMRDNjyrmbRNgAAqHPOHw (envelope-from ) for ; Sun, 04 Aug 2024 05:17:44 +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=b+DkXqOw; dkim=fail ("headers rsa verify failed") header.d=lunabee.space header.s=purelymail2 header.b=q45eCk3k; dkim=fail ("headers rsa verify failed") header.d=purelymail.com header.s=purelymail2 header.b=qIRbQS1V; 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=1722741464; 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=GkXQmKfGKePQaC1SQcLmSTKCPVMRu4FhXICXbMjDOng=; b=f3iXY4070i3gHKQZC9zbT8iUh5VImnT+tEqAMI72KMWg8gs2DbQJ25+17myP5ibP5L2ujz ySy5AwA82ThMbvity+YJPf3XO4Jz56xw4E9GJaMa+WI4awJiM6S/JIMbLgvjEuk1OhNTVJ GE22YVvyx+ZoDVfqpG/uHjsafG8Gljb3dd9PKlPVQQs07qWDmLkrRUb/EaHMAtrPCWMS4l VMTsLoRgI49lpNoPok3Iq6gIf5v5SwwjGXW+5RA3fg8cB3qO4RzK31h/l7YresjIVXqBzk /hGexycSkIjSZIN0aax808XLRNLY3MnegSNu6ldt+aTyHfCOpNrrKUdF7MCeAw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1722741464; a=rsa-sha256; cv=none; b=Zgn5R0Fi9QLCeSgRjDGY71/sHAB8+l41aLnM2RpH873eRqxhd4SUxzV5FX2Qn4lsikg16P BXlKglqzm9OJiNkyiAgwZ3GsXmPXYXt6IOCHF6xtg50K8fJUnsXFGnL3UrVYQ4aG116XJY OW3lPR9voIlCLFZp8g0TmJiC049copdVkDO83VFBm9DNZunftl6qw81auROvhsupdPQqlE esdxL+ZyWtFXxMdVqYuXkSooUAvMTiZbPBBII/i/Yk2dN6GTI4i/U93lObQwCaqTK5KpLy 9qmyc3xg3zse0kNAh8OjWET+zZf0OuHwNXg4kyzhG3Y+UtL2rAvAJq1eB7EcNA== 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=b+DkXqOw; dkim=fail ("headers rsa verify failed") header.d=lunabee.space header.s=purelymail2 header.b=q45eCk3k; dkim=fail ("headers rsa verify failed") header.d=purelymail.com header.s=purelymail2 header.b=qIRbQS1V; 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" 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 EC53637199 for ; Sun, 4 Aug 2024 05:17:43 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saRjv-0003lY-E7; Sat, 03 Aug 2024 23:16:59 -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-0003k7-BB for guix-patches@gnu.org; Sat, 03 Aug 2024 23:16:46 -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 1saRjh-0002PV-ML; Sat, 03 Aug 2024 23:16: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=GkXQmKfGKePQaC1SQcLmSTKCPVMRu4FhXICXbMjDOng=; b=b+DkXqOwrmAeH+s/dmrq3hUAduMDjHlxrN1IitkUdRPuynPbdlkOnSGPQqF0ZtS6tTPqrJlh/vsTXtL4OnpVwMpCgwc1WlgD+GIWc8E1M+ZTWnkf7oAsRJK9tMZc/7wIp40XyeAbw9MJzTeMet55jXNiQP+gmEWYUMDusffOzLjOKRGSklqblWWKDCrP32FuFya5Gd85CN+LvFWKHv+8OBRLAuAFJPpZ8nQYF0xnv+/vltT/5FWEg0GOhPetYnBxw5P3uW5zQ2vaKGXxv/l/h9sXaQBsXAGDEFV7CYy9DHq1yLxH0/sj5GHHOXgVfDK6SOJNdpKqGphzV2IO5moaPA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1saRk0-0007nf-Um; Sat, 03 Aug 2024 23:17:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v3 05/12] Move epoch->date-string to gnu/system/boot.scm and use it elsewhere. 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: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 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.172274139629776 (code B ref 69343); Sun, 04 Aug 2024 03:17:04 +0000 Received: (at 69343) by debbugs.gnu.org; 4 Aug 2024 03:16:36 +0000 Received: from localhost ([127.0.0.1]:55005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjX-0007k4-LM for submit@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:36 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:56536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1saRjV-0007jP-Og for 69343@debbugs.gnu.org; Sat, 03 Aug 2024 23:16:34 -0400 DKIM-Signature: a=rsa-sha256; b=q45eCk3kECGfYW+hvIkxhiTpR/E78iUuhibKoz7O+pDCQFmLS78P23LsGPSsmcuYPdN9HXufi3yzN7jp/76by1c5JhX6+OnL8bszqWPwMxgWGl+I156jIxyPpMIdN/i1lstd9Qcv6Mjcqm91lNA6tlQO9dn6ioOL6rVYgAsLDr3Nk1ZXxbQe5UHU59+olCv++B7aenNze78Jvaw3f74b6Ex/l5BsUjwSFffiGN6goq0Vh9eSwVc6n03VbTaM+KViy5796UfkXvTB1/3etbmdUcq3sD4PAspjqV+o2f8aDVXeYnLvNkkgrrQfUiSR5jUrhEY80hIie8rBxwib73Vnxg==; s=purelymail2; d=lunabee.space; v=1; bh=fwzoCc7y6ItU44Puf4gL6wng+1TnmX0zYcUUjQTfsJo=; h=Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=qIRbQS1VNZHJKWiNuEA92m4ikWRisVVRSzvOIVzhoccAUOnitVTEXejW338HtL0YWAH2CNnT1TtlW9SaVwINcIru6GqP7RCMf6BLe3cyRpcEEjxXiJCKMA753jGgJcB7AoFNEyupXQLzbPWkfJsuGcUiOWeHD7S8Lgunfqb0ezTIkrLhaS47ys7N0vbKNUf2cqn6bv/wJvVfNsWxwTtFhNLS3G4sGJM0Cl9wvhZXz8UZeQH2pj7C8Wh8GOkSziFi9e5nsqtlOEaYZyMu7+tahlyF0lPNeP4cSOxq66R3cHh5pr/hHT71c87cYfy/BPpMs08vplcsW8yy8EXP23Esfg==; s=purelymail2; d=purelymail.com; v=1; bh=fwzoCc7y6ItU44Puf4gL6wng+1TnmX0zYcUUjQTfsJo=; 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:37 +0000 (UTC) Date: Sat, 3 Aug 2024 22:13:27 -0500 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by Purelymail Content-Type: text/plain; charset=UTF-8 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: , From: Lilah Tascheter via Guix-patches Reply-To: Lilah Tascheter 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: EC53637199 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -5.44 X-Spam-Score: -5.44 X-TUID: XpNiuF2NaQjQ From: Felix Lechner * guix/scripts/system.scm (profile-boot-parameters): Rename time to epoch to fit new procedure name. (epoch->date-string): Move to... * gnu/system/boot.scm (epoch->date-string): ...here. * gnu/machine/ssh.scm (machine-boot-parameters): Rename time to epoch. (machine-boot-parameters)[boot-parameters]: Use epoch->date-string. 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 749aa2b6d8..e68e64527e 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -442,10 +442,10 @@ (define (machine-boot-parameters machine) generation)) (boot-parameters-path (string-append system-path "/parameter= s")) - (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))))))) =20 @@ -453,7 +453,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)) @@ -464,9 +464,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 ver= sion) diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index df27b8aea4..01e3a965e4 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -45,6 +45,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-34) #:use-module (srfi srfi-35) #:use-module (rnrs bytevectors) @@ -70,6 +71,7 @@ (define-module (gnu system boot) read-boot-parameters-file bootable-kernel-arguments =20 + epoch->date-string boot-parameters->menu-entry =20 ensure-not-/dev @@ -296,6 +298,12 @@ (define* (bootable-kernel-arguments system root-device= version) #~(string-append (if #$version>0? "gnu.load=3D" "--load=3D") #$system "/boot"))))) =20 +(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 cb70d36219..b197812e63 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -328,19 +328,13 @@ (define-syntax-rule (unless-file-not-found exp) #f (apply throw args))))) =20 -(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 speci= fied by NUMBERS, which is a list of generation numbers. The list is ordered fro= m 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))) @@ -348,7 +342,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) --=20 2.45.2