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 sK7MLiyf7mby8wAAqHPOHw:P1 (envelope-from ) for ; Sat, 21 Sep 2024 10:25:48 +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 sK7MLiyf7mby8wAAqHPOHw (envelope-from ) for ; Sat, 21 Sep 2024 12:25:48 +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=KTxJSSZU; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b="n6j8pf/I"; 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=1726914348; 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=zfO9KDsRlI74OquUb/76tSbvQjvIYJ2z1nc/qpuZzcs=; b=Q35CUoUAmeQoEjQ1DaXWVYzTrm3y0Ncx21aWv2QdPiUbQjAZpICHNjgrt/8SFqKHIBlDTV R6bviEV06TB9AUu4zYwzbiT2qjiCd/Wtln6OSaU3IBXxgZVX6BkoLvdnav0ThBhSzsgPo/ YeyD6C5I6WrfWVapcHFTZbZELoQujy8mBrPbXv5IR0Ue1tzKVHc0d2C8lhvXZA0bQMPIqg qhrXGa6m4SYXXjIo6erFiapopeLMybMsb8Fd/W/uhrPzm/sdosO7M/DwgyKOpPcOdg0bjZ 6S1uSDqAgQBi/YPfgnkTxVQ3soOOUSr5KJr34L29BpH6SZmcfSp2X45EuWkGaA== 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=KTxJSSZU; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b="n6j8pf/I"; 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=1726914348; a=rsa-sha256; cv=none; b=KvHnjN3RBQNi6bY6EzBzF+QR0NC5rdHwOOTF3gCn6+Ex3pKFmCqGUIt9vsvl6iETejHqA3 VzEL+dUg9x59Jix4+n7kPId1Tb4DHcbHdX3XlVqwF/2s5wof42/jAWjMc3YXC2FsEe644Z OHCQRfRt0rgv6pAiOr6eMydkgqYu36wBCra8WyNBzbQUDTnQJKlOM5C/ZOS6pQze1TXNnR yvvshpsSVsciFwmoUYbgQXQpaCNKViKjKobpZtE7xYvdE1ArgzslxjixFOLkSoW08sqAkY mTsnxW0MhQxMjxCGGRhVQsGM2Ma1MPFclTBxOLYGxRT1J5CLGeqk1HCu1/GooA== 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 828CD68B47 for ; Sat, 21 Sep 2024 12:25:48 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srxII-00007X-55; Sat, 21 Sep 2024 06:24:50 -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 1srxID-0008VO-Df for guix-patches@gnu.org; Sat, 21 Sep 2024 06:24:45 -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 1srxIC-0004cT-Th; 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=zfO9KDsRlI74OquUb/76tSbvQjvIYJ2z1nc/qpuZzcs=; b=KTxJSSZUNzb3LYb/EY2covxcK3Yd76qDfXYFAcfIuOafsjY6/kkFaU5+mnNO9j4Kk/MlNL1c0v9rRaSian9imlvUdTWX+b9+rTTn5zX2MgXXles8Y5H06oHOUPARhjZ5AOsoEvITjVCn6GEI3LlF1xZLTUfmz8bYS6/cN+nd/+itNZTEw1blHN1dtVyfZgiP2vVVW516OllG8gGonaczq0ZiP3puf6oE2EGTt5svDNgwFzXW/Ou239fu96lA9E2z6v5g1uuAV9e7LVTcsvoBj76LExSbZl44N0mqshiUBp1xtJbjPSIxY+7RwEQ+hEHokyvo+wF6t4EtHNWv3aWGgQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srxIW-0005p0-AE; Sat, 21 Sep 2024 06:25:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69343] [PATCH v5 04/10] Move epoch->date-string to gnu/system/boot.scm and use it elsewhere. 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.172691429222294 (code B ref 69343); Sat, 21 Sep 2024 10:25:04 +0000 Received: (at 69343) by debbugs.gnu.org; 21 Sep 2024 10:24:52 +0000 Received: from localhost ([127.0.0.1]:37292 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srxIJ-0005nP-W1 for submit@debbugs.gnu.org; Sat, 21 Sep 2024 06:24:52 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:42255 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srxIE-0005lr-JI 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zfO9KDsRlI74OquUb/76tSbvQjvIYJ2z1nc/qpuZzcs=; b=n6j8pf/IJnk/px4aNQypncWcZfxpJHR0qxoocHm9c1hilYa4rxwL8R1jZDgxLaVaCCO04L 4pfeg75bIrMmrjBj6R5MNucJLi8Hts0M6iCZyQFgagWoANS4sTVQIGBjpf2AlCatxb12lC Qt0MyE8x/0PebTjEH8zLj8BbsVlUC0OW012RznyZsycERFN4gJkmaPB/tDq6QolQBI2ax9 wz9ZbQ5yfjr12qmtBMqkgXZt9EkWVGMvJ0AvE4LxH6PM8DZ8vMVwXzpaMf0/2zIGjI6zH9 8oqq2BjlulIPcsjD8U83ufhr4+cniiLLWK6OmYJDnQjjD025/XgCaV8i+U7hdQ== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 84e07e6e (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 21 Sep 2024 10:24:13 +0000 (UTC) Date: Sat, 21 Sep 2024 12:23:17 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 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: 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: 828CD68B47 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -5.01 X-Migadu-Spam-Score: -5.01 X-TUID: e3AdEsG3QOzl 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 863c28a13c..86c21256eb 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 "/parameters")) - (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))))))) @@ -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 version) diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index 2c531e4ad5..c1d58a2743 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -39,6 +39,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) @@ -64,6 +65,7 @@ (define-module (gnu system boot) read-boot-parameters-file bootable-kernel-arguments + epoch->date-string boot-parameters->menu-entry ensure-not-/dev @@ -290,6 +292,12 @@ (define* (bootable-kernel-arguments system root-device version) #~(string-append (if #$version>0? "gnu.load=" "--load=") #$system "/boot"))))) +(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))))) -(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 specified by NUMBERS, which is a list of generation numbers. The list is ordered from 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) -- 2.45.2