From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.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 GCBGHYzL6mVyNQEAe85BDQ:P1 (envelope-from ) for ; Fri, 08 Mar 2024 09:25:48 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id GCBGHYzL6mVyNQEAe85BDQ (envelope-from ) for ; Fri, 08 Mar 2024 09:25:48 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lunabee.space header.s=purelymail2 header.b="a/mtnkgk"; dkim=fail ("headers rsa verify failed") header.d=purelymail.com header.s=purelymail2 header.b=GUsx9cuA; 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=1709886348; 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=nEzbkAxZE4hBIrVve6EKn153TvWoJ+456+6QXxqEcgQ=; b=UZ2Fn+Hdz3Oc6+8okQSq2slsAq8CnASm75v4X+PvdnT88YhvhJG8/6cLeaWdSFK+IF9d2H YS7ekg6EZC4NUXAFBVW2MaKyktB97feyeBYuziDtF5+dAamXtPQ6IaRj5+dWx6PGIIRwvn bDlNdo9zS1UIQpYpKc6VIsx1lVDbMUb1KREoAMkmQ48kyRSVOMk8aR3Xe6v9vwIe98AQyO Fd30hGl1EQh9eSjAA36IcpObRdZzLb1mU5CFFoJl1MkpwG0pZTNSuq3bpu9R4JnR51Wf7l Bw/ESMwA+zFCTlsYPAKc4FWb0WbMW5nTm04JC1rmhG79fzQKOobl2RhX2gbrHw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lunabee.space header.s=purelymail2 header.b="a/mtnkgk"; dkim=fail ("headers rsa verify failed") header.d=purelymail.com header.s=purelymail2 header.b=GUsx9cuA; 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=1709886348; a=rsa-sha256; cv=none; b=FSZFrkMzUeIqk/aYbP6915dEmqTMX/to3yqUr2ARK7WO4Zh8MK2hnNa8+rkWvDYorvSaVa FWrEzVxNmdIsZ1Pn8W+Ddy51zOuP1I6JKszAWeodg7oYaEYx+D5tI5mnSiRncXrzlF+cYV LbD7gQZC/xder/GvaZQq3A+RGseaT4gidgMFxRAVzEIfDVc/SQ37gzqRBYLLEuXGsgOqJm 44Kw03U5s5fT3gxlz+iiomclM6pTRrIfgaunneaFEtZDHMLJrC37utnOaTayiNL9AW2FhP JziVOst0Azc9M1VhdoPQn8T9rxW89Xln/3mWeYRRAsMHQoBel0+flBiOiMOMiA== 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 25F2346200 for ; Fri, 8 Mar 2024 09:25:48 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1riVXx-0003wW-KF; Fri, 08 Mar 2024 03:25:41 -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 1riVXr-0003tx-1f for guix-patches@gnu.org; Fri, 08 Mar 2024 03:25:36 -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 1riVXq-00018A-PO; Fri, 08 Mar 2024 03:25:34 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1riVYK-0002e2-JG; Fri, 08 Mar 2024 03:26:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v2 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, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 08:26: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 , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic Court??s , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69343-submit@debbugs.gnu.org id=B69343.17098863369983 (code B ref 69343); Fri, 08 Mar 2024 08:26:04 +0000 Received: (at 69343) by debbugs.gnu.org; 8 Mar 2024 08:25:36 +0000 Received: from localhost ([127.0.0.1]:56397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXr-0002aq-DF for submit@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:35 -0500 Received: from sendmail.purelymail.com ([34.202.193.197]:44438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1riVXl-0002ZY-Rj for 69343@debbugs.gnu.org; Fri, 08 Mar 2024 03:25:31 -0500 DKIM-Signature: a=rsa-sha256; b=a/mtnkgkfR/0eO3QiWJRxvHMOyodg5X5B+DJf6x3uBi8VwO3SUwDjBwtWqxqnodMsVVn16RqvORVnLoUiBfmhqS6FaaJKahVm/cneqfHprFICnyyqou/j6PPbWU2lyFyzRaf3yghLD0wSOMlunxL0OiKUKh370kIwX3TPDYgStRG2tk3kpb642NJTkes25iNomK+Ml+hr2cJk3iDLsn34kDs+rKvZK+uyo5gY/Tp6WaN7bTAxJJQ0LSr8s8lM0EYqyXISznbF0liQGxcaZBZ4pz1qkrRvSI46ONnJez02tY9YqxVL/RXbWAUwNRGAFufV+cvZsUL1kEIeazPw6ZtZQ==; s=purelymail2; d=lunabee.space; v=1; bh=8pgH/zbPYXM0QMGXUemLtKnPF06UTcb0u9vzXSKrLN0=; h=Received:From:To:Subject; DKIM-Signature: a=rsa-sha256; b=GUsx9cuALA7aHLV3omLNVwySEA5Bgzfw0S9NQTTVTwH7GaUzSlPzxhXGsjov2T87Z7B4rO183CQQed+LJyNliW+TlYEVKRp1XIsTuU9v3lgRJQN/h9DpUlfzt50xB0H//BITIddoxWa0+fPyDkwCJSTcCd67C0+pE1Dj9fznvo5LhsNAUIXfXwps1IOEffQqU3wF4a2xJ4hZez/Ac2f8bqVIBwjF5vmOKb+oV2nE8k1bVfMTPVPU3lV44IIzHuKv8Xgo8kYGw36IgJe4LcL8nD+Z7Q6dGMgUsbjDeEHiHXig6+F3EUacH9sZRpgBDAnafpfQvxsQiYld2ebQzqPmgw==; s=purelymail2; d=purelymail.com; v=1; bh=8pgH/zbPYXM0QMGXUemLtKnPF06UTcb0u9vzXSKrLN0=; h=Feedback-ID:Received:From:To:Subject; Feedback-ID: 8937:2070:null:purelymail X-Pm-Original-To: 69343@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 637763825; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 08 Mar 2024 08:24:19 +0000 (UTC) Date: Fri, 8 Mar 2024 02:12:01 -0600 Message-ID: <7adf6f188991d9d7052adb0056c0fb8b618c5059.1709885528.git.lilah@lunabee.space> 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-Spam-Score: -5.28 X-Spam-Score: -5.28 X-Migadu-Queue-Id: 25F2346200 X-Migadu-Scanner: mx13.migadu.com X-TUID: Gss44zpoGdvp 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 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 "/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 @@ -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 ver= sion) diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index a3b9cce7d2..972f83febc 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) @@ -69,6 +70,7 @@ (define-module (gnu system boot) read-boot-parameters read-boot-parameters-file =20 + epoch->date-string boot-parameters->menu-entry =20 ensure-not-/dev @@ -274,6 +276,12 @@ (define (read-boot-parameters-file system) (kernel-arguments (append (bootable-kernel-arguments system root vers= ion) (boot-parameters-kernel-arguments params)))= ))) =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 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))))) =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))) @@ -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) --=20 2.41.0