[PATCH 5/5] gnu: Add tz.

OpenSubmitted by Stefan Reichör.
Details
4 participants
  • Sarah Morgensen
  • jgart
  • Leo Famulari
  • Stefan Reichör
Owner
unassigned
Severity
normal
Merged with
S
S
Stefan Reichör wrote on 11 May 20:55 +0200
(address . guix-patches@gnu.org)(name . Stefan Reichör)(address . stefan@xsteve.at)
20210511185554.67355-5-stefan@xsteve.at
* gnu/packages/time.scm (tz): New variable.--- gnu/packages/time.scm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
Toggle diff (52 lines)diff --git a/gnu/packages/time.scm b/gnu/packages/time.scmindex d6ebb59a1e..fbe7a8b5c1 100644--- a/gnu/packages/time.scm+++ b/gnu/packages/time.scm@@ -19,6 +19,7 @@ ;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org> ;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org> ;;; Copyright © 2021 Ryan Prior <rprior@protonmail.com>+;;; Copyright © 2021 Stefan Reichör <stefan@xsteve.at> ;;; ;;; This file is part of GNU Guix. ;;;@@ -540,3 +541,37 @@ calls.") from a starting point you provide. The user can pause and resume the countdown from the text user interface.") (license expat)))++(define-public tz+ (package+ (name "tz")+ (version "0.5")+ (source+ (origin+ (method git-fetch)+ (uri (git-reference+ (url "https://github.com/oz/tz")+ (commit (string-append "v" version))))+ (file-name (git-file-name name version))+ (sha256+ (base32 "1sixfbph5013c9ccx0xqkp9jskg7jr9y29nn9j85q1zmg5by221v"))))+ (build-system go-build-system)+ (arguments+ '(#:import-path "github.com/oz/tz"))+ (native-inputs+ `(("go-github-com-charmbracelet-bubbletea" ,go-github-com-charmbracelet-bubbletea)+ ("go-github-com-containerd-console" ,go-github-com-containerd-console)+ ("go-github-com-google-goterm" ,go-github-com-google-goterm)+ ("go-github-com-mattn-go-isatty" ,go-github-com-mattn-go-isatty)+ ("go-github.com-mattn-go-runewidth" ,go-github.com-mattn-go-runewidth)+ ("go-github-com-muesli-reflow-ansi" ,go-github-com-muesli-reflow-ansi)+ ("go-github-com-muesli-reflow-truncate" ,go-github-com-muesli-reflow-truncate)+ ("go-github-com-muesli-termenv" ,go-github-com-muesli-termenv)+ ("go-golang-org-colorful" ,go-golang-org-colorful)+ ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)))+ (home-page "https://github.com/oz/tz")+ (synopsis "Display time across a few selected time zones.")+ (description+ "tz is a cli tool that displays a given time in several time zones. Use+the environment variable TZ_LIST to specify a list of time zones.")+ (license gpl3)))-- 2.25.1
L
L
Leo Famulari wrote on 11 May 21:13 +0200
(name . Stefan Reichör)(address . stefan@xsteve.at)(address . 48364@debbugs.gnu.org)
YJrXQ5/WP+sQ1Ryv@jasmine.lan
On Tue, May 11, 2021 at 08:55:54PM +0200, Stefan Reich�r wrote:
Toggle quote (7 lines)> * gnu/packages/time.scm (tz): New variable.
> + (synopsis "Display time across a few selected time zones.")> + (description> + "tz is a cli tool that displays a given time in several time zones. Use> +the environment variable TZ_LIST to specify a list of time zones.")
I'm curious, how does it find the time zone database?
It should look them up at runtime via something like a TZDIR environmentvariable. It should not include a copy of the database, or else it willbecome "stale" before too long.
S
S
Stefan Reichör wrote on 13 May 20:59 +0200
[PATCH 5/5] gnu: Add tz.
(address . 48364@debbugs.gnu.org)
87v97mbguc.fsf@xsteve.at
Another attempt to answer the question from Leo Famulari
I didn't get the question from the bugtracker by email:
,----| I'm curious, how does it find the time zone database?| | It should look them up at runtime via something like a TZDIR environment| variable. It should not include a copy of the database, or else it will| become "stale" before too long.`----
Yesterday I tried to answer it directly in the web interface. My answerdidn't show up :-(
Now I try to answer per email

The timezone is determined by the go runtime function LoadLocation:
https://github.com/oz/tz/blob/main/zone.go#L77

LoadLocation does the lookup in the installed timezone database:
https://golang.org/pkg/time/#LoadLocation
L
L
Leo Famulari wrote on 14 May 03:28 +0200
(name . Stefan Reichör)(address . stefan@xsteve.at)(address . 48364@debbugs.gnu.org)
YJ3SNQEUhQhqLnVe@jasmine.lan
On Thu, May 13, 2021 at 08:59:07PM +0200, Stefan Reich�r wrote:
Toggle quote (4 lines)> LoadLocation does the lookup in the installed timezone database:> > https://golang.org/pkg/time/#LoadLocation
Oh, I see. This must be why Go itself depends on (and keeps a run-timereference to) tzdata.
We'll want to fix that someday, but that's a separate concern from thesepackages.
S
S
Sarah Morgensen wrote on 7 Aug 08:08 +0200
control message for bug #48369
(address . control@debbugs.gnu.org)
86tuk1g528.fsf@mgsn.dev
merge 48369 48364 48363 48362 48361 48360quit
S
S
Sarah Morgensen wrote on 7 Aug 08:44 +0200
(address . control@debbugs.gnu.org)
86sfzlg3ee.fsf@mgsn.dev
unmerge 48369quit
S
S
Sarah Morgensen wrote on 7 Aug 08:54 +0200
control message for bug #48364
(address . control@debbugs.gnu.org)
E1mCGDc-0000p4-4T@debbugs.gnu.org
merge 48364 48362 48360 48361 48363quit
J
[PATCH 1/7] gnu: go-golang-org-colorful: Update to 1.2.0.
(address . 48364@debbugs.gnu.org)
20210926084447.2779-1-jgart@dismail.de
From: Guix Together <jgart@dismail.de>
* gnu/packages/golang.scm (go-golang-org-colorful): Update to 1.2.0.
Co-authored-by: jgart <jgart@dismail.de>Co-authored-by: Gábor Boskovits <boskovits@gmail.com>--- gnu/packages/golang.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Toggle diff (24 lines)diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scmindex a96f743f68..a5ce91bb56 100644--- a/gnu/packages/golang.scm+++ b/gnu/packages/golang.scm@@ -5451,7 +5451,7 @@ golang's database/sql package.") (define-public go-golang-org-colorful (package (name "go-golang-org-colorful")- (version "1.0.2")+ (version "1.2.0") (source (origin (method git-fetch) (uri (git-reference@@ -5460,7 +5460,7 @@ golang's database/sql package.") (file-name (git-file-name name version)) (sha256 (base32- "0fig06880bvk1l92j4127v4x9sar4ds7ga8959gxxghb2w70b7l2"))))+ "08c3fkf27r16izjjd4w94xd1z7w1r4mdalbl53ms2ka2j465s3qs")))) (build-system go-build-system) (arguments '(#:import-path "github.com/lucasb-eyer/go-colorful"))-- 2.33.0
J
[PATCH 2/7] gnu: Add go-github-com-charmbracelet-bubbletea.
(address . 48364@debbugs.gnu.org)
20210926084447.2779-2-jgart@dismail.de
From: Guix Together <jgart@dismail.de>
* gnu/packages/golang.scm (go-github-com-charmbracelet-bubbletea): New variable.
Co-authored-by: jgart <jgart@dismail.de>Co-authored-by: Gábor Boskovits <boskovits@gmail.com>--- gnu/packages/golang.scm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
Toggle diff (51 lines)diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scmindex a5ce91bb56..0ab20238e8 100644--- a/gnu/packages/golang.scm+++ b/gnu/packages/golang.scm@@ -3309,6 +3309,44 @@ middleware for Go web applications and services.") (description "Safe and easy casting from one type to another in Go") (license license:expat))) +(define-public go-github-com-charmbracelet-bubbletea+ (package+ (name "go-github-com-charmbracelet-bubbletea")+ (version "0.13.2")+ (source+ (origin+ (method git-fetch)+ (uri (git-reference+ (url "https://github.com/charmbracelet/bubbletea")+ (commit (string-append "v" version))))+ (file-name (git-file-name name version))+ (sha256+ (base32+ "1105cggi5fwqx69m0vrhgwx6kaw82w4ahn58sj0a81603c4yvrk0"))))+ (build-system go-build-system)+ (arguments+ `(#:import-path "github.com/charmbracelet/bubbletea"))+ (propagated-inputs+ `(("github.com/mattn/go-isatty" ,go-github-com-mattn-go-isatty)+ ("github.com/muesli/termenv" ,go-github-com-muesli-termenv)+ ("github.com/mattn/go-runewidth" ,go-github.com-mattn-go-runewidth)+ ("go-github-com-muesli-reflow-indent" ,go-github-com-muesli-reflow-indent)+ ("go-github-com-muesli-reflow-ansi" ,go-github-com-muesli-reflow-ansi)+ ("go-golang-org-colorful" ,go-golang-org-colorful)+ ("github.com/containerd/console" ,go-github-com-containerd-console)+ ("go-github-com-muesli-reflow-truncate" ,go-github-com-muesli-reflow-truncate)+ ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)+ ("go-golang-org-x-sys" ,go-golang-org-x-sys)+ ("go-golang-org-x-term" ,go-golang-org-x-term)+ ("github.com/mattn/go-isatty" ,go-github-com-mattn-go-isatty)))+ (home-page "https://github.com/charmbracelet/bubbletea")+ (synopsis "A powerful little TUI framework")+ (description +"A Go framework based on The Elm Architecture. Bubble Tea is well-suited+for simple and complex terminal applications, either inline, full-window,+or a mix of both.")+ (license license:asl2.0)))+ (define-public go-github-com-spf13-cobra (package (name "go-github-com-spf13-cobra")-- 2.33.0
J
[PATCH 3/7] gnu: Add go-github-com-containerd-console.
(address . 48364@debbugs.gnu.org)
20210926084447.2779-3-jgart@dismail.de
From: Guix Together <jgart@dismail.de>
* gnu/packages/golang.scm (go-github-com-containerd-console): New variable.
Co-authored-by: jgart <jgart@dismail.de>Co-authored-by: Gábor Boskovits <boskovits@gmail.com>--- gnu/packages/golang.scm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
Toggle diff (38 lines)diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scmindex 0ab20238e8..e4bacfc92a 100644--- a/gnu/packages/golang.scm+++ b/gnu/packages/golang.scm@@ -3347,6 +3347,31 @@ for simple and complex terminal applications, either inline, full-window, or a mix of both.") (license license:asl2.0))) +(define-public go-github-com-containerd-console+ (package+ (name "go-github-com-containerd-console")+ (version "1.0.3")+ (source+ (origin+ (method git-fetch)+ (uri (git-reference+ (url "https://github.com/containerd/console")+ (commit (string-append "v" version))))+ (file-name (git-file-name name version))+ (sha256+ (base32+ "0pgx0y8x23jwc2f9jfk5hd5aslqk599nj6c7dj5846xvnkz2x7p2"))))+ (build-system go-build-system)+ (arguments+ `(#:import-path "github.com/containerd/console"))+ (propagated-inputs+ `(("golang.org/x/sys" ,go-golang-org-x-sys)))+ (home-page "https://github.com/containerd/console")+ (synopsis "Console package for Go")+ (description +"Golang package for dealing with consoles. Light on deps and a simple API.")+ (license license:asl2.0)))+ (define-public go-github-com-spf13-cobra (package (name "go-github-com-spf13-cobra")-- 2.33.0
J
[PATCH 4/7] gnu: go-github-com-muesli-reflow-wordwrap: Update to 0.3.0.
(address . 48364@debbugs.gnu.org)
20210926084447.2779-4-jgart@dismail.de
From: Guix Together <jgart@dismail.de>
* gnu/packages/golang.scm (go-github-com-muesli-reflow-wordwrap): Update to 0.3.0.
Co-authored-by: jgart <jgart@dismail.de>Co-authored-by: Gábor Boskovits <boskovits@gmail.com>--- gnu/packages/golang.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Toggle diff (24 lines)diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scmindex e4bacfc92a..25bf8c6972 100644--- a/gnu/packages/golang.scm+++ b/gnu/packages/golang.scm@@ -7204,7 +7204,7 @@ transforms one JSON document into another through a JMESPath expression.") (define-public go-github-com-muesli-reflow-wordwrap (package (name "go-github-com-muesli-reflow-wordwrap")- (version "0.1.0")+ (version "0.3.0") (source (origin (method git-fetch) (uri (git-reference@@ -7213,7 +7213,7 @@ transforms one JSON document into another through a JMESPath expression.") (file-name (git-file-name "go-github-com-muesli-reflow" version)) (sha256 (base32- "1vhynm2n1az13fn03lp0gi28p9mznq1mblglh8f2rb9y1vkd2dqr"))))+ "09zcz2cqdwgj1ilya5pqwndryk6lansn87x63fcm8j1xn74vd2ry")))) (build-system go-build-system) (arguments `(#:import-path "github.com/muesli/reflow/wordwrap"-- 2.33.0
J
[PATCH 5/7] gnu: Add go-github-com-muesli-reflow-truncate.
(address . 48364@debbugs.gnu.org)
20210926084447.2779-5-jgart@dismail.de
From: Guix Together <jgart@dismail.de>
* gnu/packages/golang.scm (go-github-com-muesli-reflow-truncate): New variable.
Co-authored-by: jgart <jgart@dismail.de>Co-authored-by: Gábor Boskovits <boskovits@gmail.com>--- gnu/packages/golang.scm | 8 ++++++++ 1 file changed, 8 insertions(+)
Toggle diff (21 lines)diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scmindex 25bf8c6972..3e89a27b6d 100644--- a/gnu/packages/golang.scm+++ b/gnu/packages/golang.scm@@ -7226,6 +7226,14 @@ transforms one JSON document into another through a JMESPath expression.") io.Writers helping you to transform blocks of text.") (license license:expat))) +(define-public go-github-com-muesli-reflow-truncate+ (package+ (inherit go-github-com-muesli-reflow-wordwrap)+ (name "go-github-com-muesli-reflow-truncate")+ (arguments+ `(#:import-path "github.com/muesli/reflow/truncate"+ #:unpack-path "github.com/muesli/reflow"))))+ (define-public go-github-com-muesli-reflow-ansi (package (inherit go-github-com-muesli-reflow-wordwrap)-- 2.33.0
J
[PATCH 6/7] gnu: go-github-com-muesli-termenv: Update to 0.8.1.
(address . 48364@debbugs.gnu.org)
20210926084447.2779-6-jgart@dismail.de
From: Guix Together <jgart@dismail.de>
* gnu/packages/golang.scm (go-github-com-muesli-termenv): Update to 0.8.1.
Co-authored-by: jgart <jgart@dismail.de>Co-authored-by: Gábor Boskovits <boskovits@gmail.com>--- gnu/packages/golang.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Toggle diff (24 lines)diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scmindex 3e89a27b6d..83791f4de2 100644--- a/gnu/packages/golang.scm+++ b/gnu/packages/golang.scm@@ -7261,7 +7261,7 @@ io.Writers helping you to transform blocks of text.") (define-public go-github-com-muesli-termenv (package (name "go-github-com-muesli-termenv")- (version "0.7.0")+ (version "0.8.1") (source (origin (method git-fetch) (uri (git-reference@@ -7270,7 +7270,7 @@ io.Writers helping you to transform blocks of text.") (file-name (git-file-name name version)) (sha256 (base32- "09fwrdhy7c9qlf70h97f5inh6xvkfq1vi8fwx9q7bwmjjbiykk8m"))))+ "0m24ljq1nq7z933fcvg99fw0fhxj9rb5ll4rlay7z2f2p59mrbdp")))) (build-system go-build-system) (arguments `(#:import-path "github.com/muesli/termenv"))-- 2.33.0
J
[PATCH 7/7] gnu: Add tz.
(address . 48364@debbugs.gnu.org)(name . Guix Together)(address . jgart@dismail.de)
20210926084447.2779-7-jgart@dismail.de
From: Guix Together <jgart@dismail.de>
* gnu/packages/time.scm (tz): New variable.
Co-authored-by: jgart <jgart@dismail.de>--- gnu/packages/time.scm | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
Toggle diff (46 lines)diff --git a/gnu/packages/time.scm b/gnu/packages/time.scmindex df4b8ac6f5..407b3fe179 100644--- a/gnu/packages/time.scm+++ b/gnu/packages/time.scm@@ -512,6 +512,39 @@ modifies the @code{time}, @code{gettimeofday} and @code{clock_gettime} system calls.") (license gpl2))) +(define-public tz+ (package+ (name "tz")+ (version "0.5")+ (source+ (origin+ (method git-fetch)+ (uri (git-reference+ (url "https://github.com/oz/tz")+ (commit (string-append "v" version))))+ (file-name (git-file-name name version))+ (sha256+ (base32 "1sixfbph5013c9ccx0xqkp9jskg7jr9y29nn9j85q1zmg5by221v"))))+ (build-system go-build-system)+ (arguments+ `(#:go ,go-1.17+ #:import-path "github.com/oz/tz"+ #:phases+ (modify-phases %standard-phases+ (replace 'check+ (lambda* (#:key import-path tests? #:allow-other-keys)+ (when tests?+ (invoke "go" "test" "-cover" import-path)))))))+ (inputs+ `(("github.com/charmbracelet/bubbletea" ,go-github-com-charmbracelet-bubbletea)+ ("github.com/muesli/termenv" ,go-github-com-muesli-termenv)))+ (home-page "https://github.com/oz/tz")+ (synopsis "TUI time zone helper")+ (description+"@command{tz} helps you schedule things across time zones. It is an interactive+TUI program that displays time across a few time zones of your choosing.")+ (license gpl3+)))+ (define-public countdown (package (name "countdown")-- 2.33.0
J
From today's Guix Meetup
(address . 48364@debbugs.gnu.org)(name . Gábor Boskovits)(address . boskovits@gmail.com)
20210926045345.GB2882@gac.attlocal.net
Hi,
I didn't realize that Stefan attempted this package already.
Well, here is another attempt from today's Guix Packaging Meetup.
Gábor and I hacked away on tz and it's dependencies a bit.
I tested and built tz with --check --rounds=3 and `guix environment --ad-hoc tz -- tz`
This is a very cool TUI! I use it daily but have had to install it with nix orbuild it with golang, depending on what machine I'm on.
Now we can have it in guix.
all best,
jgart
3B1D 7F19 E36B B60C 0F5B 2CA9 A52A A2B4 77B6 DD35
J
(address . 48364@debbugs.gnu.org)(name . Gábor Boskovits)(address . boskovits@gmail.com)
20210926051246.GB5167@gac.attlocal.net
On Sun, 26 Sep 2021 04:53:45 -0400 jgart <jgart@dismail.de> wrote:
I want to give a special shoutout to iskarian‎ ‎and vagrantc‎ for helping me debugtz over irc.
I was running into some issues with tz not being deterministic at first:
https://paste.sr.ht/~jgart/99583c33249dc7acd35763f9023efc1ec9f8fcd8
J
(no subject)
(address . 48364@debbugs.gnu.org)
20211107024704.GC22744@gac.attlocal.net
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 48364@debbugs.gnu.org