diff options
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | debian/control | 4 | ||||
-rw-r--r-- | scripts/Dpkg/Changelog/Entry/Debian.pm | 10 | ||||
-rw-r--r-- | scripts/t/Dpkg_Changelog.t | 12 | ||||
-rw-r--r-- | scripts/t/Dpkg_Changelog/date-format | 17 |
6 files changed, 40 insertions, 7 deletions
@@ -76,7 +76,6 @@ To enable optional functionality or programs, this software might be needed: To run the test suite («make check»): - TimeDate perl module IO-String perl module Test::Pod perl module (optional) Test::Strict perl module (optional) diff --git a/debian/changelog b/debian/changelog index 6d6ebeaf1..b5e2dbc84 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,9 @@ dpkg (1.18.2) UNRELEASED; urgency=low * Perl modules: - Remove non-functional timezone name support from Dpkg::Changelog::Entry::Debian. + - Use Time::Piece (part of the perl core distribution) instead of + Date::Parse in Dpkg::Changelog::Entry::Debian. This reduces the build + and run-time dependencies, and helps architecture bootstrapping. * Documentation: - Fix grammar in dpkg-architecture(1). Thanks to Chris Lamb <lamby@debian.org>. Closes: #787616 diff --git a/debian/control b/debian/control index aa8359db4..21dde5a1b 100644 --- a/debian/control +++ b/debian/control @@ -15,7 +15,7 @@ Build-Depends: debhelper (>= 9), pkg-config, flex, libselinux1-dev (>= 1.28-4) [linux-any], libkvm-dev [kfreebsd-any], libncursesw5-dev, - libtimedate-perl, libio-string-perl + libio-string-perl Package: libdpkg-dev Section: libdevel @@ -68,7 +68,7 @@ Section: perl Priority: optional Architecture: all Multi-Arch: foreign -Depends: dpkg (>= 1.16.3), perl, libtimedate-perl, ${misc:Depends} +Depends: dpkg (>= 1.16.3), perl, ${misc:Depends} Recommends: libfile-fcntllock-perl, bzip2, xz-utils Suggests: debian-keyring, gnupg | gnupg2, gpgv | gpgv2, gcc | c-compiler, binutils, patch diff --git a/scripts/Dpkg/Changelog/Entry/Debian.pm b/scripts/Dpkg/Changelog/Entry/Debian.pm index e4c21935f..5a50ff183 100644 --- a/scripts/Dpkg/Changelog/Entry/Debian.pm +++ b/scripts/Dpkg/Changelog/Entry/Debian.pm @@ -29,7 +29,7 @@ our @EXPORT_OK = qw( ); use Exporter qw(import); -use Date::Parse; +use Time::Piece; use Dpkg::Gettext; use Dpkg::Control::Fields; @@ -164,7 +164,13 @@ sub check_trailer { if ($3 ne ' ') { push @errors, g_('badly formatted trailer line'); } - unless (defined str2time($4)) { + + my $fmt = ''; + $fmt .= '%a, ' if defined $5; + $fmt .= '%d %b %Y %T %z'; + + local $ENV{LC_ALL} = 'C'; + unless (defined Time::Piece->strptime($4, $fmt)) { push @errors, sprintf(g_("couldn't parse date %s"), $4); } } else { diff --git a/scripts/t/Dpkg_Changelog.t b/scripts/t/Dpkg_Changelog.t index f633978c4..c66f40af8 100644 --- a/scripts/t/Dpkg_Changelog.t +++ b/scripts/t/Dpkg_Changelog.t @@ -16,7 +16,7 @@ use strict; use warnings; -use Test::More tests => 84; +use Test::More tests => 92; use File::Basename; @@ -36,7 +36,7 @@ my $vendor = get_current_vendor(); ######################### foreach my $file ("$datadir/countme", "$datadir/shadow", "$datadir/fields", - "$datadir/regressions") { + "$datadir/regressions", "$datadir/date-format") { my $changes = Dpkg::Changelog::Debian->new(verbose => 0); $changes->load($file); @@ -288,6 +288,14 @@ Xb-Userfield2: foobar ', 'change items 2'); is($items[5], " * Update S-V.\n", 'change items 3'); } + if ($file eq "$datadir/date-format") { + is($data[0]->get_timestamp(), '01 Jul 2100 23:59:59 -1200', + 'get date w/o DoW, and negative timezone offset'); + is($data[1]->get_timestamp(), 'Tue, 27 Feb 2050 12:00:00 +1245', + 'get date w/ DoW, and positive timezone offset'); + is($data[2]->get_timestamp(), 'Mon, 01 Jan 2000 00:00:00 +0000', + 'get date w/ DoW, and zero timezone offset'); + } if ($file eq "$datadir/regressions") { my $f = $changes->dpkg(); is("$f->{Version}", '0', 'version 0 correctly parsed'); diff --git a/scripts/t/Dpkg_Changelog/date-format b/scripts/t/Dpkg_Changelog/date-format new file mode 100644 index 000000000..0916fb2db --- /dev/null +++ b/scripts/t/Dpkg_Changelog/date-format @@ -0,0 +1,17 @@ +date-format (0.2) unstable; urgency=low + + * Date without day of week name and negative timezone offset. + + -- Dpkg Developers <debian-dpkg@lists.debian.org> 01 Jul 2100 23:59:59 -1200 + +date-format (0.1) unstable; urgency=low + + * Date with day of week name and positive timezone offset. + + -- Dpkg Developers <debian-dpkg@lists.debian.org> Tue, 27 Feb 2050 12:00:00 +1245 + +date-format (0.0) unstable; urgency=low + + * Date with day of week name and zero timezone offset. + + -- Dpkg Developers <debian-dpkg@lists.debian.org> Mon, 01 Jan 2000 00:00:00 +0000 |