[PATCH] gnu: Graft tzdata to install leap-seconds.list.

OpenSubmitted by Antero Mejr.
Details
3 participants
  • Antero Mejr
  • Liliana Marie Prikler
  • (
Owner
unassigned
Severity
normal
A
A
Antero Mejr wrote on 1 Jul 03:53 +0200
(address . guix-patches@gnu.org)
20220701015314.7197-1-antero@mailbox.org
* gnu/packages/base.scm (tzdata)[replacement]: New field.
(tzdata-leap-seconds-list): New private variable.
---
gnu/packages/base.scm | 14 ++++++++++++++
1 file changed, 14 insertions(+)

Toggle diff (34 lines)
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 4bdc3e7792..b265b429d5 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1305,6 +1305,7 @@ (define-public tzdata
     ;; This package should be kept in sync with python-pytz in (gnu packages
     ;; time).
     (version "2022a")
+    (replacement tzdata-leap-seconds-list)
     (source (origin
              (method url-fetch)
              (uri (string-append
@@ -1390,6 +1391,19 @@ (define-public tzdata
 and daylight-saving rules.")
     (license public-domain)))
 
+(define tzdata-leap-seconds-list
+  (package
+    (inherit tzdata)
+    (arguments
+     (substitute-keyword-arguments (package-arguments tzdata)
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (add-after 'install 'copy-leap-seconds-list
+              (lambda _
+                (copy-file "leap-seconds.list"
+                           (string-append
+                            #$output "/share/zoneinfo/leap-seconds.list"))))))))))
+
 ;;; A "fixed" version of tzdata, which is used in the test suites of glib and R
 ;;; and a few other places. We can update this whenever we are able to rebuild
 ;;; thousands of packages (for example, in a core-updates rebuild). This package
-- 
2.36.1
A
A
Antero Mejr wrote on 1 Jul 04:08 +0200
Re: bug#56331: Acknowledgement ([PATCH] gnu: Graft tzdata to install leap-seconds.list.)
(address . 56331@debbugs.gnu.org)
87tu81bn1i.fsf@mailbox.org
leap-seconds.list is required by the hare programming language (which is
currently being packaged) for accurate datetime calculations.

It is optionally used by ntpd with the "leapfile" directive in ntpd.conf.
(
Re: [bug#56331] [PATCH] gnu: Graft tzdata to install leap-seconds.list.
CL4808QZHVWA.8RAYIISM117N@guix-aspire
On Fri Jul 1, 2022 at 2:53 AM BST, Antero Mejr via Guix-patches via wrote:
Toggle quote (12 lines)
> @@ -1305,6 +1305,7 @@ (define-public tzdata
> ;; This package should be kept in sync with python-pytz in (gnu packages
> ;; time).
> (version "2022a")
> + (replacement tzdata-leap-seconds-list)
> (source (origin
> (method url-fetch)
> (uri (string-append
> @@ -1390,6 +1391,19 @@ (define-public tzdata
> and daylight-saving rules.")
> (license public-domain)))

There's no need to graft it, as long as you make sure tzdata-for-tests
isn't rebuilt.
A
A
Antero Mejr wrote on 1 Jul 15:03 +0200
[PATCH] gnu: Update tzdata-for-tests.
(address . 56331@debbugs.gnu.org)(address . paren@disroot.org)
20220701130314.4046-1-antero@mailbox.org
* gnu/packages/base.scm (tzdata-for-tests): Install leap-seconds.list.
---
gnu/packages/base.scm | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 4bdc3e7792..a1d57611ee 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1398,7 +1398,20 @@ (define-public tzdata
 ;;;
 ;;; Please make this a hidden-package if it is different from the primary tzdata
 ;;; package.
-(define-public tzdata-for-tests tzdata)
+(define-public tzdata-for-tests
+  (hidden-package
+   (package
+     (inherit tzdata)
+     (arguments
+      (substitute-keyword-arguments (package-arguments tzdata)
+        ((#:phases phases)
+         #~(modify-phases #$phases
+             (add-after 'install 'copy-leap-seconds-list
+               (lambda _
+                 (copy-file "leap-seconds.list"
+                            (string-append
+                             #$output
+                             "/share/zoneinfo/leap-seconds.list")))))))))))
 
 (define-public libiconv
   (package
-- 
2.36.1
L
L
Liliana Marie Prikler wrote on 1 Jul 21:49 +0200
(address . paren@disroot.org)
9377148b01b646f0fadb810cff5ce00b2ef1989c.camel@gmail.com
Am Freitag, dem 01.07.2022 um 13:03 +0000 schrieb Antero Mejr:
Toggle quote (31 lines)
> * gnu/packages/base.scm (tzdata-for-tests): Install leap-
> seconds.list.
> ---
>  gnu/packages/base.scm | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
> index 4bdc3e7792..a1d57611ee 100644
> --- a/gnu/packages/base.scm
> +++ b/gnu/packages/base.scm
> @@ -1398,7 +1398,20 @@ (define-public tzdata
>  ;;;
>  ;;; Please make this a hidden-package if it is different from the
> primary tzdata
>  ;;; package.
> -(define-public tzdata-for-tests tzdata)
> +(define-public tzdata-for-tests
> +  (hidden-package
> +   (package
> +     (inherit tzdata)
> +     (arguments
> +      (substitute-keyword-arguments (package-arguments tzdata)
> +        ((#:phases phases)
> +         #~(modify-phases #$phases
> +             (add-after 'install 'copy-leap-seconds-list
> +               (lambda _
> +                 (copy-file "leap-seconds.list"
> +                            (string-append
> +                             #$output
> +                             "/share/zoneinfo/leap-
> seconds.list")))))))))))
That's exactly the patch you weren't supposed to write. It bumps
tzdata-for-tests, thus causing mass rebuilds, but doesn't bump tzdata.

Cheers
?