]> Sergey Matveev's repositories - public-inbox.git/commitdiff
Merge remote-tracking branch 'origin/inboxdir'
authorEric Wong <e@80x24.org>
Thu, 17 Oct 2019 08:19:11 +0000 (08:19 +0000)
committerEric Wong <e@80x24.org>
Thu, 17 Oct 2019 08:19:11 +0000 (08:19 +0000)
* origin/inboxdir:
  config: remove redundant inboxdir check
  config: support "inboxdir" in addition to "mainrepo"
  examples/grok-pull.post_update_hook: use "inbox_dir"

1  2 
lib/PublicInbox/WwwStream.pm
script/public-inbox-mda
t/mda.t

index 06c8f7d2c65ff87e16a682a466b6f5062446063b,6696cc35d4d1e24e402ab6ad49f03275a0761333..0f4f55d0f7246a68ee737ecb7b445cc7d8ddee31
@@@ -11,7 -11,8 +11,7 @@@ use strict
  use warnings;
  use PublicInbox::Hval qw(ascii_html);
  our $TOR_URL = 'https://www.torproject.org/';
 -our $CODE_URL = 'https://public-inbox.org/';
 -our $PROJECT = 'public-inbox';
 +our $CODE_URL = 'https://public-inbox.org/public-inbox.git';
  
  # noop for HTTP.pm (and any other PSGI servers)
  sub close {}
@@@ -79,7 -80,7 +79,7 @@@ sub _html_top ($) 
  sub code_footer ($) {
        my ($env) = @_;
        my $u = PublicInbox::Hval::prurl($env, $CODE_URL);
 -      qq(AGPL code for this site: git clone <a\nhref="$u">$u</a> $PROJECT)
 +      qq(AGPL code for this site: git clone <a\nhref="$u">$u</a>)
  }
  
  sub _html_end {
@@@ -97,7 -98,7 +97,7 @@@
                $seen{$http} = 1;
                for my $i (0..$max) {
                        # old parts my be deleted:
-                       -d "$ibx->{mainrepo}/git/$i.git" or next;
+                       -d "$ibx->{inboxdir}/git/$i.git" or next;
                        my $url = "$http/$i";
                        $seen{$url} = 1;
                        push @urls, "$url $dir/git/$i.git";
diff --combined script/public-inbox-mda
index 9b8753da1877d320bc4fb0f2d32a6d0f208f3066,dea49dc547820616ad88a53d0bd2e39b91ab34f1..584218b54c5a179d9b4adb86e0ef0caabf40f8de
@@@ -5,8 -5,7 +5,8 @@@
  # Mail delivery agent for public-inbox, run from your MTA upon mail delivery
  use strict;
  use warnings;
 -my $usage = 'public-inbox-mda < rfc2822_message';
 +my $usage = 'public-inbox-mda [OPTIONS] < rfc2822_message';
 +my $precheck = grep(/\A--no-precheck\z/, @ARGV) ? 0 : 1;
  my ($ems, $emm);
  
  sub do_exit {
@@@ -52,13 -51,11 +52,13 @@@ if (!defined $dst) 
        }
        defined $dst or do_exit(67); # EX_NOUSER 5.1.1 user unknown
  }
- $dst->{mainrepo} or do_exit(67);
+ $dst->{inboxdir} or do_exit(67);
  $dst = PublicInbox::InboxWritable->new($dst);
  
  # pre-check, MDA has stricter rules than an importer might;
 -do_exit(0) unless PublicInbox::MDA->precheck($simple, $dst->{address});
 +if ($precheck && !PublicInbox::MDA->precheck($simple, $dst->{address})) {
 +      do_exit(0);
 +}
  $simple = undef;
  my $spam_ok;
  if ($spamc) {
diff --combined t/mda.t
index 92e8ad0dbed26c7824490992cc5cabd0fef7a65d,1be41bcb34b67b5c4e246666527e331b7953faa8..99592b2d9e901874f9a271f512c1b943897808e5
+++ b/t/mda.t
@@@ -38,7 -38,7 +38,7 @@@ my $mime
  
        my %cfg = (
                "$cfgpfx.address" => $addr,
-               "$cfgpfx.mainrepo" => $maindir,
+               "$cfgpfx.inboxdir" => $maindir,
        );
        while (my ($k,$v) = each %cfg) {
                is(0, system(qw(git config --file), $pi_config, $k, $v),
@@@ -293,21 -293,6 +293,21 @@@ EO
        my $path = mid2path($mid);
        my $msg = `git --git-dir=$maindir cat-file blob HEAD:$path`;
        like($msg, qr/\Q$list_id\E/, 'delivered message w/ List-ID matches');
 +
 +      # try a message w/o precheck
 +      $simple = Email::Simple->new(<<EOF);
 +To: You <you\@example.com>
 +List-Id: <$list_id>
 +
 +this message would not be accepted without --no-precheck
 +EOF
 +      $in = $simple->as_string;
 +      my ($out, $err) = ('', '');
 +      IPC::Run::run([$mda, '--no-precheck'], \$in, \$out, \$err);
 +      is($?, 0, 'mda OK with List-Id match and --no-precheck');
 +      my $cur = `git --git-dir=$maindir diff HEAD~1..HEAD`;
 +      like($cur, qr/this message would not be accepted without --no-precheck/,
 +              '--no-precheck delivered message anyways');
  }
  
  done_testing();