From 2ea68e55f0aa3a1360eb61943e38d939d0e11df2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:25:00 +0000 Subject: import perl-DateTime-1.04-6.el7 --- diff --git a/SOURCES/DateTime-1.04-Add-leap-second-on-December-31-2016.patch b/SOURCES/DateTime-1.04-Add-leap-second-on-December-31-2016.patch new file mode 100644 index 0000000..d0d0c96 --- /dev/null +++ b/SOURCES/DateTime-1.04-Add-leap-second-on-December-31-2016.patch @@ -0,0 +1,51 @@ +From 5375759f62132dc8328baf939e471a32a6a3b3f5 Mon Sep 17 00:00:00 2001 +From: Dave Rolsky +Date: Wed, 6 Jul 2016 08:49:37 -0500 +Subject: [PATCH 2/2] Add leap second on December 31, 2016 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Písař +--- + leaptab.txt | 1 + + lib/DateTime/LeapSecond.pm | 1 + + t/19leap-second.t | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/leaptab.txt b/leaptab.txt +index 4075fbd..e9fb846 100644 +--- a/leaptab.txt ++++ b/leaptab.txt +@@ -24,3 +24,4 @@ + 2009 Jan. 1 +1 + 2012 Jul. 1 +1 + 2015 Jul. 1 +1 ++2017 Jan. 1 +1 +diff --git a/lib/DateTime/LeapSecond.pm b/lib/DateTime/LeapSecond.pm +index 736f2eb..b936c72 100644 +--- a/lib/DateTime/LeapSecond.pm ++++ b/lib/DateTime/LeapSecond.pm +@@ -107,6 +107,7 @@ sub _initialize { + 2009 Jan. 1 +1 + 2012 Jun. 1 +1 + 2015 Jul. 1 +1 ++ 2017 Jan. 1 +1 + ) + ); + } +diff --git a/t/19leap-second.t b/t/19leap-second.t +index 3d9434c..9d3f6eb 100644 +--- a/t/19leap-second.t ++++ b/t/19leap-second.t +@@ -1157,6 +1157,7 @@ use DateTime; + [ 2008, 12, 31 ], + [ 2012, 6, 30 ], + [ 2015, 6, 30 ], ++ [ 2016, 12, 31 ], + ) { + my $formatted = join '-', map { sprintf( '%02d', $_ ) } @{$date}; + +-- +2.5.5 + diff --git a/SOURCES/DateTime-1.04-There-will-be-a-leap-second-on-June-30-2015.patch b/SOURCES/DateTime-1.04-There-will-be-a-leap-second-on-June-30-2015.patch new file mode 100644 index 0000000..dcf5c89 --- /dev/null +++ b/SOURCES/DateTime-1.04-There-will-be-a-leap-second-on-June-30-2015.patch @@ -0,0 +1,61 @@ +From 27a96035f1da2ff0f4801fedffdb7a8cdadd3fc7 Mon Sep 17 00:00:00 2001 +From: Dave Rolsky +Date: Mon, 5 Jan 2015 08:53:52 -0600 +Subject: [PATCH 1/2] There will be a leap second on June 30, 2015 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Písař +--- + leaptab.txt | 1 + + lib/DateTime/LeapSecond.pm | 4 +--- + t/19leap-second.t | 1 + + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/leaptab.txt b/leaptab.txt +index f1c7f2e..4075fbd 100644 +--- a/leaptab.txt ++++ b/leaptab.txt +@@ -23,3 +23,4 @@ + 2006 Jan. 1 +1 + 2009 Jan. 1 +1 + 2012 Jul. 1 +1 ++2015 Jul. 1 +1 +diff --git a/lib/DateTime/LeapSecond.pm b/lib/DateTime/LeapSecond.pm +index c5bf97c..736f2eb 100644 +--- a/lib/DateTime/LeapSecond.pm ++++ b/lib/DateTime/LeapSecond.pm +@@ -74,9 +74,6 @@ sub day_length { + + sub _initialize { + +- # this table: ftp://62.161.69.5/pub/tai/publication/leaptab.txt +- # known accurate until (at least): 2005-12-31 +- # + # There are no leap seconds before 1972, because that's the + # year this system was implemented. + # +@@ -109,6 +106,7 @@ sub _initialize { + 2006 Jan. 1 +1 + 2009 Jan. 1 +1 + 2012 Jun. 1 +1 ++ 2015 Jul. 1 +1 + ) + ); + } +diff --git a/t/19leap-second.t b/t/19leap-second.t +index ecd2598..3d9434c 100644 +--- a/t/19leap-second.t ++++ b/t/19leap-second.t +@@ -1156,6 +1156,7 @@ use DateTime; + [ 2005, 12, 31 ], + [ 2008, 12, 31 ], + [ 2012, 6, 30 ], ++ [ 2015, 6, 30 ], + ) { + my $formatted = join '-', map { sprintf( '%02d', $_ ) } @{$date}; + +-- +2.5.5 + diff --git a/SOURCES/DateTime-1.06-Don-t-leave-the-object-in-a-modified-state-after-a-f.patch b/SOURCES/DateTime-1.06-Don-t-leave-the-object-in-a-modified-state-after-a-f.patch new file mode 100644 index 0000000..cd847db --- /dev/null +++ b/SOURCES/DateTime-1.06-Don-t-leave-the-object-in-a-modified-state-after-a-f.patch @@ -0,0 +1,96 @@ +From d744bf17b7a0e0158eb813a8605cc0d8635f8959 Mon Sep 17 00:00:00 2001 +From: Dave Rolsky +Date: Sat, 3 May 2014 11:39:47 +0800 +Subject: [PATCH] Don't leave the object in a modified state after a failed + truncate( to => 'week' ) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Petr Pisar: Ported to 1.06. + +Signed-off-by: Petr Písař +--- + lib/DateTime.pm | 11 ++++++++++- + t/16truncate.t | 38 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 48 insertions(+), 1 deletion(-) + +diff --git a/lib/DateTime.pm b/lib/DateTime.pm +index 1ff4c2e..a8663b2 100644 +--- a/lib/DateTime.pm ++++ b/lib/DateTime.pm +@@ -1985,7 +1985,16 @@ sub set_formatter { + $self->add( days => -1 * $day_diff ); + } + +- return $self->truncate( to => 'day' ); ++ # This can fail if the truncate ends up giving us an invalid local ++ # date time. If that happens we need to reverse the addition we ++ # just did. See https://rt.cpan.org/Ticket/Display.html?id=93347. ++ try { ++ $self->truncate( to => 'day' ); ++ } ++ catch { ++ $self->add( days => $day_diff ); ++ die $_; ++ }; + } + else { + my $truncate; +diff --git a/t/16truncate.t b/t/16truncate.t +index 0058f50..a478760 100644 +--- a/t/16truncate.t ++++ b/t/16truncate.t +@@ -5,6 +5,7 @@ use Test::Fatal; + use Test::More 0.88; + + use DateTime; ++use Try::Tiny; + + my %vals = ( + year => 50, +@@ -233,4 +234,41 @@ my %vals = ( + } + } + ++{ ++ my $dt = DateTime->new( ++ year => 2010, ++ month => 3, ++ day => 25, ++ hour => 1, ++ minute => 5, ++ time_zone => 'Asia/Tehran', ++ ); ++ ++ is( ++ $dt->day_of_week(), ++ 4, ++ 'day of week is Thursday' ++ ); ++ ++ my $error; ++ try { ++ $dt->truncate( to => 'week' ); ++ } ++ catch { ++ $error = $_; ++ }; ++ ++ like( ++ $error, ++ qr/Invalid local time for date/, ++ 'truncate operation threw an error because of an invalid local datetime' ++ ); ++ ++ is( ++ $dt->day_of_week(), ++ 4, ++ 'day of week does not change after failed truncate() call' ++ ); ++} ++ + done_testing(); +-- +1.9.0 + diff --git a/SPECS/perl-DateTime.spec b/SPECS/perl-DateTime.spec index c0b9cc5..2e936cd 100644 --- a/SPECS/perl-DateTime.spec +++ b/SPECS/perl-DateTime.spec @@ -1,13 +1,23 @@ Name: perl-DateTime Epoch: 2 Version: 1.04 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Date and time object License: (Artistic 2.0) and (GPL+ or Artistic) Group: Development/Libraries URL: http://search.cpan.org/dist/DateTime/ Source0: http://www.cpan.org/authors/id/D/DR/DROLSKY/DateTime-%{version}.tar.gz +# Restore object after failed truncate() call, bug #1095111, CPAN RT#93347, +# in 1.09 +Patch0: DateTime-1.06-Don-t-leave-the-object-in-a-modified-state-after-a-f.patch +# Add 2015-06-30 leap second, bug #1353509, in 1.20 +Patch1: DateTime-1.04-There-will-be-a-leap-second-on-June-30-2015.patch +# Add 2016-12-31 leap second, bug #1353509, in 1.34 +Patch2: DateTime-1.04-Add-leap-second-on-December-31-2016.patch BuildRequires: perl +BuildRequires: perl(autodie) +BuildRequires: perl(integer) +BuildRequires: perl(lib) BuildRequires: perl(Module::Build) BuildRequires: perl(strict) BuildRequires: perl(warnings) @@ -55,6 +65,10 @@ believed to be the birth of Jesus Christ. %prep %setup -q -n DateTime-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +./tools/leap_seconds_header.pl %build %{__perl} Build.PL installdirs=vendor optimize="%{optflags}" @@ -75,6 +89,10 @@ find %{buildroot} -type f -name '*.bs' -size 0 -exec rm -f {} \; %{_mandir}/man3/* %changelog +* Wed May 07 2014 Petr Pisar - 2:1.04-6 +- Restore object after failed truncate() call (bug #1095111) +- Add 2015-06-30 and 2016-12-31 leap seconds (bug #1353509) + * Tue Jan 28 2014 Jitka Plesnikova - 2:1.04-5 - Fix license tag - Resolves: rhbz#1058691