-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tz] Package the source database by default #21671
base: master
Are you sure you want to change the base?
[tz] Package the source database by default #21671
Conversation
* This replaces the iana binary tzdb with the source tzdb as the default. This is because this is what's supported most comprehensively by the date package. This still retains the option to build the binary database if required. Closes conan-io#21670
063f917
to
a89ec20
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@uilianries @RubenRBS I've re-kicked off the CI to see if the above issue was transient, but I thought you'd be interested in the error given that this PR is clearly only modifying the
Maybe something to do with the parallelization of jobs? |
@samuel-emrys Yes, well observed. Indeed with a problem with concurrent jobs, it happens from time to time. I'll restart the build, thank you for reporting. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
* Add tz recipe as a dependency to provide a way of easily consuming/maintaining and upgrading the timezone database * Apply patch from HowardHinnant/date#807 to add the ability to specify the tz database by environment variable * Deprecate `use_system_tz_db` in favour of `with_tzdb` option to handle all mutually exclusive options * Add `with_db_format` option to provide flexibility in how the tz package is consumed. This implementation superesedes conan-io#16285 and conan-io#21719. In the case of conan-io#21719, it turned out that HowardHinnant/date#611 was not mature enough to provide the ability for the date library to read zic-compiled binary variants of the tzdb on Windows. To take an iterative approach, this PR aims to extract the elements that worked from conan-io#21719, which was the use of an environment variable to inject the conan packaged tz database. Use of a binary database has been marked as an invalid configuration on Windows. This functionality can be added at a later date. This pull request is blocked on conan-io#21671, which packages the source database in the tz recipe and makes this the default configuration since this is the only database that can be parsed consistently on all major platforms. Closes conan-io#16204
@uilianries I'm a bit confused about the hook errors here - doesn't seem to apply well to this library at all. Are you able to shed any light? This PR is blocking #22294 so I'm keen to get this through ASAP. |
Setting |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Didn't seem to work! |
* Swap the quotation characters in the python string to read the source database to enable the command to be parsed correctly on Windows
This file is parsed by windows to convert local timezone mappings to that of the IANA database. It's necessary to use the source version of the database on windows.
* Options can't be queried in the source() method, so remove this and just always download windowsZones.xml
3f1d679
to
b52af15
Compare
This comment has been minimized.
This comment has been minimized.
Opened a PR for the invalid linter error: conan-io/hooks#525 |
Conan 1.x is not able to parse self.dependencies in the test() method due to differences in the lifetime of objects. The solution presented here is to save the necessary options to file and load them back again in the test() method to be used as appropriate. Additionally, utilise the conan `save` and `load` methods for readability and consistency with other recipes. Co-authored-by: Martin Valgur <martin.valgur@gmail.com>
This comment has been minimized.
This comment has been minimized.
"windows_zones": | ||
url: "https://raw.githubusercontent.com/unicode-org/cldr/fd8ca965e03ca3cf07a0487678e0a1e002646ec0/common/supplemental/windowsZones.xml" | ||
sha256: "e5720d0d82a0a62687184bf0d9472f3cf0f7ef8b930ad40f3ae7386d8cb57213" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @samuel-emrys,
Could you please explain why this xml is needed in windows? How does it work to make the date library work with the source database?
I am a bit concerned about adding an external file to the tz package that at first has "nothing to do" with the original source database. I think we need some more context regarding this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something that the date
library expects to be present in the source database on windows. It contains the mapping between the windows time zone names and IANA time zones names (description)
You can see the dependency here:
If this file isn't in the same directory, it throws having failed to locate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: CLDR is the defacto authority for these kinds of files - see more about the project here: https://cldr.unicode.org/index
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your answer. The problem I see, you are trying to modeling this package to work with date, which is not inclined to support it. Packages in ConanCenterIndex, usually, should be independent and follow the upstream to avoid divergent behavior. I do not see that file as part of tz. I would prefer a separated package for it, in case really needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a "practically required" file to make the IANA tzdb useful on windows - without it, my understanding is that there isn't a way to convert between the windows timezones and IANA timezones. In that context, it could be viewed as a compatibility patch to enable windows compatibility for the package.
Having said that, if you'd prefer it in a different package I can attempt to do that. Please confirm if that's the way you would like me to go. My thought was that they fit together quite naturally in that a user who wants one would invariably want the other.
With respect to your comments about date: I didn't get the feeling that these changes wouldn't be supported out of principle, more time/maintenance constraints. The only modification required to date was to support reading the location of the database from an environment variable, which was a trivial modification.
Because the date
library wasn't constructed with package management use in mind, external database provision wasn't a consideration and so the library makes some assumptions about what files are where, and also attempts to download its own files. Understandably this requires some modification to extricate these dependencies from each other.
Your comment gives me some doubt that this approach will be accepted on CCI though. If that's the case - please let me know so that I don't waste any more time pursuing this.
For what it's worth, this solution works really well for me locally. I can't imagine there's too much additional work in getting this functional, but I haven't been able to thoroughly test without the CI service whilst I'm blocked on the hook in conan-io/hooks#525
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another reason to consider bundling windowsZones.xml
with the tz database is that it's often updated explicitly to support changes in tzdb - they are tightly coupled: https://github.com/unicode-org/cldr/commits/main/common/supplemental/windowsZones.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samuel-emrys thanks a lot for the useful links and clear explanation. This has helped me to understand how tz database from IANA, the CLDR, and the "date" library work together.
While I understand that having the windowsZones.xml file inside this tz database package is quite practical and convenient, I believe that we would create a "mix" package from CLDR and IANA sources which do not follow the original sources of the packages and could cause different expectations in the user of the recipe.
As described at https://howardhinnant.github.io/date/tz.html#Installation in "windows specfic", this WindowsZones.xml (although tightly coupled with tz database) is something that the date library expects to be installed externally at a certain location. It is not assumed as part of the tz database and not provided automatically by the date library AFAIK.
From my point of view, there should be a separate CLDR recipe that provides the needed file and that should be a require in the date recipe, leaving this tz recipe uncoupled with the WindowsZones.xml file. The downside of this is that the version of both tz recipe and the new CLDR (windowsZones.xml) will have to be compatible according to the historic of changes you pointed out here https://github.com/unicode-org/cldr/commits/main/common/supplemental/windowsZones.xml, however, I believe this dependency represents how the different pieces work together and would be closer to user expectations when using these libraries.
I hope that this reasoning makes sense. I would be happy to collaborate on this if needed. Thanks a lot for the hard work @samuel-emrys and thanks again for taking the time to explain this situation 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification @danimtb, I'll get started on a windowszones
package as well. For awareness because I don't think this is front of mind at the moment, this will mean additional changes to the date
library, as it currently assumes that windowsZones.xml
is present in the tzdata
directory - it places it alongside the timezone database. This obviously won't be possible with the conan architecture as packages are immutable, so modifications will be required to decouple these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your understanding. Let's see if we can point the date library to pick the windows zones from a different location. Please ping me if you need any help on this.
"windows_zones": | ||
url: "https://raw.githubusercontent.com/unicode-org/cldr/fd8ca965e03ca3cf07a0487678e0a1e002646ec0/common/supplemental/windowsZones.xml" | ||
sha256: "e5720d0d82a0a62687184bf0d9472f3cf0f7ef8b930ad40f3ae7386d8cb57213" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your answer. The problem I see, you are trying to modeling this package to work with date, which is not inclined to support it. Packages in ConanCenterIndex, usually, should be independent and follow the upstream to avoid divergent behavior. I do not see that file as part of tz. I would prefer a separated package for it, in case really needed.
@@ -15,6 +15,9 @@ class TzConan(ConanFile): | |||
description = "The Time Zone Database contains data that represent the history of local time for many representative locations around the globe." | |||
topics = ("tz", "tzdb", "time", "zone", "date") | |||
settings = "os", "build_type", "arch", "compiler" | |||
options = {"with_binary_db": [True, False]} | |||
default_options = {"with_binary_db": False} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About distributing sources, instead of the binary database, do have a reference from the upstream, like a documentation how to do it, or a tar file with only sources distributed? Reading the https://github.com/eggert/tz I only found using command make to generate the binary, like, the default is with the binary DB, not the opposite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question. It looks like date
by default downloads a source-only version of the database: https://data.iana.org/time-zones/releases/tzdata2023c.tar.gz. On that page tzdata
refers to data files only. So, perhaps I should just download this for the source only version and package everything there? One problem is that the source()
method doesn't support conditional downloading based on options.
Having said that, I also can't see any explicit discussion recommending or talking about parsing the source database directly. The first issue raised on date suggested using the binary form HowardHinnant/date#1, which wasn't received particularly positively.
date
currently only fully supports the source form of the database. It has limited support for the binary form on linux and macos. It doesn't support it on windows, but there are a couple of pull requests that may form the basis for a potential patch to add that functionality to the CCI package. I made an initial attempt at porting these, but decided that the first step was to take your recommendation and adhere as closely to upstream usage as possible to get something functional.
* Explain where file listing for tzdata has come from, including windowsZones.xml, which is managed by CLDR.
This reverts commit a89ec20.
Conan v1 pipeline ❌Failure in build 14 (
Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability. |
This replaces the iana binary tzdb with the source tzdb as the default. This is because this is what's supported most comprehensively by the date package. This still retains the option to build the binary database if required.
For additional context:
particularly HowardHinnant/date#611 (comment):
Indicating that the upstream project has no desire to support parsing a binary database on windows.
This PR is an initial step to adding support to the
date
recipe to use the IANA TZDB as a conan package. This is not a feature currently supported by thedate
recipe, but I've raised HowardHinnant/date#788 upstream detailing the requirement. My plan is to submit a patch upstream (which I don't anticipate will be accepted, details are in the linked issue), and use this as the basis for a patch to thedate
recipe to allow the path to the source IANA TZDB to be specified as an environment variable to facilitate conan compatibility.Closes #21670
Specify library name and version: tz/2023c