Init package
This commit is contained in:
parent
e01af62159
commit
248e5cd32c
@ -0,0 +1,78 @@
|
|||||||
|
From fbf080cb5ca92f35a594967bdd3764c7dbb8c7f7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||||||
|
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ř <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
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</etc/localtime> content
|
||||||
|
+
|
||||||
|
+If this file is not a symlink, it's parsed by
|
||||||
|
+a L<DateTime::TimeZone::Tzfile> 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<Note:> Some systems such as virtual machine boxes may lack any of these
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
||||||
BIN
DateTime-TimeZone-2.52.tar.gz
Normal file
BIN
DateTime-TimeZone-2.52.tar.gz
Normal file
Binary file not shown.
181
perl-DateTime-TimeZone.spec
Normal file
181
perl-DateTime-TimeZone.spec
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
%bcond_with perl_DateTime_TimeZone_enables_optional_test
|
||||||
|
|
||||||
|
# Bootstrap?
|
||||||
|
%define perl_bootstrap 1
|
||||||
|
|
||||||
|
# Regenerate Perl library code from upstream Olson database of this date
|
||||||
|
%global tzversion 2022a
|
||||||
|
|
||||||
|
Name: perl-DateTime-TimeZone
|
||||||
|
Version: 2.52
|
||||||
|
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
|
||||||
|
%if %{defined tzversion}
|
||||||
|
Source1: ftp://ftp.iana.org/tz/releases/tzdata%{tzversion}.tar.gz
|
||||||
|
%endif
|
||||||
|
# Parse local time zone definition from /etc/localtime as before giving up,
|
||||||
|
Patch0: DateTime-TimeZone-2.04-Parse-etc-localtime-by-DateTime-TimeZone-Tzfile.patch
|
||||||
|
BuildArch: noarch
|
||||||
|
# Build
|
||||||
|
BuildRequires: coreutils
|
||||||
|
BuildRequires: make
|
||||||
|
BuildRequires: perl-generators
|
||||||
|
BuildRequires: perl-interpreter
|
||||||
|
BuildRequires: perl(Config)
|
||||||
|
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
|
||||||
|
BuildRequires: perl(strict)
|
||||||
|
BuildRequires: perl(warnings)
|
||||||
|
%if !%{defined perl_bootstrap} && %{defined tzversion}
|
||||||
|
# Avoid circular dependencies - perl-DateTime strictly requires DateTime::TimeZone
|
||||||
|
BuildRequires: perl(Data::Dumper)
|
||||||
|
BuildRequires: perl(DateTime)
|
||||||
|
BuildRequires: perl(File::Copy)
|
||||||
|
BuildRequires: perl(File::Find::Rule)
|
||||||
|
BuildRequires: perl(File::Path)
|
||||||
|
BuildRequires: perl(File::Spec)
|
||||||
|
BuildRequires: perl(Getopt::Long)
|
||||||
|
BuildRequires: perl(integer)
|
||||||
|
BuildRequires: perl(lib)
|
||||||
|
BuildRequires: perl(List::Util)
|
||||||
|
BuildRequires: perl(Locale::Country) >= 3.11
|
||||||
|
BuildRequires: perl(Parallel::ForkManager)
|
||||||
|
BuildRequires: sed
|
||||||
|
%endif
|
||||||
|
# Runtime
|
||||||
|
BuildRequires: perl(Class::Singleton) >= 1.03
|
||||||
|
BuildRequires: perl(constant)
|
||||||
|
BuildRequires: perl(Cwd) >= 3
|
||||||
|
%if !%{defined perl_bootstrap}
|
||||||
|
BuildRequires: perl(DateTime::Duration)
|
||||||
|
%endif
|
||||||
|
# Unused BuildRequires: perl(DateTime::TimeZone::Tzfile)
|
||||||
|
BuildRequires: perl(File::Basename)
|
||||||
|
BuildRequires: perl(File::Compare)
|
||||||
|
BuildRequires: perl(File::Find)
|
||||||
|
BuildRequires: perl(File::Spec)
|
||||||
|
BuildRequires: perl(List::Util) >= 1.33
|
||||||
|
BuildRequires: perl(Module::Runtime)
|
||||||
|
BuildRequires: perl(namespace::autoclean)
|
||||||
|
BuildRequires: perl(Params::ValidationCompiler) >= 0.13
|
||||||
|
BuildRequires: perl(parent)
|
||||||
|
BuildRequires: perl(Specio::Library::Builtins)
|
||||||
|
BuildRequires: perl(Specio::Library::String)
|
||||||
|
BuildRequires: perl(Try::Tiny)
|
||||||
|
# Tests only
|
||||||
|
BuildRequires: perl(base)
|
||||||
|
BuildRequires: perl(File::Copy)
|
||||||
|
BuildRequires: perl(File::Path)
|
||||||
|
BuildRequires: perl(File::Spec::Functions)
|
||||||
|
BuildRequires: perl(File::Temp)
|
||||||
|
BuildRequires: perl(lib)
|
||||||
|
BuildRequires: perl(overload)
|
||||||
|
BuildRequires: perl(Storable)
|
||||||
|
BuildRequires: perl(Sys::Hostname)
|
||||||
|
BuildRequires: perl(Test::Fatal)
|
||||||
|
# Test::Mojibake not used
|
||||||
|
BuildRequires: perl(Test::More) >= 0.96
|
||||||
|
BuildRequires: perl(Test::Requires)
|
||||||
|
%if %{with perl_DateTime_TimeZone_enables_optional_test}
|
||||||
|
# Optional tests
|
||||||
|
%if !%{defined perl_bootstrap}
|
||||||
|
BuildRequires: perl(DateTime) >= 0.1501
|
||||||
|
%endif
|
||||||
|
BuildRequires: perl(Test::Output)
|
||||||
|
BuildRequires: perl(Test::Taint)
|
||||||
|
%endif
|
||||||
|
Requires: perl(:MODULE_COMPAT_%(eval "$(perl -V:version)"; echo $version))
|
||||||
|
Requires: perl(File::Basename)
|
||||||
|
Requires: perl(File::Compare)
|
||||||
|
Requires: perl(File::Find)
|
||||||
|
# Require optional DateTime::TimeZone::Tzfile to work in mock after tzdata upgrade
|
||||||
|
Requires: perl(DateTime::TimeZone::Tzfile)
|
||||||
|
%if !%{defined perl_bootstrap} && %{defined tzversion}
|
||||||
|
Provides: bundled(tzdata) = %{tzversion}
|
||||||
|
%else
|
||||||
|
Provides: bundled(tzdata)
|
||||||
|
%endif
|
||||||
|
|
||||||
|
# Remove under-specified dependencies
|
||||||
|
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Class::Singleton\\)$
|
||||||
|
|
||||||
|
# Avoid circular dependencies - perl-DateTime strictly requires DateTime::TimeZone
|
||||||
|
%if 0%{?perl_bootstrap}
|
||||||
|
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(DateTime::Duration\\)
|
||||||
|
%endif
|
||||||
|
|
||||||
|
# Filter modules bundled for tests
|
||||||
|
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir}
|
||||||
|
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(T::RequireDateTime\\)
|
||||||
|
|
||||||
|
%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.
|
||||||
|
|
||||||
|
%package tests
|
||||||
|
Summary: Tests for %{name}
|
||||||
|
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||||
|
Requires: perl-Test-Harness
|
||||||
|
%if %{with perl_DateTime_TimeZone_enables_optional_test}
|
||||||
|
Requires: perl(Test::Output)
|
||||||
|
Requires: perl(Test::Taint)
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%description tests
|
||||||
|
Tests from %{name}. Execute them
|
||||||
|
with "%{_libexecdir}/%{name}/test".
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%if !%{defined perl_bootstrap} && %{defined tzversion}
|
||||||
|
%setup -q -T -a 1 -c -n tzdata-%{tzversion}
|
||||||
|
%endif
|
||||||
|
%setup -q -T -b 0 -n DateTime-TimeZone-%{version}
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
|
# Help generators to recognize Perl scripts
|
||||||
|
for F in t/*.t t/*.pl; do
|
||||||
|
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F"
|
||||||
|
chmod +x "$F"
|
||||||
|
done
|
||||||
|
|
||||||
|
%build
|
||||||
|
%if !%{defined perl_bootstrap} && %{defined tzversion}
|
||||||
|
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
|
||||||
|
%endif
|
||||||
|
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
|
||||||
|
%{make_build}
|
||||||
|
|
||||||
|
%install
|
||||||
|
%{make_install}
|
||||||
|
%{_fixperms} %{buildroot}/*
|
||||||
|
|
||||||
|
# Install tests
|
||||||
|
mkdir -p %{buildroot}%{_libexecdir}/%{name}
|
||||||
|
cp -a t %{buildroot}%{_libexecdir}/%{name}
|
||||||
|
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
|
||||||
|
#!/bin/sh
|
||||||
|
cd %{_libexecdir}/%{name} && exec prove -I . -r -j "$(getconf _NPROCESSORS_ONLN)"
|
||||||
|
EOF
|
||||||
|
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
|
||||||
|
|
||||||
|
%check
|
||||||
|
export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}')
|
||||||
|
make test
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license LICENSE
|
||||||
|
%doc Changes README.md
|
||||||
|
%{perl_vendorlib}/*
|
||||||
|
%{_mandir}/man3/*
|
||||||
|
|
||||||
|
%files tests
|
||||||
|
%{_libexecdir}/%{name}
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Thu Jun 30 2022 misaka00251 <misaka00251@misakanet.cn> - 2.52-1
|
||||||
|
- Init package (Thanks to fedora team)
|
||||||
BIN
tzdata2022a.tar.gz
Normal file
BIN
tzdata2022a.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user