diff options
-rw-r--r-- | nixpkgs/pkgs/servers/mail/public-inbox/0002-msgtime-drop-Date-Parse-for-RFC2822.patch | 172 | ||||
-rw-r--r-- | nixpkgs/pkgs/servers/mail/public-inbox/default.nix | 16 | ||||
-rw-r--r-- | overlays/patches/public-inbox/0001-view-don-t-show-page-if-no-links-follow-it.patch (renamed from overlays/patches/public-inbox/0003-view-don-t-show-page-if-no-links-follow-it.patch) | 10 | ||||
-rw-r--r-- | overlays/patches/public-inbox/0002-view-don-t-500-if-no-mail-received-yet.patch (renamed from overlays/patches/public-inbox/0004-view-don-t-500-if-no-mail-received-yet.patch) | 10 | ||||
-rw-r--r-- | overlays/patches/public-inbox/0003-wwwstream-make-source-info-configurable.patch (renamed from overlays/patches/public-inbox/0005-wwwstream-make-source-info-configurable.patch) | 28 | ||||
-rw-r--r-- | overlays/patches/public-inbox/default.nix | 13 |
6 files changed, 37 insertions, 212 deletions
diff --git a/nixpkgs/pkgs/servers/mail/public-inbox/0002-msgtime-drop-Date-Parse-for-RFC2822.patch b/nixpkgs/pkgs/servers/mail/public-inbox/0002-msgtime-drop-Date-Parse-for-RFC2822.patch deleted file mode 100644 index ebc9a6f22379..000000000000 --- a/nixpkgs/pkgs/servers/mail/public-inbox/0002-msgtime-drop-Date-Parse-for-RFC2822.patch +++ /dev/null @@ -1,172 +0,0 @@ -From c9b5164c954cd0de80d971f1c4ced16bf41ea81b Mon Sep 17 00:00:00 2001 -From: Eric Wong <e@80x24.org> -Date: Fri, 29 Nov 2019 12:25:07 +0000 -Subject: [PATCH 2/2] msgtime: drop Date::Parse for RFC2822 - -Date::Parse is not optimized for RFC2822 dates and isn't -packaged on OpenBSD. It's still useful for historical -email when email clients were less conformant, but is -less relevant for new emails. ---- - lib/PublicInbox/MsgTime.pm | 115 ++++++++++++++++++++++++++++++++----- - t/msgtime.t | 6 ++ - 2 files changed, 107 insertions(+), 14 deletions(-) - -diff --git a/lib/PublicInbox/MsgTime.pm b/lib/PublicInbox/MsgTime.pm -index 58e11d72..e9b27a49 100644 ---- a/lib/PublicInbox/MsgTime.pm -+++ b/lib/PublicInbox/MsgTime.pm -@@ -7,24 +7,114 @@ use strict; - use warnings; - use base qw(Exporter); - our @EXPORT_OK = qw(msg_timestamp msg_datestamp); --use Date::Parse qw(str2time strptime); -+use Time::Local qw(timegm); -+my @MoY = qw(january february march april may june -+ july august september october november december); -+my %MoY; -+@MoY{@MoY} = (0..11); -+@MoY{map { substr($_, 0, 3) } @MoY} = (0..11); -+ -+my %OBSOLETE_TZ = ( # RFC2822 4.3 (Obsolete Date and Time) -+ EST => '-0500', EDT => '-0400', -+ CST => '-0600', CDT => '-0500', -+ MST => '-0700', MDT => '-0600', -+ PST => '-0800', PDT => '-0700', -+ UT => '+0000', GMT => '+0000', Z => '+0000', -+ -+ # RFC2822 states: -+ # The 1 character military time zones were defined in a non-standard -+ # way in [RFC822] and are therefore unpredictable in their meaning. -+); -+my $OBSOLETE_TZ = join('|', keys %OBSOLETE_TZ); - - sub str2date_zone ($) { - my ($date) = @_; -+ my ($ts, $zone); -+ -+ # RFC822 is most likely for email, but we can tolerate an extra comma -+ # or punctuation as long as all the data is there. -+ # We'll use '\s' since Unicode spaces won't affect our parsing. -+ # SpamAssassin ignores commas and redundant spaces, too. -+ if ($date =~ /(?:[A-Za-z]+,?\s+)? # day-of-week -+ ([0-9]+),?\s+ # dd -+ ([A-Za-z]+)\s+ # mon -+ ([0-9]{2,})\s+ # YYYY or YY (or YYY :P) -+ ([0-9]+)[:\.] # HH: -+ ((?:[0-9]{2})|(?:\s?[0-9])) # MM -+ (?:[:\.]((?:[0-9]{2})|(?:\s?[0-9])))? # :SS -+ \s+ # a TZ offset is required: -+ ([\+\-])? # TZ sign -+ [\+\-]* # I've seen extra "-" e.g. "--500" -+ ([0-9]+|$OBSOLETE_TZ)(?:\s|$) # TZ offset -+ /xo) { -+ my ($dd, $m, $yyyy, $hh, $mm, $ss, $sign, $tz) = -+ ($1, $2, $3, $4, $5, $6, $7, $8); -+ # don't accept non-English months -+ defined(my $mon = $MoY{lc($m)}) or return; -+ -+ if (defined(my $off = $OBSOLETE_TZ{$tz})) { -+ $sign = substr($off, 0, 1); -+ $tz = substr($off, 1); -+ } -+ -+ # Y2K problems: 3-digit years, follow RFC2822 -+ if (length($yyyy) <= 3) { -+ $yyyy += 1900; -+ -+ # and 2-digit years from '09 (2009) (0..49) -+ $yyyy += 100 if $yyyy < 1950; -+ } -+ -+ $ts = timegm($ss // 0, $mm, $hh, $dd, $mon, $yyyy); - -- my $ts = str2time($date); -- return undef unless(defined $ts); -+ # Compute the time offset from [+-]HHMM -+ $tz //= 0; -+ my ($tz_hh, $tz_mm); -+ if (length($tz) == 1) { -+ $tz_hh = $tz; -+ $tz_mm = 0; -+ } elsif (length($tz) == 2) { -+ $tz_hh = 0; -+ $tz_mm = $tz; -+ } else { -+ $tz_hh = $tz; -+ $tz_hh =~ s/([0-9]{2})\z//; -+ $tz_mm = $1; -+ } -+ while ($tz_mm >= 60) { -+ $tz_mm -= 60; -+ $tz_hh += 1; -+ } -+ $sign //= '+'; -+ my $off = $sign . ($tz_mm * 60 + ($tz_hh * 60 * 60)); -+ $ts -= $off; -+ $sign = '+' if $off == 0; -+ $zone = sprintf('%s%02d%02d', $sign, $tz_hh, $tz_mm); - -- # off is the time zone offset in seconds from GMT -- my ($ss,$mm,$hh,$day,$month,$year,$off) = strptime($date); -- return undef unless(defined $off); -+ # Time::Zone and Date::Parse are part of the same distibution, -+ # and we need Time::Zone to deal with tz names like "EDT" -+ } elsif (eval { require Date::Parse }) { -+ $ts = Date::Parse::str2time($date); -+ return undef unless(defined $ts); - -- # Compute the time zone from offset -- my $sign = ($off < 0) ? '-' : '+'; -- my $hour = abs(int($off / 3600)); -- my $min = ($off / 60) % 60; -- my $zone = sprintf('%s%02d%02d', $sign, $hour, $min); -+ # off is the time zone offset in seconds from GMT -+ my ($ss,$mm,$hh,$day,$month,$year,$off) = -+ Date::Parse::strptime($date); -+ return undef unless(defined $off); -+ -+ # Compute the time zone from offset -+ my $sign = ($off < 0) ? '-' : '+'; -+ my $hour = abs(int($off / 3600)); -+ my $min = ($off / 60) % 60; -+ -+ $zone = sprintf('%s%02d%02d', $sign, $hour, $min); -+ } else { -+ warn "Date::Parse missing for non-RFC822 date: $date\n"; -+ return undef; -+ } - -+ # Note: we've already applied the offset to $ts at this point, -+ # but we want to keep "git fsck" happy. - # "-1200" is the furthest westermost zone offset, - # but git fast-import is liberal so we use "-1400" - if ($zone >= 1400 || $zone <= -1400) { -@@ -59,9 +149,6 @@ sub msg_date_only ($) { - my @date = $hdr->header_raw('Date'); - my ($ts); - foreach my $d (@date) { -- # Y2K problems: 3-digit years -- $d =~ s!([A-Za-z]{3}) ([0-9]{3}) ([0-9]{2}:[0-9]{2}:[0-9]{2})! -- my $yyyy = $2 + 1900; "$1 $yyyy $3"!e; - $ts = eval { str2date_zone($d) } and return $ts; - if ($@) { - my $mid = $hdr->header_raw('Message-ID'); -diff --git a/t/msgtime.t b/t/msgtime.t -index 6b396602..d9643b65 100644 ---- a/t/msgtime.t -+++ b/t/msgtime.t -@@ -84,4 +84,10 @@ is_deeply(datestamp('Fri, 28 Jun 2002 12:54:40 -700'), [1025294080, '-0700']); - is_deeply(datestamp('Sat, 12 Jan 2002 12:52:57 -200'), [1010847177, '-0200']); - is_deeply(datestamp('Mon, 05 Nov 2001 10:36:16 -800'), [1004985376, '-0800']); - -+# obsolete formats described in RFC2822 -+for (qw(UT GMT Z)) { -+ is_deeply(datestamp('Fri, 02 Oct 1993 00:00:00 '.$_), [ 749520000, '+0000']); -+} -+is_deeply(datestamp('Fri, 02 Oct 1993 00:00:00 EDT'), [ 749534400, '-0400']); -+ - done_testing(); --- -2.24.1 - diff --git a/nixpkgs/pkgs/servers/mail/public-inbox/default.nix b/nixpkgs/pkgs/servers/mail/public-inbox/default.nix index feee604db180..f2b4e2d483fa 100644 --- a/nixpkgs/pkgs/servers/mail/public-inbox/default.nix +++ b/nixpkgs/pkgs/servers/mail/public-inbox/default.nix @@ -1,4 +1,4 @@ -{ buildPerlPackage, lib, fetchurl, fetchpatch, makeWrapper +{ buildPerlPackage, lib, fetchurl, makeWrapper , DBDSQLite, EmailMIME, IOSocketSSL, IPCRun, Plack, PlackMiddlewareReverseProxy , SearchXapian, TimeDate, URI , git, highlight, openssl, xapian @@ -29,21 +29,13 @@ in buildPerlPackage rec { pname = "public-inbox"; - version = "1.2.0"; + version = "1.3.0"; src = fetchurl { - url = "https://public-inbox.org/releases/public-inbox-${version}.tar.gz"; - sha256 = "0sa2m4f2x7kfg3mi4im7maxqmqvawafma8f7g92nyfgybid77g6s"; + url = "https://public-inbox.org/public-inbox.git/snapshot/public-inbox-${version}.tar.gz"; + sha256 = "0ns2hky5q3c45df8qmxr06xnz52c3ail2pgl2vwhl3klbq1n6qv8"; }; - patches = [ - (fetchpatch { - url = "https://public-inbox.org/meta/20200101032822.GA13063@dcvr/raw"; - sha256 = "0ncxqqkvi5lwi8zaa7lk7l8mf8h278raxsvbvllh3z7jhfb48r3l"; - }) - ./0002-msgtime-drop-Date-Parse-for-RFC2822.patch - ]; - outputs = [ "out" "devdoc" "sa_config" ]; postConfigure = '' diff --git a/overlays/patches/public-inbox/0003-view-don-t-show-page-if-no-links-follow-it.patch b/overlays/patches/public-inbox/0001-view-don-t-show-page-if-no-links-follow-it.patch index 811d6149d994..5ece14d2f5b0 100644 --- a/overlays/patches/public-inbox/0003-view-don-t-show-page-if-no-links-follow-it.patch +++ b/overlays/patches/public-inbox/0001-view-don-t-show-page-if-no-links-follow-it.patch @@ -1,17 +1,17 @@ -From 054697a5129725f900a84bbdfee356a4f5373376 Mon Sep 17 00:00:00 2001 +From f5ec336b6354a713c48d8934ba0769caf5be6dac Mon Sep 17 00:00:00 2001 From: Alyssa Ross <hi@alyssa.is> Date: Thu, 16 Jan 2020 18:08:33 +0000 -Subject: [PATCH 3/5] view: don't show `page:' if no links follow it +Subject: [PATCH 1/3] view: don't show `page:' if no links follow it --- lib/PublicInbox/View.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm -index 39b04174..aebf7fe9 100644 +index d097d8ab..374733be 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm -@@ -1157,7 +1157,9 @@ sub pagination_footer ($$) { +@@ -1149,7 +1149,9 @@ sub pagination_footer ($$) { $next = $next ? "$next " : ' '; $prev .= qq! <a\nhref='$latest'>latest</a>!; } @@ -23,5 +23,5 @@ index 39b04174..aebf7fe9 100644 sub index_nav { # callback for WwwStream -- -2.26.1 +2.30.0 diff --git a/overlays/patches/public-inbox/0004-view-don-t-500-if-no-mail-received-yet.patch b/overlays/patches/public-inbox/0002-view-don-t-500-if-no-mail-received-yet.patch index eb33468e1992..4514f208fbb7 100644 --- a/overlays/patches/public-inbox/0004-view-don-t-500-if-no-mail-received-yet.patch +++ b/overlays/patches/public-inbox/0002-view-don-t-500-if-no-mail-received-yet.patch @@ -1,17 +1,17 @@ -From 2712913f07d83a6a33bbdc55a1edee0a008e5b2e Mon Sep 17 00:00:00 2001 +From e75f974450d7b6a35a5b444a77c133b19490c953 Mon Sep 17 00:00:00 2001 From: Alyssa Ross <hi@alyssa.is> Date: Thu, 16 Jan 2020 18:09:12 +0000 -Subject: [PATCH 4/5] view: don't 500 if no mail received yet +Subject: [PATCH 2/3] view: don't 500 if no mail received yet --- lib/PublicInbox/View.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm -index aebf7fe9..b40108bc 100644 +index 374733be..070a288c 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm -@@ -1083,7 +1083,7 @@ sub acc_topic { +@@ -1077,7 +1077,7 @@ sub acc_topic { # walk_thread callback sub dump_topics { my ($ctx) = @_; my $order = delete $ctx->{order}; # [ ds, subj1, subj2, subj3, ... ] @@ -21,5 +21,5 @@ index aebf7fe9..b40108bc 100644 return 404; } -- -2.26.1 +2.30.0 diff --git a/overlays/patches/public-inbox/0005-wwwstream-make-source-info-configurable.patch b/overlays/patches/public-inbox/0003-wwwstream-make-source-info-configurable.patch index 605100cd38ae..2d424fcf53c9 100644 --- a/overlays/patches/public-inbox/0005-wwwstream-make-source-info-configurable.patch +++ b/overlays/patches/public-inbox/0003-wwwstream-make-source-info-configurable.patch @@ -1,7 +1,7 @@ -From f119d4315be998de65d5a1b56fa643fb9084410b Mon Sep 17 00:00:00 2001 +From c3429a2c3cf743418167ed41e28bfc8e1c19f7e5 Mon Sep 17 00:00:00 2001 From: Alyssa Ross <hi@alyssa.is> Date: Fri, 17 Jan 2020 15:21:42 +0000 -Subject: [PATCH 5/5] wwwstream: make source info configurable +Subject: [PATCH 3/3] wwwstream: make source info configurable --- Documentation/public-inbox-config.pod | 6 ++++++ @@ -10,7 +10,7 @@ Subject: [PATCH 5/5] wwwstream: make source info configurable 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Documentation/public-inbox-config.pod b/Documentation/public-inbox-config.pod -index 1c5ba015..5ae23924 100644 +index 53926ef4..4db3e002 100644 --- a/Documentation/public-inbox-config.pod +++ b/Documentation/public-inbox-config.pod @@ -186,6 +186,12 @@ and the path may be "/dev/null" or any empty file. @@ -27,10 +27,10 @@ index 1c5ba015..5ae23924 100644 This may be set to C<none> to disable the use of SpamAssassin diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm -index 03534f03..f1a1fd81 100644 +index fa76fbb6..ed59cd43 100644 --- a/lib/PublicInbox/WwwListing.pm +++ b/lib/PublicInbox/WwwListing.pm -@@ -87,8 +87,8 @@ sub ibx_entry { +@@ -95,8 +95,8 @@ sub ibx_entry { $tmp; } @@ -41,8 +41,8 @@ index 03534f03..f1a1fd81 100644 my $title = 'public-inbox'; my $out = ''; my $code = 404; -@@ -107,7 +107,8 @@ sub html ($$) { - $out = '<pre>'.$l->linkify_2(ascii_html($tmp)).'</pre><hr>'; +@@ -114,7 +114,8 @@ sub html ($$) { + $out = '<pre>'.$l->to_html($tmp).'</pre><hr>'; } $out = "<html><head><title>$title</title></head><body>" . $out; - $out .= '<pre>'. PublicInbox::WwwStream::code_footer($env) . @@ -51,7 +51,7 @@ index 03534f03..f1a1fd81 100644 '</pre></body></html>'; my $h = [ 'Content-Type', 'text/html; charset=UTF-8' ]; -@@ -231,7 +232,7 @@ sub call { +@@ -239,7 +240,7 @@ sub call { js($env, $list); } else { # / my $list = $self->{www_cb}->($self, $env, 'www'); @@ -61,11 +61,11 @@ index 03534f03..f1a1fd81 100644 } diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm -index 0f4f55d0..09473c9f 100644 +index 3a867ec3..08d4ba30 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm -@@ -76,10 +76,30 @@ sub _html_top ($) { - "</head><body>". $top . $tip; +@@ -71,10 +71,30 @@ sub _html_top ($) { + '</head><body>'. $top . (delete($ctx->{-html_tip}) // ''); } -sub code_footer ($) { @@ -88,7 +88,7 @@ index 0f4f55d0..09473c9f 100644 +sub code_footer { + my ($pi_config, $env) = @_; + - my $u = PublicInbox::Hval::prurl($env, $CODE_URL); + my $u = prurl($env, $CODE_URL); - qq(AGPL code for this site: git clone <a\nhref="$u">$u</a>) + my $default_info = qq(git clone <a\n href="$u">$u</a>); + @@ -98,7 +98,7 @@ index 0f4f55d0..09473c9f 100644 } sub _html_end { -@@ -153,7 +173,7 @@ EOF +@@ -146,7 +166,7 @@ EOF '<hr><pre>'.join("\n\n", $desc, $urls, @@ -108,5 +108,5 @@ index 0f4f55d0..09473c9f 100644 } -- -2.26.1 +2.30.0 diff --git a/overlays/patches/public-inbox/default.nix b/overlays/patches/public-inbox/default.nix index f9f573787c1c..26f21c6da11b 100644 --- a/overlays/patches/public-inbox/default.nix +++ b/overlays/patches/public-inbox/default.nix @@ -1,9 +1,14 @@ -{ public-inbox }: +{ public-inbox, fetchpatch }: public-inbox.overrideAttrs ({ patches ? [], ... }: { patches = patches ++ [ - ./0003-view-don-t-show-page-if-no-links-follow-it.patch - ./0004-view-don-t-500-if-no-mail-received-yet.patch - ./0005-wwwstream-make-source-info-configurable.patch + (fetchpatch { + url = "https://80x24.org/public-inbox.git/patch/?id=41ecd08ee60daa495de3a2fc2c0296dc9cc9a0b3"; + sha256 = "1skn2ncr9g6k78fiscwkqisg4k0pv133sf4pyzryn3ahb09i1yqn"; + }) + + ./0001-view-don-t-show-page-if-no-links-follow-it.patch + ./0002-view-don-t-500-if-no-mail-received-yet.patch + ./0003-wwwstream-make-source-info-configurable.patch ]; }) |