JuliaTime / TimeZones.jl

IANA time zone database access for the Julia programming language
Other
86 stars 51 forks source link

Include the tzdata version in our scratch directory structure #389

Closed omus closed 2 years ago

omus commented 2 years ago

Follow up to #384. Since we're using a scratch directory multiple TimeZones.jl packages using different versions may concurrently be using the scratch directory. If these packages use different tzdata versions we could accidentally use a different tzdata version that what is typically used by that package. To solve this I've included the tzdata version in the scratch directory structure as well as included the tzjfile version. To make this work properly I ended up using Refs to some of the directories so it's possible to update the tzdata version being used.

omus commented 2 years ago

Windows failure:

     Building TimeZones → `D:\a\TimeZones.jl\TimeZones.jl\deps\build.log`
[ Info: Installing 2016j tzdata region data
[ Info: Converting tz source files into TimeZone data
[ Info: Downloading Windows to POSIX timezone ID XML version: release-40
ERROR: LoadError: InitError: IOError: open("C:\\Users\\runneradmin\\.julia\\scratchspaces\\f269a46b-ccf7-5d73-abea-4c690281aa53\\build\\local\\windowsZones.xml", 769, 33206): no such file or directory (ENOENT)
Stacktrace:
  [1] uv_error
    @ .\libuv.jl:100 [inlined]
  [2] open(path::String, flags::UInt16, mode::UInt64)
    @ Base.Filesystem .\filesystem.jl:122
  [3] sendfile(src::String, dst::String)
    @ Base.Filesystem .\file.jl:994
  [4] cp(src::String, dst::String; force::Bool, follow_symlinks::Bool)
    @ Base.Filesystem .\file.jl:384
  [5] build(xml_file::String; force::Bool)
    @ TimeZones.WindowsTimeZoneIDs D:\a\TimeZones.jl\TimeZones.jl\src\winzone\WindowsTimeZoneIDs.jl:47
  [6] build(version::String; force::Bool)
    @ TimeZones D:\a\TimeZones.jl\TimeZones.jl\src\build.jl:14
  [7] build(version::String)
    @ TimeZones D:\a\TimeZones.jl\TimeZones.jl\src\build.jl:10
  [8] __init__()
    @ TimeZones D:\a\TimeZones.jl\TimeZones.jl\src\TimeZones.jl:56
...
codecov-commenter commented 2 years ago

Codecov Report

Merging #389 (f7a901c) into master (7b6eb43) will decrease coverage by 1.83%. The diff coverage is 75.51%.

:exclamation: Current head f7a901c differs from pull request most recent head 015c2de. Consider uploading reports for the commit 015c2de to get more accurate results

@@            Coverage Diff             @@
##           master     #389      +/-   ##
==========================================
- Coverage   95.23%   93.40%   -1.84%     
==========================================
  Files          36       36              
  Lines        1743     1758      +15     
==========================================
- Hits         1660     1642      -18     
- Misses         83      116      +33     
Impacted Files Coverage Δ
src/winzone/WindowsTimeZoneIDs.jl 0.00% <0.00%> (-100.00%) :arrow_down:
src/tzdata/TZData.jl 75.00% <75.00%> (-25.00%) :arrow_down:
src/tzdata/build.jl 90.00% <81.25%> (+7.39%) :arrow_up:
src/TimeZones.jl 100.00% <100.00%> (ø)
src/build.jl 85.71% <100.00%> (-14.29%) :arrow_down:
src/discovery.jl 86.51% <100.00%> (ø)
src/types/timezone.jl 97.14% <100.00%> (-0.08%) :arrow_down:
src/tzdata/compile.jl 92.48% <100.00%> (-2.95%) :arrow_down:
src/tzdata/download.jl 96.96% <100.00%> (+5.79%) :arrow_up:
src/tzdata/version.jl 74.19% <100.00%> (+5.22%) :arrow_up:
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7b6eb43...015c2de. Read the comment docs.

omus commented 2 years ago

Not loving the coverage reduction but I don't think that should hold this up.

StefanKarpinski commented 2 years ago

Seems better to use separate scratch spaces for different versions of the tzdata, no? That way the pkg gc can clean up no longer uesd tzdata; otherwise old ztdata will accumulate over time, taking up more and more space.

omus commented 2 years ago

Seems better to use separate scratch spaces for different versions of the tzdata, no? That way the pkg gc can clean up no longer uesd tzdata; otherwise old ztdata will accumulate over time, taking up more and more space.

Good point I wasn't really considering. I can make a follow up issue for that.