]> Sergey Matveev's repositories - public-inbox.git/commitdiff
remove failrepo config
authorEric Wong <normalperson@yhbt.net>
Sat, 5 Apr 2014 03:17:35 +0000 (03:17 +0000)
committerEric Wong <normalperson@yhbt.net>
Sat, 5 Apr 2014 06:55:35 +0000 (06:55 +0000)
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
lib/PublicInbox/Config.pm
public-inbox-mda
t/config.t
t/mda.t

index 9e781d6350df31ef88f5d08ce3aaa1187050f242..fd97600f7d0fbceb823611dd1bdb1a2dd0c51827 100644 (file)
@@ -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
index b13e5cecdeb79ef0b1861577b886448fec4ccbf2..b6885a3108dfec79b72d5d28e25f8e8644605a44 100644 (file)
@@ -34,7 +34,7 @@ sub lookup {
 
        my %rv = map {
                $_ => $self->{"$pfx.$_"}
-       } (qw(mainrepo failrepo description address));
+       } (qw(mainrepo description address));
        \%rv;
 }
 
index 8f63fa7ecba133621dd807955a71947aa66262ba..aabc37ebf3c4b0a2c6ba3ed090c49c775406551b 100755 (executable)
@@ -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
index 3ff7b3706c54672ea7fa63cbfd6c9d42311af191..145589ead5d227e50e21a84589d7b1ee0b770a2a 100644 (file)
@@ -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 9f918d35601286c6afa679abdded19cda40438ab..755864ca890a9f4540d947a5bca736c9abbe0492 100644 (file)
--- 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();