Re: RFS: haskell-tz and haskell-tzdata
Hey Ilias,
On Mon, 2022-06-20 at 10:13 +0300, Ilias Tsitsimpis wrote:
> Hey Robert,
>
> On Sun, Jun 19, 2022 at 11:23AM, Robert Greener wrote:
> > I've prepared arbtt for the latest release (as is needed otherwise
> > it'll be removed due to incompatibility with the new lts). This
> > depends
> > on tz (and therefore tzdata) starting from the latest version.
> > Could
> > you merge these and upload please?
> >
> > There was some discussion on the ITP bugs about whether these would
> > need to be updated in stable; however, this is not the case. I've
> > patched haskell-tzdata so it just uses tzdata files.
>
> Last time I tried to package this tzdata, my understanding was that
> the
> database was hard-coded at compile time, and there was no way to read
> it
> from disk. That's why we haven't packaged this for so long, because
> it
> doesn't worth the maintenance burden.
That wasn't what I found, maybe it has changed? It appears to provide a
-data package that contains the tzdata files. I've patched this to
remove the data package and to just load the files from the standard
location. I've copied the patch below -- what do you think?
I tested this using pbuilder and the tests pass.
Index: haskell-tzdata/Data/Time/Zones/Files.hs
===================================================================
--- haskell-tzdata.orig/Data/Time/Zones/Files.hs
+++ haskell-tzdata/Data/Time/Zones/Files.hs
@@ -10,13 +10,10 @@ module Data.Time.Zones.Files (
timeZonePathFromDB,
) where
-import Paths_tzdata
-
-- | Return the file path corresponding to a time zone location.
--
-- Note: doesn't check whether the location is valid (ie. the returned
-- path might not exist).
timeZonePathFromDB :: String -> IO FilePath
timeZonePathFromDB tzName =
- -- TODO(klao): this probably won't work on Windows.
- getDataFileName $ tzName ++ ".zone"
+ return ("/usr/share/zoneinfo/" ++ tzName)
Index: haskell-tzdata/tzdata.cabal
===================================================================
--- haskell-tzdata.orig/tzdata.cabal
+++ haskell-tzdata/tzdata.cabal
@@ -33,10 +33,6 @@ Description:
facilities to /use/ the data shipped here. (The @tz@ package
automatically installs this package.)
-Data-Dir: tzdata
--- We have to explicitly list all the directories because of Cabal's limitations.
-Data-Files: *.tab *.zone Chile/*.zone Etc/*.zone Canada/*.zone Indian/*.zone Africa/*.zone Asia/*.zone Antarctica/*.zone Europe/*.zone America/*.zone America/Kentucky/*.zone America/North_Dakota/*.zone America/Argentina/*.zone America/Indiana/*.zone Mexico/*.zone Brazil/*.zone Atlantic/*.zone Arctic/*.zone Australia/*.zone Pacific/*.zone US/*.zone
-
Extra-Source-Files:
README.md
Data/Time/Zones/DB.hs.template
Reply to: