Hi Roberto,

2008/10/31 Roberto C. Sánchez <[EMAIL PROTECTED]>:
> On Fri, Oct 31, 2008 at 07:32:13PM +0000, Philip Ross wrote:
>> 2008/10/31 Roberto C. Sánchez <[EMAIL PROTECTED]>:
>> >  3. Modify tzinfo to no longer embed the zone data and use the data from
>> >    /usr/share/zoneinfo instead.
>> >    - Requires modifying libtzinfo-ruby (could this be done upstream?)
>>
>> I've been considering making TZInfo optionally support using locally
>> installed zoneinfo files for a while (primarily to support creating
>> distro packages). Unfortunately, I've not had much time to look into
>> this.
>>
>> I was thinking of separating the current API+data gem into a core API
>> gem and separate data and zoneinfo gems. It may also be possible to
>> create an interim patch for Debian to make TZInfo use the zoneinfo
>> files instead of the bundled data. I'll try and take a look into what
>> be involved sometime next week.
>>
> That would be excellent.

I've attached a patch against TZInfo 0.3.11 that makes it use zoneinfo
files instead of the built in timezone modules. By default it will try
and locate a zoneinfo directory in /usr/share, /usr/share/lib and
/etc. This can be overridden by the user by setting
TZInfo::ZoneinfoTimezoneInfo.zoneinfo_dir.

I've tested this by comparing the output for all timezones in tzdata
v2008i against the output of zdump (see the /utils/zdumptestall.sh
test script in SVN). Note that the patch will break a couple of the
included unit tests that rely on data though.

With the patch applied you won't need to include the definitions
directory. You will however still need the indexes directory. The
indexes contain a list of all the timezones and a list of timezones by
country and need to be in sync with the installed zoneinfo version.
I'll take a look at replacing the indexes with code that scans the
zoneinfo directory and reads /usr/share/zoneinfo/iso3166.tab,
/usr/share/zoneinfo/zone.tab.

There is also an issue regarding information available in the TZInfo
data modules that doesn't appear to be in the zoneinfo files. TZInfo
is able to report how much the daylight savings offset is
independently of the offset from UTC. For zoneinfo files, I'm
currently having to assume that the daylight savings offset is always
1 hour. This is usually always the case, but I'll try and find a
better fix.

Over the next few weeks I'll try and integrate the zoneinfo support
into TZInfo properly and make a release that makes the included data
optional.

Please let me know if you find any issues or have any questions.

Regards,

Phil

-- 
Phil Ross
http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby

Attachment: tzinfo_zoneinfo_v1.diff
Description: Binary data

Reply via email to