diff --git a/DateTime-TimeZone-2.04-Parse-etc-localtime-by-DateTime-TimeZone-Tzfile.patch b/DateTime-TimeZone-2.04-Parse-etc-localtime-by-DateTime-TimeZone-Tzfile.patch new file mode 100644 index 0000000000000000000000000000000000000000..47f67a7d24322f06f9b0e19c0a9b00e9fd787c8b --- /dev/null +++ b/DateTime-TimeZone-2.04-Parse-etc-localtime-by-DateTime-TimeZone-Tzfile.patch @@ -0,0 +1,78 @@ +From fbf080cb5ca92f35a594967bdd3764c7dbb8c7f7 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 ae26fae..c5d44fe 100644 +--- a/lib/DateTime/TimeZone/Local/Unix.pm ++++ b/lib/DateTime/TimeZone/Local/Unix.pm +@@ -19,6 +19,7 @@ sub Methods { + FromEtcTIMEZONE + FromEtcSysconfigClock + FromEtcDefaultInit ++ FromEtcLocaltimeContent + ); + } + +@@ -267,6 +268,25 @@ sub _ReadEtcDefaultInit { + close $fh or die $!; + } + ++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 +@@ -341,6 +361,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 + + B Some systems such as virtual machine boxes may lack any of these +-- +1.9.3 + diff --git a/DateTime-TimeZone-2.47.tar.gz b/DateTime-TimeZone-2.47.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..8fd73f4583e1197d16d84922e874d9c2673d7d5e Binary files /dev/null and b/DateTime-TimeZone-2.47.tar.gz differ diff --git a/perl-DateTime-TimeZone.spec b/perl-DateTime-TimeZone.spec new file mode 100644 index 0000000000000000000000000000000000000000..a92c2da0c832c7b717db017c7a13252bffc11b7a --- /dev/null +++ b/perl-DateTime-TimeZone.spec @@ -0,0 +1,76 @@ +# Remove under-specified dependencies +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Class::Singleton\\)$ +# Regenerate Perl library code from upstream Olson database of this date +%global tzversion 2021a + +Name: perl-DateTime-TimeZone +Version: 2.47 +Release: 1 +Summary: Time zone object base class and factory +License: (GPL+ or Artistic) and Public Domain +URL: https://metacpan.org/release/DateTime-TimeZone +Source0: https://cpan.metacpan.org/authors/id/D/DR/DROLSKY/DateTime-TimeZone-%{version}.tar.gz +Source1: ftp://ftp.iana.org/tz/releases/tzdata%{tzversion}.tar.gz +# Parse local time zone definition from /etc/localtime as before giving up, bug #1135981, CPAN RT#55029 +Patch0: DateTime-TimeZone-2.04-Parse-etc-localtime-by-DateTime-TimeZone-Tzfile.patch + +BuildArch: noarch +# Build +BuildRequires: coreutils, make, perl-generators, perl-interpreter, perl(ExtUtils::MakeMaker) >= 6.76, perl(strict), perl(warnings) +# Avoid circular dependencies - perl-DateTime strictly requires DateTime::TimeZone +BuildRequires: perl(Data::Dumper), perl(DateTime), perl(File::Copy), perl(File::Find::Rule), perl(File::Path), perl(File::Spec) +BuildRequires: perl(Getopt::Long), perl(integer), perl(lib), perl(List::Util), perl(Locale::Country) >= 3.11, perl(Parallel::ForkManager), sed +# Runtime +BuildRequires: perl(Class::Singleton) >= 1.03, perl(constant), perl(Cwd) >= 3, perl(DateTime::Duration) +# Unused BuildRequires: perl(DateTime::TimeZone::Tzfile) +BuildRequires: perl(File::Basename), perl(File::Compare), perl(File::Find), perl(File::Spec), perl(List::Util) >= 1.33, perl(Module::Runtime), perl(namespace::autoclean) +BuildRequires: perl(Params::ValidationCompiler) >= 0.13, perl(parent), perl(Specio::Library::Builtins), perl(Specio::Library::String), perl(Try::Tiny) +# Tests only +BuildRequires: perl(base), perl(File::Copy), perl(File::Path), perl(File::Spec::Functions), perl(File::Temp), perl(lib) +BuildRequires: perl(overload), perl(Storable), perl(Sys::Hostname), perl(Test::Fatal) +# Test::Mojibake not used +BuildRequires: perl(Test::More) >= 0.96, perl(Test::Requires) +# Optional tests +Requires: perl(:MODULE_COMPAT_%(eval "$(perl -V:version)"; echo $version)) +Requires: perl(File::Basename), perl(File::Compare), perl(File::Find), perl(DateTime::TimeZone::Tzfile) + +Provides: bundled(tzdata) = %{tzversion} + +%description +This class is the base class for all time zone objects. A time zone is +represented internally as a set of observances, each of which describes the +offset from GMT for a given time period. + +%prep +%setup -q -T -a 1 -c -n tzdata-%{tzversion} +%setup -q -T -b 0 -n DateTime-TimeZone-%{version} +%patch0 -p1 + + +%build +JOBS=$(printf '%%s' "%{?_smp_mflags}" | sed 's/.*-j\([0-9][0-9]*\).*/\1/') +perl tools/parse_olson --dir ../tzdata-%{tzversion} --version %{tzversion} \ + --jobs $JOBS --clean +perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 +%{make_build} + + +%install +%{make_install} +%{_fixperms} %{buildroot}/* + + +%check +make test + + +%files +%license LICENSE +%doc Changes README.md +%{perl_vendorlib}/* +%{_mandir}/man3/* + + +%changelog +* Fri Jul 15 2022 konglidong - 2.47-1 +- package init diff --git a/tzdata2021a.tar.gz b/tzdata2021a.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..6cfd2e321a2d528b3709e934e177d9b5877a2996 Binary files /dev/null and b/tzdata2021a.tar.gz differ