From e6c85810fc1536676fb72b4bf050aca72f0e9b10 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 5 Apr 2014 03:17:35 +0000 Subject: remove failrepo config We will just use the fallback in Email::Filter to reduce configuration knobs. Failed messages are failed messages, do not classify them beyond that. --- examples/public-inbox-config | 7 ++++--- lib/PublicInbox/Config.pm | 2 +- public-inbox-mda | 12 +----------- t/config.t | 1 - t/mda.t | 12 +++++------- 5 files changed, 11 insertions(+), 23 deletions(-) diff --git a/examples/public-inbox-config b/examples/public-inbox-config index 9e781d63..fd97600f 100644 --- a/examples/public-inbox-config +++ b/examples/public-inbox-config @@ -3,10 +3,11 @@ [publicinbox "test"] address = test@public-inbox.org mainrepo = /home/pi/test-main.git - failrepo = /home/pi/test-fail.git - description = test box, occasionally reset + description = test repo, occasionally reset + url = http://example.com/test [publicinbox "bugs"] address = bugs@public-inbox.org mainrepo = /home/pi/bugs-main.git - failrepo = /home/pi/bugs-fail.git description = development discussion + url = http://example.com/bugs + atomUrl = http://example.com/bugs diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index b13e5cec..b6885a31 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -34,7 +34,7 @@ sub lookup { my %rv = map { $_ => $self->{"$pfx.$_"} - } (qw(mainrepo failrepo description address)); + } (qw(mainrepo description address)); \%rv; } diff --git a/public-inbox-mda b/public-inbox-mda index 8f63fa7e..aabc37eb 100755 --- a/public-inbox-mda +++ b/public-inbox-mda @@ -29,7 +29,6 @@ defined $recipient or die "RECIPIENT not defined in ENV\n"; my $dst = $config->lookup($recipient); defined $dst or exit(1); my $main_repo = $dst->{mainrepo} or exit(1); -my $fail_repo = $dst->{failrepo} or exit(1); my $filtered; # string dest if (PublicInbox->precheck($filter, $recipient) && @@ -44,19 +43,10 @@ if (PublicInbox->precheck($filter, $recipient) && if (do_spamc($simple, \$filtered)) { $filter->simple(Email::Simple->new($filtered)); $filter->pipe(MDA, $main_repo); - } else { - $filter->pipe(MDA, $fail_repo); } - } else { - # PublicInbox::Filter nuked everything, oops :x - $filter->pipe(MDA, $fail_repo); } -} else { - # if SA thinks it's spam or there's an error: - # don't bother with our own filtering - $filter->pipe(MDA, $fail_repo); } -die "Email::Filter failed to exit\n"; +exit 0; # goes to failbox # we depend on "report_safe 0" in /etc/spamassassin/*.cf with --headers # not using Email::Filter->pipe here since we want the stdout of diff --git a/t/config.t b/t/config.t index 3ff7b370..145589ea 100644 --- a/t/config.t +++ b/t/config.t @@ -26,7 +26,6 @@ my $tmpdir = tempdir(CLEANUP => 1); my $cfg = PublicInbox::Config->new($f); is_deeply($cfg->lookup('bugs@public-inbox.org'), { - 'failrepo' => '/home/pi/bugs-fail.git', 'mainrepo' => '/home/pi/bugs-main.git', 'address' => 'bugs@public-inbox.org', 'description' => 'development discussion' diff --git a/t/mda.t b/t/mda.t index 9f918d35..755864ca 100644 --- a/t/mda.t +++ b/t/mda.t @@ -14,7 +14,6 @@ my $home = "$tmpdir/pi-home"; my $pi_home = "$home/.public-inbox"; my $pi_config = "$pi_home/config"; my $maindir = "$tmpdir/main.git"; -my $faildir = "$tmpdir/fail.git"; my $main_bin = getcwd()."/t/main-bin"; my $main_path = "$main_bin:$ENV{PATH}"; # for spamc ham mock my $fail_bin = getcwd()."/t/fail-bin"; @@ -31,12 +30,10 @@ my $cfgpfx = "publicinbox.test"; is(1, mkdir($home, 0755), "setup ~/ for testing"); is(1, mkdir($pi_home, 0755), "setup ~/.public-inbox"); is(0, system(qw(git init -q --bare), $maindir), "git init (main)"); - is(0, system(qw(git init -q --bare), $faildir), "git init (fail)"); my %cfg = ( "$cfgpfx.address" => $addr, "$cfgpfx.mainrepo" => $maindir, - "$cfgpfx.failrepo" => $faildir, ); while (my ($k,$v) = each %cfg) { is(0, system(qw(git config --file), $pi_config, $k, $v), @@ -71,13 +68,14 @@ EOF # ensure failures work { + ok(!-e $failbox, "nothing in PI_FAILBOX before"); local $ENV{PATH} = $fail_path; run([$mda], \$in); - local $ENV{GIT_DIR} = $faildir; - my $rev = `git rev-list HEAD`; - like($rev, qr/\A[a-f0-9]{40}/, "bad revision committed"); + local $ENV{GIT_DIR} = $maindir; + my @revs = `git rev-list HEAD`; + is(scalar @revs, 1, "bad revision not committed"); + ok(-s $failbox > 0, "PI_FAILBOX is written to"); } - ok(!-e $failbox, "nothing in PI_FAILBOX"); } done_testing(); -- cgit v1.2.3-24-ge0c7