diff --git a/DateTime-TimeZone-1.74-Parse-etc-localtime-by-DateTime-TimeZone-Tzfile.patch b/DateTime-TimeZone-1.74-Parse-etc-localtime-by-DateTime-TimeZone-Tzfile.patch new file mode 100644 index 0000000..d6ae0b3 --- /dev/null +++ b/DateTime-TimeZone-1.74-Parse-etc-localtime-by-DateTime-TimeZone-Tzfile.patch @@ -0,0 +1,78 @@ +From ddb36a17bd9ab30c33532684af85c71cd5c04071 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Mon, 1 Sep 2014 17:37:12 +0200 +Subject: [PATCH] Parse /etc/localtime by DateTime::TimeZone::Tzfile +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If there is valid /etc/localtime, then the system has configured local +time. If the file is not a symlink to /usr/share/zoneinfo or a copy +from there, then it's still a valid configuration. The only issue is +one cannot know the time zone name (Unfortunately, the time zone +abbreviations are ambiguous.) + +This patch implements this scenario and caused returning + a DateTime::TimeZone::Tzfile object instead of dying with +"Cannot determine local time zone" message. + +Signed-off-by: Petr Písař +--- + lib/DateTime/TimeZone/Local/Unix.pm | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/lib/DateTime/TimeZone/Local/Unix.pm b/lib/DateTime/TimeZone/Local/Unix.pm +index 71d7d4e..3c24ad0 100644 +--- a/lib/DateTime/TimeZone/Local/Unix.pm ++++ b/lib/DateTime/TimeZone/Local/Unix.pm +@@ -14,6 +14,7 @@ sub Methods { + FromEtcTIMEZONE + FromEtcSysconfigClock + FromEtcDefaultInit ++ FromEtcLocaltimeContent + ); + } + +@@ -233,6 +234,25 @@ sub _ReadEtcDefaultInit { + } + } + ++sub FromEtcLocaltimeContent { ++ my $class = shift; ++ ++ my $lt_file = $class->_EtcFile('localtime'); ++ return unless -r $lt_file && -s $lt_file && ! -l $lt_file; ++ ++ my $tz; ++ { ++ local $@; ++ local $SIG{__DIE__}; ++ $tz = eval { ++ require DateTime::TimeZone::Tzfile; ++ DateTime::TimeZone::Tzfile->new($lt_file); ++ }; ++ } ++ ++ return $tz if $tz; ++} ++ + 1; + + # ABSTRACT: Determine the local system's time zone on Unix +@@ -307,6 +327,13 @@ a time zone name. + If this file exists, it is opened and we look for a line starting like + "TZ=...". If this is found, it should indicate a time zone name. + ++=item * F content ++ ++If this file is not a symlink, it's parsed by ++a L to retrieve the time zone offset ++definition. No time zone name will be defined. This is usefull if the ++file does not present in the system time zone database. ++ + =back + + =head1 AUTHOR +-- +1.9.3 + diff --git a/perl-DateTime-TimeZone.spec b/perl-DateTime-TimeZone.spec index d0cf13c..d1dd082 100644 --- a/perl-DateTime-TimeZone.spec +++ b/perl-DateTime-TimeZone.spec @@ -1,11 +1,14 @@ Name: perl-DateTime-TimeZone Version: 1.74 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Time zone object base class and factory License: GPL+ or Artistic Group: Development/Libraries URL: http://search.cpan.org/dist/DateTime-TimeZone/ Source0: http://www.cpan.org/authors/id/D/DR/DROLSKY/DateTime-TimeZone-%{version}.tar.gz +# Parse local time zone definition from /etc/localtime as before giving up, +# bug #1135981, CPAN RT#55029 +Patch0: DateTime-TimeZone-1.74-Parse-etc-localtime-by-DateTime-TimeZone-Tzfile.patch BuildArch: noarch BuildRequires: perl BuildRequires: perl(base) @@ -40,6 +43,9 @@ BuildRequires: perl(warnings) # not automatically detected Requires: perl(File::Compare) Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +# Require optional DateTime::TimeZone::Tzfile to work in mock after tzdata +# upgrade, bug #1135981 +Requires: perl(DateTime::TimeZone::Tzfile) %{?filter_setup: %filter_from_requires /^perl(Win32/d @@ -73,6 +79,7 @@ offset from GMT for a given time period. %prep %setup -q -n DateTime-TimeZone-%{version} +%patch0 -p1 %build %{__perl} Makefile.PL INSTALLDIRS=vendor @@ -94,6 +101,9 @@ make test %{_mandir}/man3/* %changelog +* Tue Sep 02 2014 Petr Pisar - 1.74-2 +- Parse local time zone definition from /etc/localtime (bug #1135981) + * Tue Sep 02 2014 Petr Pisar - 1.74-1 - 1.74 bump (updates to 2014g Olson database)