From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A03FD1F46D for ; Fri, 29 Nov 2019 12:25:09 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/4] Date::Parse is now optional Date: Fri, 29 Nov 2019 12:25:08 +0000 Message-Id: <20191129122508.7708-5-e@80x24.org> In-Reply-To: <20191129122508.7708-1-e@80x24.org> References: <20191129122508.7708-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: -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 4d54e6a0..d41e513d 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 4aa0caa7..c211bd5d 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -28,7 +28,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 922163f8..592e306c 100644 --- a/TODO +++ b/TODO @@ -104,10 +104,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 {