Closed penelopeysm closed 3 months ago
Eventual solution was to replace loadTZFromDB
with loadTZFromFile
; then instead of reading from a named file I inlined the contents of the London.zone
file which it needs. (I obtained the relevant file via cloning https://github.com/ysangkok/haskell-tzdata/ and then USE_CABAL=yes ./build-tzdata.sh
inside there.)
Now the London data is included into the binary itself!
Some questions for future pondering:
cabal install .
before this and so when I ran meet
I got the version in ~/.cabal/bin
rather than Homebrew's binary.myBs = BS.pack [...]
the most computationally efficient way of creating a constant ByteString? I'll ask this on /r/haskell or somethingIs
myBs = BS.pack [...]
the most computationally efficient way of creating a constant ByteString? I'll ask this on /r/haskell or something
I found this: https://www.reddit.com/r/haskell/comments/m4t9xm/distributing_a_binary_that_imports_a_library_that/ and the corresponding file-embed package, which does the same thing via Template Haskell.
Presumably we can do something like:
{-# LANGUAGE TemplateHaskell #-}
import Data.Time.Zones.Files (timeZonePathFromDB)
import Data.FileEmbed (embedFile)
{-# NOINLINE londonTZFilePath #-}
londonTZFilePath :: FilePath
londonTZFilePath = unsafePerformIO (timeZonePathFromDB "Europe/London")
londonTZBs :: Data.ByteString.ByteString
londonTZBs = $(embedFile londonTZFilePath)
https://github.com/alan-turing-institute/meet/pull/13 includes a dependency on the tzdata package, which ships with a database of time zones. Apparently, when Homebrew compiles the codebase during the bottle building process, it uses a sandboxed home directory (see above) and this database gets saved there. The path to this database is then baked into this binary and once Homebrew cleans up, the path is no longer valid.
Not sure how to get around it. We could modify the Homebrew build process to copy the files to the real home directory, but the binary would still have the wrong paths encoded inside. A solution that might work might be to fork/modify the tzdata package to use data hosted on the Internet (and self host the data, specifically the London file).
Even instructing Homebrew to install from source doesn't work.