[PATCH] gnu: icu4c: Patch zoneinfo directory.

OpenSubmitted by Christopher Baines.
Details
3 participants
  • Leo Famulari
  • Ludovic Courtès
  • Christopher Baines
Owner
unassigned
Severity
normal
C
C
Christopher Baines wrote on 17 May 2018 14:58
(address . guix-patches@gnu.org)
20180517125834.7417-1-mail@cbaines.net
Replace the hardcoded /usr/share/zoneinfo file with a reference to the tzdata
package.

* gnu/packages/icu4c.scm (icu4c)[inputs]: Add tzdata.
[arguments]: Add a patch-zoneinfo-directory phase.
---
gnu/packages/icu4c.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Toggle diff (39 lines)
diff --git a/gnu/packages/icu4c.scm b/gnu/packages/icu4c.scm
index 57e8fffb3..d34b61745 100644
--- a/gnu/packages/icu4c.scm
+++ b/gnu/packages/icu4c.scm
@@ -22,6 +22,7 @@
 
 (define-module (gnu packages icu4c)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages perl)
   #:use-module (guix licenses)
   #:use-module (guix packages)
@@ -45,7 +46,8 @@
              (base32 "065l3n0q9wqaw8dz20x82srshhm6i987fr9ync5xf9mr6n7ylwzh"))))
    (build-system gnu-build-system)
    (inputs
-    `(("perl" ,perl)))
+    `(("perl" ,perl)
+      ("tzdata" ,tzdata)))
    (arguments
     `(#:configure-flags
       '("--enable-rpath"
@@ -58,7 +60,13 @@
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'chdir-to-source
-          (lambda _ (chdir "source") #t)))))
+          (lambda _ (chdir "source") #t))
+        (add-after 'chdir-to-source 'patch-zoneinfo-directory
+          (lambda* (#:key inputs #:allow-other-keys)
+            (substitute* "common/putil.cpp"
+              (("\\/usr\\/share\\/zoneinfo")
+               (string-append (assoc-ref inputs "tzdata")
+                              "/share/zoneinfo"))))))))
    (synopsis "International Components for Unicode")
    (description
     "ICU is a set of C/C++ and Java libraries providing Unicode and
-- 
2.16.3
L
L
Ludovic Courtès wrote on 19 May 2018 22:21
(name . Christopher Baines)(address . mail@cbaines.net)
878t8fpfah.fsf@gnu.org
Hello,

Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (6 lines)
> Replace the hardcoded /usr/share/zoneinfo file with a reference to the tzdata
> package.
>
> * gnu/packages/icu4c.scm (icu4c)[inputs]: Add tzdata.
> [arguments]: Add a patch-zoneinfo-directory phase.

Good catch.

I wonder if icu4c should instead depend on ‘tzdata-for-tests’, which is
changed less frequently to avoid full rebuilds? Maybe Leo can comment.

I hope icu4c also honors the TZDIR environment variable, which would
allow users to have it refer to the latest version. Do you know if
that’s the case?

Last thing: this would probably be for ‘core-updates-next’.

Thanks,
Ludo’.
L
L
Leo Famulari wrote on 21 May 2018 19:15
(name . Ludovic Courtès)(address . ludo@gnu.org)
20180521171514.GA13182@jasmine.lan
On Sat, May 19, 2018 at 10:21:42PM +0200, Ludovic Courtès wrote:
Toggle quote (10 lines)
> Hello,
>
> Christopher Baines <mail@cbaines.net> skribis:
>
> > Replace the hardcoded /usr/share/zoneinfo file with a reference to the tzdata
> > package.
> >
> > * gnu/packages/icu4c.scm (icu4c)[inputs]: Add tzdata.
> > [arguments]: Add a patch-zoneinfo-directory phase.

Thanks for noticing this, Chris.

Toggle quote (3 lines)
> I wonder if icu4c should instead depend on ‘tzdata-for-tests’, which is
> changed less frequently to avoid full rebuilds? Maybe Leo can comment.

tzdata-for-tests is meant to be used by packages that don't need current
time zone info. Thus, "for test suites only". We added tzdata-for-tests
to make it cheaper to update tzdata.

If icu4c needs current time zone info, it should not use
tzdata-for-tests. Chris, can you give more context about how icu4c uses
time zone information?

Toggle quote (4 lines)
> I hope icu4c also honors the TZDIR environment variable, which would
> allow users to have it refer to the latest version. Do you know if
> that’s the case?

Yeah, it would be great if icu4c could just use TZDIR, which would allow
us to continue updating the time zones relatively frequently... if icu4c
actually needs the time zone database.

Already, we have problems keeping them up to date because too many
packages depend on them, and that's a problem for Guix users (clocks
will be wrong in some time zones). If we let icu4c depend on tzdata,
then we will only be able to update the time zones during core-updates,
which is not frequent enough. Currently, we can at least update tzdata
on 'staging' braches.

It indicates two general problems, IMO:

1) the lack of build farm capacity
2) it should be possible to update the time zone database without
rebuilding packages (the packages should use TZDIR)

I wonder what is done in Nixpkgs...
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlsC/qIACgkQJkb6MLrK
fwj4cA//QU8BC1a43Y+JsuGAIRraab+0E5TwbzVYoIDq2TkEw0Nf8FCuN9l+60hy
z5fbC7V6taUujSLa7TFPiXsuKl1/jsRwqEI+iSxvJb9SIekubkIC8K1r0B60kY86
c8tCjrJRpD+Me2fvWQ2KC+46y5eyKa1YKU8czFj179vs3nUyzuKfLn/APLmKt8nj
lc3I4NpkSIg/Zgh8k0CmvZUqiLB80cKfPcvEOCLONOAIqfnBQjeXyr5Gy4wTbL2D
V0ZVoW11xPUr060o75Qx/wXZVhPKd+vxzqCC2JdvWAQGgzeiNrDsdHTHbY+sCZ+t
2WSZt/tB/DF8+vOtTrg0zaTR/NPSqU4fux6goRZK4J4y5XU76aDjXvs5uy4/uNFC
ik+kkR+EadjW/nSXjy1OtEruJx7/aMTAnXQOCdy3ptwW2t76B0KEhueQzkIg5PV9
qfA63nH4nVA1GLW6AL5pxdNh5c2Mm8cqKjVfawZ1rCaqEHImDYABD7QDwdoffDYH
kQg5FeZjqslutWxnbage8CCrl4e3D8AsZDwOZwOzzATy3j48j3U4uHrITgJuNhHA
UZW0Nsj2+6Ua0Ft6jsgqFtnSMAKVGf7ESbrwoRspNuYT9s/NeaT8S20i1HuDIOeX
lertsTtcupPMjSwziAfQpa3sh4yPR2Xoh/O9ZH44h4zJe0/qZQY=
=A0oP
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 22 May 2018 14:06
(name . Leo Famulari)(address . leo@famulari.name)
878t8b6giq.fsf@gnu.org
Heya,

Leo Famulari <leo@famulari.name> skribis:

Toggle quote (6 lines)
> It indicates two general problems, IMO:
>
> 1) the lack of build farm capacity
> 2) it should be possible to update the time zone database without
> rebuilding packages (the packages should use TZDIR)

I think tzdata is an example where dynamic composition (i.e., TZDIR) is
what we should use. That way we can update tzdata as frequently as we
want.

For the case where TZDIR is unset, programs can still use
tzdata-for-tests, which could be slightly outdated, but I consider it a
“degraded” mode and I think it’s fine.

Toggle quote (2 lines)
> I wonder what is done in Nixpkgs...

It may be that the majority of their users don’t live in the regions
affected by recent timezone changes…

Ludo’.
L
L
Leo Famulari wrote on 24 May 2018 18:30
(name . Ludovic Courtès)(address . ludo@gnu.org)
20180524163058.GB11853@jasmine.lan
On Tue, May 22, 2018 at 02:06:53PM +0200, Ludovic Courtès wrote:
Toggle quote (4 lines)
> For the case where TZDIR is unset, programs can still use
> tzdata-for-tests, which could be slightly outdated, but I consider it a
> “degraded” mode and I think it’s fine.

Okay, I'll rename it tzdata-old in core-updates to better describe the
full range of use cases.

Toggle quote (5 lines)
> > I wonder what is done in Nixpkgs...
>
> It may be that the majority of their users don’t live in the regions
> affected by recent timezone changes…

Yes, and these last minute changes tend not to affect the wealthier
parts of the world, where such problems would have a greater impact.
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlsG6MEACgkQJkb6MLrK
fwhBQQ/+KQT3L7kK70CmOGPBlSLcu/VVZZgin0IuFIP/4Ux7JfNwTB/e+8eXZmhe
QRM2t3VcUupszsm8jgaVMb14HPgbZubbcKW/7hAQ8EXcKoVKTjVu/9LHa0nvY1X2
fI0/m4zNHPRAXjU42nJ8q9FzlB/qofj5UfYYkjDfvdtzNuhhzazV8p+RTy3EUd3S
Y0B1vKjS6sSbVqdVoF2OVW1GAG8Mu2hvau0mZLVO8/VqGK/ef/6ccy5g/QSrUewu
U4ZW9E0ieq1dTuPnozuxoxibniKhVlBWEhive7B76zpe+aqBL2lEHyzQeG4+TNpj
wRBmB7sUg33wCg6BZYx9vw2OxFQ57Kev/pnFxEDefjDI6b6f8FI7PiZV/stxjUz4
c1VJC3XHdIg0W/wL5ndkkdP2Pi7pqhCBGT3xvjri4duCnVxG0ryhCCWrpm2BcEGn
RxN1hV3fRH1rSz8UREjjY1e8Bss2PEELfKcK8UTnZCqpmC7gF5d/iDno0Z9pHqWQ
u0KSF6TMO9BpHdvSn0Jz/7+/qhZe+IMfJVUznhAL2oqVlChRe/hhUtHaCECCbFLk
J4iobeaERCfUnSPPQqEe0zRkYliupOjY6nZyixn9KOo0ZatkC+QzkdQ7BNfq7uNT
K4wmc/Y4JU7C+jh0CW+5xkPGl88poPI8w0xbzZTcu3kdahW92X0=
=6uWQ
-----END PGP SIGNATURE-----


C
C
Christopher Baines wrote on 11 Jun 2018 20:18
(name . Ludovic Courtès)(address . ludo@gnu.org)
871sdd426h.fsf@cbaines.net
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (19 lines)
> Hello,
>
> Christopher Baines <mail@cbaines.net> skribis:
>
>> Replace the hardcoded /usr/share/zoneinfo file with a reference to the tzdata
>> package.
>>
>> * gnu/packages/icu4c.scm (icu4c)[inputs]: Add tzdata.
>> [arguments]: Add a patch-zoneinfo-directory phase.
>
> Good catch.
>
> I wonder if icu4c should instead depend on ‘tzdata-for-tests’, which is
> changed less frequently to avoid full rebuilds? Maybe Leo can comment.
>
> I hope icu4c also honors the TZDIR environment variable, which would
> allow users to have it refer to the latest version. Do you know if
> that’s the case?

All I remember about this was that I don't think it fixed the problem I
was trying to solve :) I had the patch in a stash for a while before
submitting it.

I don't even know what icu4c actually does, so I'm not very well placed
to look at this further, but I'm glad you and Leo seem to be getting
something from it :)
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlsevPZfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XeVTg//V0seCP5tkLh+DE+x66Va8A73fRnfLyUU/u8lER/rMs8TkRhy6u8imgC5
hKYYXc04/MASEum3GKoZfSRZIpaVgaLtMnmMjoSUzx9ZU0mTgPQ8aymrRK8RFzSi
CajPszOANZFZyOeOQeG9X3byUwIAJ70iShjs3MBaQMpRZ36ZYMkMGn8Mmg0vQYC0
Ocz81GSeTYIKt0F12QMuL6s6Nd3coENA1F/2UzNkTIrJ7uY2rwdoiugg5NtEAcf0
jrgyT8pDyCjd+vzN8NvqWXtWhXoAZ72ZKtKwe9YkCSGFJwdAtqNIJFcViHil7wlw
UfrkXH7AJBLHPMP5Hi39g4KM3wfiFjWVBP1f1Qbt0mnHvKOzFC9eHQ/Z8xNY8DXm
sAZhJY2yZGnD9USR10NI6q1RHkGEGzl4ljjDPDvhQdi0WyYADPv6CtwMa8UI/Xic
zpdAieegRN8BAtnrrLFVYqYfJnYqbp59DwY2xSmqthmTA+VOGQ/AZseytzePSDML
zJFUj3KjjjTUVpEVx8W8XoEFdpshJf6w7gE5rkczOf7Z+wxGGrBF1AionWBFlGKn
CeEY3foUjvwOSoN2haCFAooTIYniohUh1tSuWO3/GYvqFdMRqhST9Yo4FNBHMyMc
kgb7+2CRm0nt2j7BhPxrHsv7YKF4jTkN/p+nR6j4aEUxTFoPtNw=
=oMpM
-----END PGP SIGNATURE-----

?