From 56643bfddba2f7bca60955e5c48435fe58cc8e1c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 29 Nov 2019 12:25:08 +0000 Subject: [PATCH] Date::Parse is now optional -mda should not be dealing with broken Date: headers nowadays, and deprioritize it in our documentation and internal checks. --- INSTALL | 9 +++++---- Makefile.PL | 1 - TODO | 4 ---- ci/deps.perl | 2 +- lib/PublicInbox/Admin.pm | 2 +- lib/PublicInbox/MDA.pm | 5 ++--- 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/INSTALL b/INSTALL index a6ca7772..137c9a54 100644 --- a/INSTALL +++ b/INSTALL @@ -32,10 +32,6 @@ To accept incoming mail into a public inbox, you'll likely want: Beyond that, there is a long list of Perl modules required, starting with: -* Date::Parse deb: libtimedate-perl - pkg: p5-TimeDate - rpm: perl-TimeDate - * Digest::SHA typically installed with Perl rpm: perl-Digest-SHA @@ -81,6 +77,11 @@ Numerous optional modules are likely to be useful as well: (speeds up process spawning on Linux, see public-inbox-daemon(8)) +- Date::Parse deb: libtimedate-perl + pkg: p5-TimeDate + rpm: perl-TimeDate + (for broken, mostly historical emails) + - Plack::Middleware::ReverseProxy deb: libplack-middleware-reverseproxy-perl pkg: p5-Plack-Middleware-ReverseProxy rpm: perl-Plack-Middleware-ReverseProxy diff --git a/Makefile.PL b/Makefile.PL index c4495c4f..5faced63 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -110,7 +110,6 @@ WriteMakefile( # note: we use spamc(1), NOT the Perl modules # We also depend on git. # Keep this sorted and synced to the INSTALL document - 'Date::Parse' => 0, # libperl$PERL_VERSION, # `perl5' on FreeBSD diff --git a/TODO b/TODO index 369fc56e..0e31e6d7 100644 --- a/TODO +++ b/TODO @@ -110,10 +110,6 @@ all need to be considered for everything we introduce) * imperfect scraper importers for obfuscated list archives (e.g. obfuscated Mailman stuff, Google Groups, etc...) -* consider using HTTP::Date instead of Date::Parse, since we need the - former is capable of parsing RFC822-ish dates, used by Plack, and - the latter is missing from OpenBSD and maybe other distros. - * improve performance and avoid head-of-line blocking on slow storage * share "git cat-file --batch" processes across inboxes to avoid diff --git a/ci/deps.perl b/ci/deps.perl index ae6083b9..330ba2f3 100755 --- a/ci/deps.perl +++ b/ci/deps.perl @@ -19,7 +19,6 @@ my $profiles = { essential => [ qw( git perl - Date::Parse Devel::Peek Digest::SHA Email::Simple @@ -34,6 +33,7 @@ my $profiles = { # everything optional for normal use optional => [ qw( + Date::Parse BSD::Resource DBD::SQLite DBI diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm index dddeeae9..3d0d80b9 100644 --- a/lib/PublicInbox/Admin.pm +++ b/lib/PublicInbox/Admin.pm @@ -136,7 +136,7 @@ EOF } # TODO: make Devel::Peek optional, only used for daemon -my @base_mod = qw(Email::MIME Date::Parse Devel::Peek); +my @base_mod = qw(Email::MIME Devel::Peek); my @over_mod = qw(DBD::SQLite DBI); my %mod_groups = ( -index => [ @base_mod, @over_mod ], diff --git a/lib/PublicInbox/MDA.pm b/lib/PublicInbox/MDA.pm index b0dfac45..ef5e7dfa 100644 --- a/lib/PublicInbox/MDA.pm +++ b/lib/PublicInbox/MDA.pm @@ -6,7 +6,7 @@ package PublicInbox::MDA; use strict; use warnings; use Email::Simple; -use Date::Parse qw(strptime); +use PublicInbox::MsgTime; use constant MAX_SIZE => 1024 * 500; # same as spamc default, should be tunable use constant MAX_MID_SIZE => 244; # max term size - 1 in Xapian @@ -51,8 +51,7 @@ sub usable_str { } sub usable_date { - my @t = eval { strptime(@_) }; - scalar @t; + defined(eval { PublicInbox::MsgTime::str2date_zone($_[0]) }); } sub alias_specified { -- 2.44.0