diff options
author | Eric Wong <e@80x24.org> | 2019-10-17 08:19:11 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-10-17 08:19:11 +0000 |
commit | fece7fca6aeac74410a813cffcb0da338017d0ed (patch) | |
tree | dd8ebebc8ec82c65ff10723faeace03eb1152ca6 /t | |
parent | eb424226f3bc1d4a05d1b3900634fadb2ee2c140 (diff) | |
parent | 144eddbc7abaca320773dda514589a3198c8f58c (diff) | |
download | public-inbox-fece7fca6aeac74410a813cffcb0da338017d0ed.tar.gz |
* origin/inboxdir: config: remove redundant inboxdir check config: support "inboxdir" in addition to "mainrepo" examples/grok-pull.post_update_hook: use "inbox_dir"
Diffstat (limited to 't')
47 files changed, 173 insertions, 157 deletions
@@ -56,7 +56,7 @@ SKIP: { use_ok 'PublicInbox::V2Writable'; use_ok 'PublicInbox::Inbox'; my $ibx = PublicInbox::Inbox->new({ - mainrepo => $v2_dir, + inboxdir => $v2_dir, name => 'test-v2writable', version => 2, -primary_address => 'test@example.com', @@ -43,7 +43,7 @@ my $ibx; $im->done; } { - $ibx = PublicInbox::Inbox->new({mainrepo => $git_dir}); + $ibx = PublicInbox::Inbox->new({inboxdir => $git_dir}); $ibx->{altid} = $altid; my $rw = PublicInbox::SearchIdx->new($ibx, 1); $rw->index_sync; diff --git a/t/altid_v2.t b/t/altid_v2.t index 35ab7a1b..2c1d8616 100644 --- a/t/altid_v2.t +++ b/t/altid_v2.t @@ -14,12 +14,12 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) { use_ok 'PublicInbox::V2Writable'; use_ok 'PublicInbox::Inbox'; my $tmpdir = tempdir('pi-altidv2-XXXXXX', TMPDIR => 1, CLEANUP => 1); -my $mainrepo = "$tmpdir/inbox"; +my $inboxdir = "$tmpdir/inbox"; my $full = "$tmpdir/inbox/another-nntp.sqlite3"; my $altid = [ 'serial:gmane:file=another-nntp.sqlite3' ]; { - ok(mkdir($mainrepo), 'created repo for msgmap'); + ok(mkdir($inboxdir), 'created repo for msgmap'); my $mm = PublicInbox::Msgmap->new_file($full, 1); is($mm->mid_set(1234, 'a@example.com'), 1, 'mid_set once OK'); ok(0 == $mm->mid_set(1234, 'a@example.com'), 'mid_set not idempotent'); @@ -27,7 +27,7 @@ my $altid = [ 'serial:gmane:file=another-nntp.sqlite3' ]; } my $ibx = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'test-v2writable', version => 2, -primary_address => 'test@example.com', @@ -29,7 +29,7 @@ my $cfgpfx = "publicinbox.test"; close $fh or die "close: $!\n"; my %cfg = ( "$cfgpfx.address" => $addr, - "$cfgpfx.mainrepo" => $maindir, + "$cfgpfx.inboxdir" => $maindir, "$cfgpfx.indexlevel" => 'basic', ); while (my ($k,$v) = each %cfg) { @@ -24,7 +24,7 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $cfg = PublicInbox::Config->new($f); is_deeply($cfg->lookup('meta@public-inbox.org'), { - 'mainrepo' => '/home/pi/meta-main.git', + 'inboxdir' => '/home/pi/meta-main.git', 'address' => [ 'meta@public-inbox.org' ], 'domain' => 'public-inbox.org', 'url' => 'http://example.com/meta', @@ -44,7 +44,7 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); 'sandbox@public-inbox.org', 'test@public-inbox.org'], -primary_address => 'try@public-inbox.org', - 'mainrepo' => '/home/pi/test-main.git', + 'inboxdir' => '/home/pi/test-main.git', 'domain' => 'public-inbox.org', 'name' => 'test', feedmax => 25, @@ -66,13 +66,29 @@ $cfgpfx.altid=serial:enamg:file=b EOF my $ibx = $config->lookup_name('test'); is_deeply($ibx->{altid}, [ @altid ]); + + $config = PublicInbox::Config->new(\<<EOF); +$cfgpfx.address=test\@example.com +$cfgpfx.mainrepo=/path/to/non/existent +EOF + $ibx = $config->lookup_name('test'); + is($ibx->{inboxdir}, '/path/to/non/existent', 'mainrepo still works'); + + $config = PublicInbox::Config->new(\<<EOF); +$cfgpfx.address=test\@example.com +$cfgpfx.inboxdir=/path/to/non/existent +$cfgpfx.mainrepo=/path/to/deprecated +EOF + $ibx = $config->lookup_name('test'); + is($ibx->{inboxdir}, '/path/to/non/existent', + 'inboxdir takes precedence'); } { my $pfx = "publicinbox.test"; my $str = <<EOF; $pfx.address=test\@example.com -$pfx.mainrepo=/path/to/non/existent +$pfx.inboxdir=/path/to/non/existent publicinbox.nntpserver=news.example.com EOF my $cfg = PublicInbox::Config->new(\$str); @@ -81,7 +97,7 @@ EOF $str = <<EOF; $pfx.address=test\@example.com -$pfx.mainrepo=/path/to/non/existent +$pfx.inboxdir=/path/to/non/existent $pfx.nntpserver=news.alt.example.com EOF $cfg = PublicInbox::Config->new(\$str); @@ -95,9 +111,9 @@ EOF my $pfx2 = "publicinbox.foo"; my $str = <<EOF; $pfx.address=test\@example.com -$pfx.mainrepo=/path/to/non/existent +$pfx.inboxdir=/path/to/non/existent $pfx2.address=foo\@example.com -$pfx2.mainrepo=/path/to/foo +$pfx2.inboxdir=/path/to/foo publicinbox.noobfuscate=public-inbox.org \@example.com z\@EXAMPLE.com $pfx.obfuscate=true EOF @@ -161,7 +177,7 @@ for my $s (@valid) { push @expect, "$i"; print $fh <<"" or die "print: $!"; [publicinbox "$i"] - mainrepo = /path/to/$i.git + inboxdir = /path/to/$i.git address = $i\@example.com } @@ -177,9 +193,9 @@ for my $s (@valid) { my $pfx2 = "publicinbox.test2"; my $str = <<EOF; $pfx1.address=test\@example.com -$pfx1.mainrepo=/path/to/non/existent +$pfx1.inboxdir=/path/to/non/existent $pfx2.address=foo\@example.com -$pfx2.mainrepo=/path/to/foo +$pfx2.inboxdir=/path/to/foo $pfx1.coderepo=project $pfx2.coderepo=project coderepo.project.dir=/path/to/project.git diff --git a/t/config_limiter.t b/t/config_limiter.t index c1fffecf..57e298ba 100644 --- a/t/config_limiter.t +++ b/t/config_limiter.t @@ -8,7 +8,7 @@ my $cfgpfx = "publicinbox.test"; { my $config = PublicInbox::Config->new(\<<EOF); $cfgpfx.address=test\@example.com -$cfgpfx.mainrepo=/path/to/non/existent +$cfgpfx.inboxdir=/path/to/non/existent $cfgpfx.httpbackendmax=12 EOF my $ibx = $config->lookup_name('test'); @@ -27,7 +27,7 @@ EOF my $config = PublicInbox::Config->new(\<<EOF); publicinboxlimiter.named.max=3 $cfgpfx.address=test\@example.com -$cfgpfx.mainrepo=/path/to/non/existent +$cfgpfx.inboxdir=/path/to/non/existent $cfgpfx.httpbackendmax=named EOF my $ibx = $config->lookup_name('test'); diff --git a/t/convert-compact.t b/t/convert-compact.t index 6d091031..dbccfbad 100644 --- a/t/convert-compact.t +++ b/t/convert-compact.t @@ -20,15 +20,15 @@ use_ok 'PublicInbox::V2Writable'; use PublicInbox::Import; my $tmpdir = tempdir('convert-compact-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $ibx = { - mainrepo => "$tmpdir/v1", + inboxdir => "$tmpdir/v1", name => 'test-v1', -primary_address => 'test@example.com', }; -ok(PublicInbox::Import::run_die([qw(git init --bare -q), $ibx->{mainrepo}]), +ok(PublicInbox::Import::run_die([qw(git init --bare -q), $ibx->{inboxdir}]), 'initialized v1 repo'); ok(umask(077), 'set restrictive umask'); -ok(PublicInbox::Import::run_die([qw(git) , "--git-dir=$ibx->{mainrepo}", +ok(PublicInbox::Import::run_die([qw(git) , "--git-dir=$ibx->{inboxdir}", qw(config core.sharedRepository 0644)]), 'set sharedRepository'); $ibx = PublicInbox::Inbox->new($ibx); my $im = PublicInbox::Import->new($ibx->git, undef, undef, $ibx); @@ -51,11 +51,11 @@ for (1..2) { is($@, '', 'no errors syncing'); } -is(((stat("$ibx->{mainrepo}/public-inbox"))[2]) & 07777, 0755, +is(((stat("$ibx->{inboxdir}/public-inbox"))[2]) & 07777, 0755, 'sharedRepository respected for v1'); -is(((stat("$ibx->{mainrepo}/public-inbox/msgmap.sqlite3"))[2]) & 07777, 0644, +is(((stat("$ibx->{inboxdir}/public-inbox/msgmap.sqlite3"))[2]) & 07777, 0644, 'sharedRepository respected for v1 msgmap'); -my @xdir = glob("$ibx->{mainrepo}/public-inbox/xap*/*"); +my @xdir = glob("$ibx->{inboxdir}/public-inbox/xap*/*"); foreach (@xdir) { my @st = stat($_); is($st[2] & 07777, -f _ ? 0644 : 0755, @@ -68,15 +68,15 @@ open my $err, '>>', "$tmpdir/err.log" or die "open: err.log $!\n"; open my $out, '>>', "$tmpdir/out.log" or die "open: out.log $!\n"; my $rdr = { 1 => fileno($out), 2 => fileno($err) }; -my $cmd = [ 'public-inbox-compact', $ibx->{mainrepo} ]; +my $cmd = [ 'public-inbox-compact', $ibx->{inboxdir} ]; ok(PublicInbox::Import::run_die($cmd, undef, $rdr), 'v1 compact works'); -@xdir = glob("$ibx->{mainrepo}/public-inbox/xap*"); +@xdir = glob("$ibx->{inboxdir}/public-inbox/xap*"); is(scalar(@xdir), 1, 'got one xapian directory after compact'); is(((stat($xdir[0]))[2]) & 07777, 0755, 'sharedRepository respected on v1 compact'); -$cmd = [ 'public-inbox-convert', $ibx->{mainrepo}, "$tmpdir/v2" ]; +$cmd = [ 'public-inbox-convert', $ibx->{inboxdir}, "$tmpdir/v2" ]; ok(PublicInbox::Import::run_die($cmd, undef, $rdr), 'convert works'); @xdir = glob("$tmpdir/v2/xap*/*"); foreach (@xdir) { @@ -88,7 +88,7 @@ foreach (@xdir) { $cmd = [ 'public-inbox-compact', "$tmpdir/v2" ]; my $env = { NPROC => 2 }; ok(PublicInbox::Import::run_die($cmd, $env, $rdr), 'v2 compact works'); -$ibx->{mainrepo} = "$tmpdir/v2"; +$ibx->{inboxdir} = "$tmpdir/v2"; $ibx->{version} = 2; @xdir = glob("$tmpdir/v2/xap*/*"); @@ -21,9 +21,9 @@ IPC::Run->import(qw(run)); my $cmd_pfx = 'blib/script/public-inbox'; my $tmpdir = tempdir('pi-edit-XXXXXX', TMPDIR => 1, CLEANUP => 1); -my $mainrepo = "$tmpdir/v2"; +my $inboxdir = "$tmpdir/v2"; my $ibx = PublicInbox::Inbox->new({ - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'test-v2edit', version => 2, -primary_address => 'test@example.com', @@ -41,12 +41,12 @@ my $mid = mid_clean($mime->header('Message-Id')); ok($im->add($mime), 'add message to be edited'); $im->done; my ($in, $out, $err, $cmd, $cur, $t); -my $__git_dir = "--git-dir=$ibx->{mainrepo}/git/0.git"; +my $__git_dir = "--git-dir=$ibx->{inboxdir}/git/0.git"; $t = '-F FILE'; { $in = $out = $err = ''; local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/boolean prefix/bool pfx/'"; - $cmd = [ "$cmd_pfx-edit", "-F$file", $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-F$file", $inboxdir ]; ok(run($cmd, \$in, \$out, \$err), "$t edit OK"); $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid)); like($cur->header('Subject'), qr/bool pfx/, "$t message edited"); @@ -56,7 +56,7 @@ $t = '-F FILE'; { $t = '-m MESSAGE_ID'; { $in = $out = $err = ''; local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid", $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", $inboxdir ]; ok(run($cmd, \$in, \$out, \$err), "$t edit OK"); $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid)); like($cur->header('Subject'), qr/boolean prefix/, "$t message edited"); @@ -67,7 +67,7 @@ $t = 'no-op -m MESSAGE_ID'; { $in = $out = $err = ''; my $before = `git $__git_dir rev-parse HEAD`; local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid", $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", $inboxdir ]; ok(run($cmd, \$in, \$out, \$err), "$t succeeds"); my $prev = $cur; $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid)); @@ -84,7 +84,7 @@ $t = 'no-op -m MESSAGE_ID w/Status: header'; { # because mutt does it my $before = `git $__git_dir rev-parse HEAD`; local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^Subject:.*/Status: RO\\n\$&/'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid", $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", $inboxdir ]; ok(run($cmd, \$in, \$out, \$err), "$t succeeds"); my $prev = $cur; $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid)); @@ -102,7 +102,7 @@ $t = '-m MESSAGE_ID can change Received: headers'; { my $before = `git $__git_dir rev-parse HEAD`; local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^Subject:.*/Received: x\\n\$&/'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid", $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", $inboxdir ]; ok(run($cmd, \$in, \$out, \$err), "$t succeeds"); $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid)); like($cur->header('Subject'), qr/boolean prefix/, @@ -113,7 +113,7 @@ $t = '-m MESSAGE_ID can change Received: headers'; { $t = '-m miss'; { $in = $out = $err = ''; local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/boolean/FAIL/'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid-miss", $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid-miss", $inboxdir ]; ok(!run($cmd, \$in, \$out, \$err), "$t fails on invalid MID"); like($err, qr/No message found/, "$t shows error"); } @@ -121,7 +121,7 @@ $t = '-m miss'; { $t = 'non-interactive editor failure'; { $in = $out = $err = ''; local $ENV{MAIL_EDITOR} = "$^X -i -p -e 'END { exit 1 }'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid", $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", $inboxdir ]; ok(!run($cmd, \$in, \$out, \$err), "$t detected"); like($err, qr/END \{ exit 1 \}' failed:/, "$t shows error"); } @@ -134,7 +134,7 @@ $t = 'mailEditor set in config'; { is($rc, 0, 'set publicinbox.mailEditor'); local $ENV{MAIL_EDITOR}; local $ENV{GIT_EDITOR} = 'echo should not run'; - $cmd = [ "$cmd_pfx-edit", "-m$mid", $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", $inboxdir ]; ok(run($cmd, \$in, \$out, \$err), "$t edited message"); $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid)); like($cur->header('Subject'), qr/bool pfx/, "$t message edited"); @@ -144,20 +144,20 @@ $t = 'mailEditor set in config'; { $t = '--raw and mbox escaping'; { $in = $out = $err = ''; local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^\$/\\nFrom not mbox\\n/'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid", '--raw', $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", '--raw', $inboxdir ]; ok(run($cmd, \$in, \$out, \$err), "$t succeeds"); $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid)); like($cur->body, qr/^From not mbox/sm, 'put "From " line into body'); local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^>From not/\$& an/'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid", $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", $inboxdir ]; ok(run($cmd, \$in, \$out, \$err), "$t succeeds with mbox escaping"); $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid)); like($cur->body, qr/^From not an mbox/sm, 'changed "From " line unescaped'); local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^From not an mbox\\n//s'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid", '--raw', $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", '--raw', $inboxdir ]; ok(run($cmd, \$in, \$out, \$err), "$t succeeds again"); $cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid)); unlike($cur->body, qr/^From not an mbox/sm, "$t restored body"); @@ -174,7 +174,7 @@ $t = 'reuse Message-ID'; { $t = 'edit ambiguous Message-ID with -m'; { $in = $out = $err = ''; local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid", $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", $inboxdir ]; ok(!run($cmd, \$in, \$out, \$err), "$t fails w/o --force"); like($err, qr/Multiple messages with different content found matching/, "$t shows matches"); @@ -184,7 +184,7 @@ $t = 'edit ambiguous Message-ID with -m'; { $t .= ' and --force'; { $in = $out = $err = ''; local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^Subject:.*/Subject:x/i'"; - $cmd = [ "$cmd_pfx-edit", "-m$mid", '--force', $mainrepo ]; + $cmd = [ "$cmd_pfx-edit", "-m$mid", '--force', $inboxdir ]; ok(run($cmd, \$in, \$out, \$err), "$t succeeds"); like($err, qr/Will edit all of them/, "$t notes all will be edited"); my @dump = `git $__git_dir cat-file --batch --batch-all-objects`; @@ -22,7 +22,7 @@ my $git_dir = "$tmpdir/gittest"; my $ibx = PublicInbox::Inbox->new({ address => 'test@example', name => 'testbox', - mainrepo => $git_dir, + inboxdir => $git_dir, url => 'http://example.com/test', feedmax => 3, }); diff --git a/t/filter_rubylang.t b/t/filter_rubylang.t index 9ed6684b..7b1da11c 100644 --- a/t/filter_rubylang.t +++ b/t/filter_rubylang.t @@ -30,7 +30,7 @@ SKIP: { TMPDIR => 1, CLEANUP => 1); is(mkdir("$git_dir/public-inbox"), 1, "created public-inbox dir"); my $altid = [ "serial:ruby-core:file=msgmap.sqlite3" ]; - my $ibx = PublicInbox::Inbox->new({ mainrepo => $git_dir, + my $ibx = PublicInbox::Inbox->new({ inboxdir => $git_dir, altid => $altid }); $f = PublicInbox::Filter::RubyLang->new(-inbox => $ibx); $msg = <<'EOF'; diff --git a/t/html_index.t b/t/html_index.t index b9f866b3..2f4b4d1b 100644 --- a/t/html_index.t +++ b/t/html_index.t @@ -14,7 +14,7 @@ my $git_dir = "$tmpdir/gittest"; my $ibx = PublicInbox::Inbox->new({ address => 'test@example', name => 'tester', - mainrepo => $git_dir, + inboxdir => $git_dir, url => 'http://example.com/test', }); my $git = $ibx->git; diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t index b685da14..40afe4e9 100644 --- a/t/indexlevels-mirror.t +++ b/t/indexlevels-mirror.t @@ -36,7 +36,7 @@ sub import_index_incremental { my $this = "pi-$v-$level-indexlevels"; my $tmpdir = tempdir("$this-tmp-XXXXXX", TMPDIR => 1, CLEANUP => 1); my $ibx = PublicInbox::Inbox->new({ - mainrepo => "$tmpdir/testbox", + inboxdir => "$tmpdir/testbox", name => $this, version => $v, -primary_address => 'test@example.com', @@ -48,9 +48,9 @@ sub import_index_incremental { $im->done; # index master (required for v1) - is(system($index, $ibx->{mainrepo}, "-L$level"), 0, 'index master OK'); + is(system($index, $ibx->{inboxdir}, "-L$level"), 0, 'index master OK'); my $ro_master = PublicInbox::Inbox->new({ - mainrepo => $ibx->{mainrepo}, + inboxdir => $ibx->{inboxdir}, indexlevel => $level }); my ($nr, $msgs) = $ro_master->recent; @@ -61,9 +61,9 @@ sub import_index_incremental { my @cmd = (qw(git clone --mirror -q)); my $mirror = "$tmpdir/mirror-$v"; if ($v == 1) { - push @cmd, $ibx->{mainrepo}, $mirror; + push @cmd, $ibx->{inboxdir}, $mirror; } else { - push @cmd, "$ibx->{mainrepo}/git/0.git", "$mirror/git/0.git"; + push @cmd, "$ibx->{inboxdir}/git/0.git", "$mirror/git/0.git"; } my $fetch_dir = $cmd[-1]; is(system(@cmd), 0, "v$v clone OK"); @@ -80,7 +80,7 @@ sub import_index_incremental { # read-only access my $ro_mirror = PublicInbox::Inbox->new({ - mainrepo => $mirror, + inboxdir => $mirror, indexlevel => $level, }); ($nr, $msgs) = $ro_mirror->recent; @@ -101,7 +101,7 @@ sub import_index_incremental { ['m@1','m@2'], 'got both messages in mirror'); # incremental index master (required for v1) - is(system($index, $ibx->{mainrepo}, "-L$level"), 0, 'index master OK'); + is(system($index, $ibx->{inboxdir}, "-L$level"), 0, 'index master OK'); ($nr, $msgs) = $ro_master->recent; is($nr, 2, '2nd message seen in master'); is_deeply([sort { $a cmp $b } map { $_->{mid} } @$msgs], @@ -137,7 +137,7 @@ sub import_index_incremental { 'message unavailable in mirror'); if ($v == 2 && $level eq 'basic') { - is_deeply([glob("$ibx->{mainrepo}/xap*/?/")], [], + is_deeply([glob("$ibx->{inboxdir}/xap*/?/")], [], 'no Xapian shard directories for v2 basic'); } if ($level ne 'basic') { @@ -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), diff --git a/t/mda_filter_rubylang.t b/t/mda_filter_rubylang.t index 279afaac..f7d872c9 100644 --- a/t/mda_filter_rubylang.t +++ b/t/mda_filter_rubylang.t @@ -27,12 +27,12 @@ for my $v (qw(V1 V2)) { my @warn; $SIG{__WARN__} = sub { push @warn, @_ }; my $cfgpfx = "publicinbox.$v"; - my $mainrepo = "$tmpdir/$v"; + my $inboxdir = "$tmpdir/$v"; my $addr = "test-$v\@example.com"; - my @cmd = ('blib/script/public-inbox-init', "-$v", $v, $mainrepo, + my @cmd = ('blib/script/public-inbox-init', "-$v", $v, $inboxdir, "http://example.com/$v", $addr); is(system(@cmd), 0, 'public-inbox init OK'); - is(system('blib/script/public-inbox-index', $mainrepo), 0); + is(system('blib/script/public-inbox-index', $inboxdir), 0); is(system(@cfg, "$cfgpfx.filter", 'PublicInbox::Filter::RubyLang'), 0); is(system(@cfg, "$cfgpfx.altid", 'serial:alerts:file=msgmap.sqlite3'), 0); @@ -99,7 +99,7 @@ use_ok 'PublicInbox::Inbox'; require Email::MIME; my $u = 'https://example.com/a/'; my $ng = PublicInbox::Inbox->new({ name => 'test', - mainrepo => 'test.git', + inboxdir => 'test.git', address => 'a@example.com', -primary_address => 'a@example.com', newsgroup => 'test', diff --git a/t/nntpd-tls.t b/t/nntpd-tls.t index 1a74924c..0b6afcef 100644 --- a/t/nntpd-tls.t +++ b/t/nntpd-tls.t @@ -37,7 +37,7 @@ require_git('2.6') if $version >= 2; my $tmpdir = tempdir('pi-nntpd-tls-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $err = "$tmpdir/stderr.log"; my $out = "$tmpdir/stdout.log"; -my $mainrepo = "$tmpdir"; +my $inboxdir = "$tmpdir"; my $pi_config = "$tmpdir/pi_config"; my $group = 'test-nntpd-tls'; my $addr = $group . '@example.com'; @@ -52,7 +52,7 @@ END { }; my $ibx = PublicInbox::Inbox->new({ - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'nntpd-tls', version => $version, -primary_address => $addr, @@ -64,7 +64,7 @@ $ibx->init_inbox(0); open my $fh, '>', $pi_config or die "open: $!\n"; print $fh <<EOF [publicinbox "nntpd-tls"] - mainrepo = $mainrepo + inboxdir = $inboxdir address = $addr indexlevel = basic newsgroup = $group diff --git a/t/nntpd-validate.t b/t/nntpd-validate.t index 87829b03..de024394 100644 --- a/t/nntpd-validate.t +++ b/t/nntpd-validate.t @@ -147,7 +147,7 @@ done_testing(); sub make_local_server { require PublicInbox::Inbox; $group = 'inbox.test.perf.nntpd'; - my $ibx = { mainrepo => $inbox_dir, newsgroup => $group }; + my $ibx = { inboxdir => $inbox_dir, newsgroup => $group }; $ibx = PublicInbox::Inbox->new($ibx); my $nntpd = 'blib/script/public-inbox-nntpd'; my $pi_config = "$tmpdir/config"; @@ -156,7 +156,7 @@ sub make_local_server { print $fh <<"" or die "print $pi_config: $!"; [publicinbox "test"] newsgroup = $group - mainrepo = $inbox_dir + inboxdir = $inbox_dir address = test\@example.com close $fh or die "close($pi_config): $!"; @@ -26,7 +26,7 @@ my $tmpdir = tempdir('pi-nntpd-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $home = "$tmpdir/pi-home"; my $err = "$tmpdir/stderr.log"; my $out = "$tmpdir/stdout.log"; -my $mainrepo = "$tmpdir/main.git"; +my $inboxdir = "$tmpdir/main.git"; my $group = 'test-nntpd'; my $addr = $group . '@example.com'; my $nntpd = 'blib/script/public-inbox-nntpd'; @@ -43,7 +43,7 @@ my $len; END { kill 'TERM', $pid if defined $pid }; my $ibx = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => $group, version => $version, -primary_address => $addr, @@ -52,7 +52,7 @@ my $ibx = { $ibx = PublicInbox::Inbox->new($ibx); { local $ENV{HOME} = $home; - my @cmd = ($init, $group, $mainrepo, 'http://example.com/', $addr); + my @cmd = ($init, $group, $inboxdir, 'http://example.com/', $addr); push @cmd, "-V$version", '-Lbasic'; is(system(@cmd), 0, 'init OK'); is(system(qw(git config), "--file=$home/.public-inbox/config", diff --git a/t/perf-msgview.t b/t/perf-msgview.t index 0defafc4..492ed487 100644 --- a/t/perf-msgview.t +++ b/t/perf-msgview.t @@ -20,7 +20,7 @@ if (require_git(2.19, 1)) { } use_ok 'Plack::Util'; -my $ibx = PublicInbox::Inbox->new({ mainrepo => $pi_dir, name => 'name' }); +my $ibx = PublicInbox::Inbox->new({ inboxdir => $pi_dir, name => 'name' }); my $git = $ibx->git; my $fh = $git->popen(@cat); my $vec = ''; diff --git a/t/perf-nntpd.t b/t/perf-nntpd.t index f272e18a..7abf2249 100644 --- a/t/perf-nntpd.t +++ b/t/perf-nntpd.t @@ -27,7 +27,7 @@ if (($ENV{NNTP_TEST_URL} || '') =~ m!\Anntp://([^/]+)/([^/]+)\z!) { $host_port .= ":119" unless index($host_port, ':') > 0; } else { $group = 'inbox.test.perf.nntpd'; - my $ibx = { mainrepo => $pi_dir, newsgroup => $group }; + my $ibx = { inboxdir => $pi_dir, newsgroup => $group }; $ibx = PublicInbox::Inbox->new($ibx); my $nntpd = 'blib/script/public-inbox-nntpd'; my $tmpdir = tempdir('perf-nntpd-XXXXXX', TMPDIR => 1, CLEANUP => 1); @@ -38,7 +38,7 @@ if (($ENV{NNTP_TEST_URL} || '') =~ m!\Anntp://([^/]+)/([^/]+)\z!) { print $fh <<"" or die "print $pi_config: $!"; [publicinbox "test"] newsgroup = $group - mainrepo = $pi_dir + inboxdir = $pi_dir address = test\@example.com close $fh or die "close($pi_config): $!"; diff --git a/t/perf-threading.t b/t/perf-threading.t index 3bed05c4..8d28b3a0 100644 --- a/t/perf-threading.t +++ b/t/perf-threading.t @@ -9,7 +9,7 @@ use Benchmark qw(:all); use PublicInbox::Inbox; my $pi_dir = $ENV{GIANT_PI_DIR}; plan skip_all => "GIANT_PI_DIR not defined for $0" unless $pi_dir; -my $ibx = PublicInbox::Inbox->new({ mainrepo => $pi_dir }); +my $ibx = PublicInbox::Inbox->new({ inboxdir => $pi_dir }); eval { require PublicInbox::Search }; my $srch = $ibx->search; plan skip_all => "$pi_dir not configured for search $0 $@" unless $srch; @@ -29,7 +29,7 @@ foreach my $mod (@mods) { use_ok $mod; } close $fh or die "close: $!\n"; my %cfg = ( "$cfgpfx.address" => $addr, - "$cfgpfx.mainrepo" => $maindir, + "$cfgpfx.inboxdir" => $maindir, "$cfgpfx.url" => 'http://example.com/test/', "$cfgpfx.newsgroup" => 'inbox.test', ); diff --git a/t/psgi_attach.t b/t/psgi_attach.t index f5140f44..96f0cb47 100644 --- a/t/psgi_attach.t +++ b/t/psgi_attach.t @@ -23,7 +23,7 @@ use_ok 'PublicInbox::WwwAttach'; use Plack::Builder; my $config = PublicInbox::Config->new(\<<EOF); $cfgpfx.address=$addr -$cfgpfx.mainrepo=$maindir +$cfgpfx.inboxdir=$maindir EOF is(0, system(qw(git init -q --bare), $maindir), "git init (main)"); my $git = PublicInbox::Git->new($maindir); diff --git a/t/psgi_bad_mids.t b/t/psgi_bad_mids.t index 95196a3f..c7c94718 100644 --- a/t/psgi_bad_mids.t +++ b/t/psgi_bad_mids.t @@ -15,10 +15,10 @@ foreach my $mod (@mods) { } use_ok($_) for @mods; use_ok 'PublicInbox::V2Writable'; -my $mainrepo = tempdir('pi-bad-mids-XXXXXX', TMPDIR => 1, CLEANUP => 1); +my $inboxdir = tempdir('pi-bad-mids-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $cfgpfx = "publicinbox.bad-mids"; my $ibx = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'bad-mids', version => 2, -primary_address => 'test@example.com', @@ -55,7 +55,7 @@ $im->done; my $cfg = <<EOF; $cfgpfx.address=$ibx->{-primary_address} -$cfgpfx.mainrepo=$mainrepo +$cfgpfx.inboxdir=$inboxdir EOF my $config = PublicInbox::Config->new(\$cfg); my $www = PublicInbox::WWW->new($config); diff --git a/t/psgi_mount.t b/t/psgi_mount.t index 7160896b..aa7c863f 100644 --- a/t/psgi_mount.t +++ b/t/psgi_mount.t @@ -23,7 +23,7 @@ use Plack::Builder; use Plack::App::URLMap; my $config = PublicInbox::Config->new(\<<EOF); $cfgpfx.address=$addr -$cfgpfx.mainrepo=$maindir +$cfgpfx.inboxdir=$maindir EOF is(0, system(qw(git init -q --bare), $maindir), "git init (main)"); my $git = PublicInbox::Git->new($maindir); diff --git a/t/psgi_multipart_not.t b/t/psgi_multipart_not.t index 2670c47a..40bc3c18 100644 --- a/t/psgi_multipart_not.t +++ b/t/psgi_multipart_not.t @@ -17,7 +17,7 @@ use_ok($_) for @mods; use_ok 'PublicInbox::V2Writable'; my $repo = tempdir('pi-psgi-multipart-not.XXXXXX', TMPDIR => 1, CLEANUP => 1); my $ibx = PublicInbox::Inbox->new({ - mainrepo => $repo, + inboxdir => $repo, name => 'multipart-not', version => 2, -primary_address => 'test@example.com', @@ -44,7 +44,7 @@ $im->done; my $cfgpfx = "publicinbox.v2test"; my $cfg = <<EOF; $cfgpfx.address=$ibx->{-primary_address} -$cfgpfx.mainrepo=$repo +$cfgpfx.inboxdir=$repo EOF my $config = PublicInbox::Config->new(\$cfg); my $www = PublicInbox::WWW->new($config); diff --git a/t/psgi_scan_all.t b/t/psgi_scan_all.t index 2e00b6d8..707807a7 100644 --- a/t/psgi_scan_all.t +++ b/t/psgi_scan_all.t @@ -19,12 +19,12 @@ my $cfg = ''; foreach my $i (1..2) { my $cfgpfx = "publicinbox.test-$i"; my $addr = "test-$i\@example.com"; - my $mainrepo = "$tmp/$i"; + my $inboxdir = "$tmp/$i"; $cfg .= "$cfgpfx.address=$addr\n"; - $cfg .= "$cfgpfx.mainrepo=$mainrepo\n"; + $cfg .= "$cfgpfx.inboxdir=$inboxdir\n"; $cfg .= "$cfgpfx.url=http://example.com/$i\n"; my $opt = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => "test-$i", version => 2, indexlevel => 'basic', diff --git a/t/psgi_search.t b/t/psgi_search.t index ab6892bc..4cd0e499 100644 --- a/t/psgi_search.t +++ b/t/psgi_search.t @@ -21,7 +21,7 @@ use_ok $_ foreach (@mods, qw(PublicInbox::SearchIdx)); my $tmpdir = tempdir('pi-psgi-search.XXXXXX', TMPDIR => 1, CLEANUP => 1); my $ibx = PublicInbox::Inbox->new({ - mainrepo => $tmpdir, + inboxdir => $tmpdir, address => 'git@vger.kernel.org', name => 'test', }); @@ -47,7 +47,7 @@ PublicInbox::SearchIdx->new($ibx, 1)->index_sync; my $cfgpfx = "publicinbox.test"; my $config = PublicInbox::Config->new(\<<EOF); $cfgpfx.address=git\@vger.kernel.org -$cfgpfx.mainrepo=$tmpdir +$cfgpfx.inboxdir=$tmpdir EOF my $www = PublicInbox::WWW->new($config); test_psgi(sub { $www->call(@_) }, sub { diff --git a/t/psgi_text.t b/t/psgi_text.t index 944a6476..da7c6f57 100644 --- a/t/psgi_text.t +++ b/t/psgi_text.t @@ -23,7 +23,7 @@ use_ok 'PublicInbox::WwwText'; use Plack::Builder; my $config = PublicInbox::Config->new(\<<EOF); $cfgpfx.address=$addr -$cfgpfx.mainrepo=$maindir +$cfgpfx.inboxdir=$maindir EOF is(0, system(qw(git init -q --bare), $maindir), "git init (main)"); my $www = PublicInbox::WWW->new($config); diff --git a/t/psgi_v2.t b/t/psgi_v2.t index e4f7306e..cb5ece63 100644 --- a/t/psgi_v2.t +++ b/t/psgi_v2.t @@ -18,9 +18,9 @@ foreach my $mod (@mods) { } use_ok($_) for @mods; use_ok 'PublicInbox::V2Writable'; -my $mainrepo = tempdir('pi-v2_dupes-XXXXXX', TMPDIR => 1, CLEANUP => 1); +my $inboxdir = tempdir('pi-v2_dupes-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $ibx = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'test-v2writable', version => 2, -primary_address => 'test@example.com', @@ -56,7 +56,7 @@ $im->done; my $cfgpfx = "publicinbox.v2test"; my $cfg = <<EOF; $cfgpfx.address=$ibx->{-primary_address} -$cfgpfx.mainrepo=$mainrepo +$cfgpfx.inboxdir=$inboxdir EOF my $config = PublicInbox::Config->new(\$cfg); my $www = PublicInbox::WWW->new($config); @@ -15,9 +15,9 @@ use Cwd qw(abs_path); my $purge = abs_path('blib/script/public-inbox-purge'); my $tmpdir = tempdir('pi-purge-XXXXXX', TMPDIR => 1, CLEANUP => 1); use_ok 'PublicInbox::V2Writable'; -my $mainrepo = "$tmpdir/v2"; +my $inboxdir = "$tmpdir/v2"; my $ibx = PublicInbox::Inbox->new({ - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'test-v2purge', version => 2, -primary_address => 'test@example.com', @@ -47,22 +47,22 @@ $v2w->done; # failing cases, first: my $in = "$raw\nMOAR\n"; my ($out, $err) = ('', ''); -ok(IPC::Run::run([$purge, '-f', $mainrepo], \$in, \$out, \$err), +ok(IPC::Run::run([$purge, '-f', $inboxdir], \$in, \$out, \$err), 'purge -f OK'); $out = $err = ''; -ok(!IPC::Run::run([$purge, $mainrepo], \$in, \$out, \$err), +ok(!IPC::Run::run([$purge, $inboxdir], \$in, \$out, \$err), 'mismatch fails without -f'); is($? >> 8, 1, 'missed purge exits with 1'); # a successful case: -ok(IPC::Run::run([$purge, $mainrepo], \$raw, \$out, \$err), 'match OK'); +ok(IPC::Run::run([$purge, $inboxdir], \$raw, \$out, \$err), 'match OK'); like($out, qr/\b[a-f0-9]{40,}/m, 'removed commit noted'); # add (old) vger filter to config file print $cfg_fh <<EOF or die "print $!"; [publicinbox "test-v2purge"] - mainrepo = $mainrepo + inboxdir = $inboxdir address = test\@example.com indexlevel = basic filter = PublicInbox::Filter::Vger diff --git a/t/replace.t b/t/replace.t index b1ee15bf..24f7537c 100644 --- a/t/replace.t +++ b/t/replace.t @@ -19,7 +19,7 @@ sub test_replace ($$$) { my $this = "pi-$v-$level-replace"; my $tmpdir = tempdir("$this-tmp-XXXXXX", TMPDIR => 1, CLEANUP => 1); my $ibx = PublicInbox::Inbox->new({ - mainrepo => "$tmpdir/testbox", + inboxdir => "$tmpdir/testbox", name => $this, version => $v, -primary_address => 'test@example.com', @@ -95,7 +95,7 @@ EOF my $t19931002 = qr/ 749520000 /; is_deeply([grep(/$t19931002/, @all)], [], "nothing matches $t19931002"); - for my $dir (glob("$ibx->{mainrepo}/git/*.git")) { + for my $dir (glob("$ibx->{inboxdir}/git/*.git")) { my ($bn) = ($dir =~ m!([^/]+)\z!); is(system(qw(git --git-dir), $dir, qw(fsck --strict)), 0, "git fsck is clean in epoch $bn"); diff --git a/t/search-thr-index.t b/t/search-thr-index.t index 4b26f2ee..26339989 100644 --- a/t/search-thr-index.t +++ b/t/search-thr-index.t @@ -18,7 +18,7 @@ my $tmpdir = tempdir('pi-search-thr-index.XXXXXX', TMPDIR => 1, CLEANUP => 1); my $git_dir = "$tmpdir/a.git"; is(0, system(qw(git init -q --bare), $git_dir), "git init (main)"); -my $ibx = PublicInbox::Inbox->new({mainrepo => $git_dir}); +my $ibx = PublicInbox::Inbox->new({inboxdir => $git_dir}); my $rw = PublicInbox::SearchIdx->new($ibx, 1); ok($rw, "search indexer created"); my $data = <<'EOF'; @@ -14,7 +14,7 @@ use File::Temp qw/tempdir/; use Email::MIME; my $tmpdir = tempdir('pi-search-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $git_dir = "$tmpdir/a.git"; -my $ibx = PublicInbox::Inbox->new({ mainrepo => $git_dir }); +my $ibx = PublicInbox::Inbox->new({ inboxdir => $git_dir }); my ($root_id, $last_id); is(0, system(qw(git init --shared -q --bare), $git_dir), "git init (main)") diff --git a/t/solver_git.t b/t/solver_git.t index 0b7d7c49..baab40a4 100644 --- a/t/solver_git.t +++ b/t/solver_git.t @@ -22,9 +22,9 @@ $git_dir = abs_path($git_dir); use_ok "PublicInbox::$_" for (qw(Inbox V2Writable MIME Git SolverGit)); -my $mainrepo = tempdir('pi-solver-XXXXXX', TMPDIR => 1, CLEANUP => 1); +my $inboxdir = tempdir('pi-solver-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $opts = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'test-v2writable', version => 2, -primary_address => 'test@example.com', @@ -52,7 +52,7 @@ is(undef, $git->commit_title('impossible'), 'undef on impossible object'); $ibx->{-repo_objs} = [ $git ]; my $res; my $solver = PublicInbox::SolverGit->new($ibx, sub { $res = $_[0] }); -open my $log, '+>>', "$mainrepo/solve.log" or die "open: $!"; +open my $log, '+>>', "$inboxdir/solve.log" or die "open: $!"; my $psgi_env = { 'psgi.errors' => *STDERR }; $solver->solve($psgi_env, $log, '69df7d5', {}); ok($res, 'solved a blob!'); diff --git a/t/v1-add-remove-add.t b/t/v1-add-remove-add.t index 4777a307..3facd87e 100644 --- a/t/v1-add-remove-add.t +++ b/t/v1-add-remove-add.t @@ -12,10 +12,10 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) { plan skip_all => "$mod missing for v1-add-remove-add.t" if $@; } require PublicInbox::SearchIdx; -my $mainrepo = tempdir('pi-add-remove-add-XXXXXX', TMPDIR => 1, CLEANUP => 1); -is(system(qw(git init --bare), $mainrepo), 0); +my $inboxdir = tempdir('pi-add-remove-add-XXXXXX', TMPDIR => 1, CLEANUP => 1); +is(system(qw(git init --bare), $inboxdir), 0); my $ibx = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'test-add-remove-add', -primary_address => 'test@example.com', }; diff --git a/t/v1reindex.t b/t/v1reindex.t index d14a117d..e3547753 100644 --- a/t/v1reindex.t +++ b/t/v1reindex.t @@ -16,10 +16,10 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) { } use_ok 'PublicInbox::SearchIdx'; use_ok 'PublicInbox::Import'; -my $mainrepo = tempdir('pi-v1reindex-XXXXXX', TMPDIR => 1, CLEANUP => 1); -is(system(qw(git init -q --bare), $mainrepo), 0); +my $inboxdir = tempdir('pi-v1reindex-XXXXXX', TMPDIR => 1, CLEANUP => 1); +is(system(qw(git init -q --bare), $inboxdir), 0); my $ibx_config = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'test-v1reindex', -primary_address => 'test@example.com', indexlevel => 'full', @@ -96,7 +96,7 @@ my ($mark1, $mark2, $mark3, $mark4); is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } -my $xap = "$mainrepo/public-inbox/xapian".PublicInbox::Search::SCHEMA_VERSION(); +my $xap = "$inboxdir/public-inbox/xapian".PublicInbox::Search::SCHEMA_VERSION(); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed'); { @@ -118,7 +118,7 @@ ok(!-d $xap, 'Xapian directories removed'); is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } -ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { @@ -141,7 +141,7 @@ ok(!-d $xap, 'Xapian directories removed again'); is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } -ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { @@ -164,7 +164,7 @@ ok(!-d $xap, 'Xapian directories removed again'); is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } -ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { @@ -190,7 +190,7 @@ ok(!-d $xap, 'Xapian directories removed again'); is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } -ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { @@ -239,7 +239,7 @@ ok(!-d $xap, 'Xapian directories removed again'); } # An incremental indexing test -ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { @@ -349,7 +349,7 @@ ok(!-d $xap, 'Xapian directories removed again'); # Another incremental indexing test -ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { diff --git a/t/v2-add-remove-add.t b/t/v2-add-remove-add.t index c758dbb6..438fe3db 100644 --- a/t/v2-add-remove-add.t +++ b/t/v2-add-remove-add.t @@ -13,9 +13,9 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) { plan skip_all => "$mod missing for v2-add-remove-add.t" if $@; } use_ok 'PublicInbox::V2Writable'; -my $mainrepo = tempdir('pi-add-remove-add-XXXXXX', TMPDIR => 1, CLEANUP => 1); +my $inboxdir = tempdir('pi-add-remove-add-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $ibx = { - mainrepo => "$mainrepo/v2", + inboxdir => "$inboxdir/v2", name => 'test-v2writable', version => 2, -primary_address => 'test@example.com', @@ -18,7 +18,7 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) { use_ok 'PublicInbox::V2Writable'; my $tmpdir = tempdir('pi-v2mda-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $ibx = { - mainrepo => "$tmpdir/inbox", + inboxdir => "$tmpdir/inbox", name => 'test-v2writable', address => [ 'test@example.com' ], }; @@ -45,7 +45,7 @@ my $faildir = "$tmpdir/fail"; local $ENV{PI_EMERGENCY} = $faildir; ok(mkdir $faildir); my @cmd = (qw(public-inbox-init), "-V$V", $ibx->{name}, - $ibx->{mainrepo}, 'http://localhost/test', + $ibx->{inboxdir}, 'http://localhost/test', $ibx->{address}->[0]); ok(PublicInbox::Import::run_die(\@cmd), 'initialized v2 inbox'); diff --git a/t/v2mirror.t b/t/v2mirror.t index 86ca895d..a097a7f3 100644 --- a/t/v2mirror.t +++ b/t/v2mirror.t @@ -28,7 +28,7 @@ my $pi_config = "$tmpdir/config"; open my $fh, '>', $pi_config or die "open($pi_config): $!"; print $fh <<"" or die "print $pi_config: $!"; [publicinbox "v2"] - mainrepo = $tmpdir/in + inboxdir = $tmpdir/in address = test\@example.com close $fh or die "close($pi_config): $!"; @@ -88,7 +88,7 @@ foreach my $i (0..$epoch_max) { is(system(@cmd), 0, 'initialized public-inbox -V2'); is(system("$script-index", "$tmpdir/m"), 0, 'indexed'); -my $mibx = { mainrepo => "$tmpdir/m", address => 'alt@example.com' }; +my $mibx = { inboxdir => "$tmpdir/m", address => 'alt@example.com' }; $mibx = PublicInbox::Inbox->new($mibx); is_deeply([$mibx->mm->minmax], [$ibx->mm->minmax], 'index synched minmax'); diff --git a/t/v2reindex.t b/t/v2reindex.t index 1dcefbe3..7c5a6b07 100644 --- a/t/v2reindex.t +++ b/t/v2reindex.t @@ -15,9 +15,9 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) { plan skip_all => "$mod missing for v2reindex.t" if $@; } use_ok 'PublicInbox::V2Writable'; -my $mainrepo = tempdir('pi-v2reindex-XXXXXX', TMPDIR => 1, CLEANUP => 1); +my $inboxdir = tempdir('pi-v2reindex-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $ibx_config = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'test-v2writable', version => 2, -primary_address => 'test@example.com', @@ -100,7 +100,7 @@ my ($mark1, $mark2, $mark3, $mark4); is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } -my $xap = "$mainrepo/xap".PublicInbox::Search::SCHEMA_VERSION(); +my $xap = "$inboxdir/xap".PublicInbox::Search::SCHEMA_VERSION(); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed'); { @@ -120,7 +120,7 @@ ok(!-d $xap, 'Xapian directories removed'); is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } -ok(unlink "$mainrepo/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { @@ -143,7 +143,7 @@ ok(!-d $xap, 'Xapian directories removed again'); } my %sizes; -ok(unlink "$mainrepo/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { @@ -168,7 +168,7 @@ ok(!-d $xap, 'Xapian directories removed again'); is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } -ok(unlink "$mainrepo/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { @@ -207,7 +207,7 @@ ok(!-d $xap, 'Xapian directories removed again'); is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } -ok(unlink "$mainrepo/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { @@ -237,7 +237,7 @@ ok(!-d $xap, 'Xapian directories removed again'); # An incremental indexing test -ok(unlink "$mainrepo/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { @@ -347,7 +347,7 @@ ok(!-d $xap, 'Xapian directories removed again'); # Another incremental indexing test -ok(unlink "$mainrepo/msgmap.sqlite3", 'remove msgmap'); +ok(unlink "$inboxdir/msgmap.sqlite3", 'remove msgmap'); remove_tree($xap); ok(!-d $xap, 'Xapian directories removed again'); { diff --git a/t/v2writable.t b/t/v2writable.t index c1c9196f..c2daac2f 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -14,9 +14,9 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) { } use_ok 'PublicInbox::V2Writable'; umask 007; -my $mainrepo = tempdir('pi-v2writable-XXXXXX', TMPDIR => 1, CLEANUP => 1); +my $inboxdir = tempdir('pi-v2writable-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $ibx = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'test-v2writable', version => 2, -primary_address => 'test@example.com', @@ -36,9 +36,9 @@ my $mime = PublicInbox::MIME->create( my $im = PublicInbox::V2Writable->new($ibx, {nproc => 1}); is($im->{shards}, 1, 'one shard when forced'); ok($im->add($mime), 'ordinary message added'); -foreach my $f ("$mainrepo/msgmap.sqlite3", - glob("$mainrepo/xap*/*"), - glob("$mainrepo/xap*/*/*")) { +foreach my $f ("$inboxdir/msgmap.sqlite3", + glob("$inboxdir/xap*/*"), + glob("$inboxdir/xap*/*/*")) { my @st = stat($f); my ($bn) = (split(m!/!, $f))[-1]; is($st[2] & 07777, -f _ ? 0660 : 0770, @@ -48,10 +48,10 @@ foreach my $f ("$mainrepo/msgmap.sqlite3", my $git0; if ('ensure git configs are correct') { - my @cmd = (qw(git config), "--file=$mainrepo/all.git/config", + my @cmd = (qw(git config), "--file=$inboxdir/all.git/config", qw(core.sharedRepository 0644)); is(system(@cmd), 0, "set sharedRepository in all.git"); - $git0 = PublicInbox::Git->new("$mainrepo/git/0.git"); + $git0 = PublicInbox::Git->new("$inboxdir/git/0.git"); chomp(my $v = $git0->qx(qw(config core.sharedRepository))); is($v, '0644', 'child repo inherited core.sharedRepository'); chomp($v = $git0->qx(qw(config --bool repack.writeBitmaps))); @@ -131,14 +131,14 @@ if ('ensure git configs are correct') { { use Net::NNTP; - my $err = "$mainrepo/stderr.log"; - my $out = "$mainrepo/stdout.log"; + my $err = "$inboxdir/stderr.log"; + my $out = "$inboxdir/stdout.log"; my $group = 'inbox.comp.test.v2writable'; - my $pi_config = "$mainrepo/pi_config"; + my $pi_config = "$inboxdir/pi_config"; open my $fh, '>', $pi_config or die "open: $!\n"; print $fh <<EOF [publicinbox "test-v2writable"] - mainrepo = $mainrepo + inboxdir = $inboxdir version = 2 address = test\@example.com newsgroup = $group diff --git a/t/watch_filter_rubylang.t b/t/watch_filter_rubylang.t index b28d699a..4b88d670 100644 --- a/t/watch_filter_rubylang.t +++ b/t/watch_filter_rubylang.t @@ -32,15 +32,15 @@ for my $v (@v) { my @warn; $SIG{__WARN__} = sub { push @warn, @_ }; my $cfgpfx = "publicinbox.$v"; - my $mainrepo = "$tmpdir/$v"; + my $inboxdir = "$tmpdir/$v"; my $maildir = "$tmpdir/md-$v"; my $spamdir = "$tmpdir/spam-$v"; my $addr = "test-$v\@example.com"; - my @cmd = ('blib/script/public-inbox-init', "-$v", $v, $mainrepo, + my @cmd = ('blib/script/public-inbox-init', "-$v", $v, $inboxdir, "http://example.com/$v", $addr); is(system(@cmd), 0, 'public-inbox init OK'); if ($v eq 'V1') { - is(system('blib/script/public-inbox-index', $mainrepo), 0); + is(system('blib/script/public-inbox-index', $inboxdir), 0); } PublicInbox::Emergency->new($spamdir); @@ -72,7 +72,7 @@ EOF my $orig = <<EOF; $cfgpfx.address=$addr -$cfgpfx.mainrepo=$mainrepo +$cfgpfx.inboxdir=$inboxdir $cfgpfx.watch=maildir:$maildir $cfgpfx.filter=PublicInbox::Filter::RubyLang $cfgpfx.altid=serial:alerts:file=msgmap.sqlite3 diff --git a/t/watch_maildir.t b/t/watch_maildir.t index e65ab9a9..e6cd599c 100644 --- a/t/watch_maildir.t +++ b/t/watch_maildir.t @@ -37,7 +37,7 @@ my $sem = PublicInbox::Emergency->new($spamdir); # create dirs my $config = PublicInbox::Config->new(\<<EOF); $cfgpfx.address=$addr -$cfgpfx.mainrepo=$git_dir +$cfgpfx.inboxdir=$git_dir $cfgpfx.watch=maildir:$maildir $cfgpfx.filter=PublicInbox::Filter::Vger publicinboxlearn.watchspam=maildir:$spamdir diff --git a/t/watch_maildir_v2.t b/t/watch_maildir_v2.t index 99551ceb..ccc85c17 100644 --- a/t/watch_maildir_v2.t +++ b/t/watch_maildir_v2.t @@ -14,14 +14,14 @@ foreach my $mod (@mods) { } require PublicInbox::V2Writable; my $tmpdir = tempdir('watch_maildir-v2-XXXXXX', TMPDIR => 1, CLEANUP => 1); -my $mainrepo = "$tmpdir/v2"; +my $inboxdir = "$tmpdir/v2"; my $maildir = "$tmpdir/md"; my $spamdir = "$tmpdir/spam"; use_ok 'PublicInbox::WatchMaildir'; use_ok 'PublicInbox::Emergency'; my $cfgpfx = "publicinbox.test"; my $addr = 'test-public@example.com'; -my @cmd = ('blib/script/public-inbox-init', '-V2', 'test', $mainrepo, +my @cmd = ('blib/script/public-inbox-init', '-V2', 'test', $inboxdir, 'http://example.com/v2list', $addr); local $ENV{PI_CONFIG} = "$tmpdir/pi_config"; is(system(@cmd), 0, 'public-inbox init OK'); @@ -42,7 +42,7 @@ my $sem = PublicInbox::Emergency->new($spamdir); # create dirs my $orig = <<EOF; $cfgpfx.address=$addr -$cfgpfx.mainrepo=$mainrepo +$cfgpfx.inboxdir=$inboxdir $cfgpfx.watch=maildir:$maildir $cfgpfx.filter=PublicInbox::Filter::Vger publicinboxlearn.watchspam=maildir:$spamdir @@ -56,7 +56,7 @@ PublicInbox::WatchMaildir->new($config)->scan('full'); my ($total, undef) = $srch->reopen->query(''); is($total, 1, 'got one revision'); -# my $git = PublicInbox::Git->new("$mainrepo/git/0.git"); +# my $git = PublicInbox::Git->new("$inboxdir/git/0.git"); # my @list = $git->qx(qw(rev-list refs/heads/master)); # is(scalar @list, 1, 'one revision in rev-list'); @@ -148,7 +148,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html\n); is(system(qw(git init -q --bare), $v1repo), 0, 'v1 init OK'); my $cfg2 = <<EOF; $orig$v1pfx.address=$v1addr -$v1pfx.mainrepo=$v1repo +$v1pfx.inboxdir=$v1repo $v1pfx.watch=maildir:$maildir EOF my $config = PublicInbox::Config->new(\$cfg2); diff --git a/t/www_listing.t b/t/www_listing.t index 990233c8..9f71257d 100644 --- a/t/www_listing.t +++ b/t/www_listing.t @@ -91,15 +91,15 @@ SKIP: { open $fh, '>', $cfgfile or die; print $fh <<"" or die; [publicinbox "bare"] - mainrepo = $bare->{git_dir} + inboxdir = $bare->{git_dir} url = http://$host/bare address = bare\@example.com [publicinbox "alt"] - mainrepo = $alt + inboxdir = $alt url = http://$host/alt address = alt\@example.com [publicinbox "v2"] - mainrepo = $v2 + inboxdir = $v2 url = http://$host/v2 address = v2\@example.com diff --git a/t/xcpdb-reshard.t b/t/xcpdb-reshard.t index d921e12f..43e08639 100644 --- a/t/xcpdb-reshard.t +++ b/t/xcpdb-reshard.t @@ -27,7 +27,7 @@ my $mime = PublicInbox::MIME->create( my ($this) = (split('/', $0))[-1]; my $tmpdir = tempdir($this.'-XXXXXX', TMPDIR => 1, CLEANUP => 1); my $ibx = PublicInbox::Inbox->new({ - mainrepo => "$tmpdir/testbox", + inboxdir => "$tmpdir/testbox", name => $this, version => 2, -primary_address => 'test@example.com', @@ -43,7 +43,7 @@ for my $i (1..$ndoc) { ok($im->add($mime), "message $i added"); } $im->done; -my @shards = grep(m!/\d+\z!, glob("$ibx->{mainrepo}/xap*/*")); +my @shards = grep(m!/\d+\z!, glob("$ibx->{inboxdir}/xap*/*")); is(scalar(@shards), $nproc, 'got expected shards'); my $orig = $ibx->over->query_xover(1, $ndoc); my %nums = map {; "$_->{num}" => 1 } @$orig; @@ -51,8 +51,8 @@ my %nums = map {; "$_->{num}" => 1 } @$orig; # ensure we can go up or down in shards, or stay the same: for my $R (qw(2 4 1 3 3)) { delete $ibx->{search}; # release old handles - is(system(@xcpdb, "-R$R", $ibx->{mainrepo}), 0, "xcpdb -R$R"); - my @new_shards = grep(m!/\d+\z!, glob("$ibx->{mainrepo}/xap*/*")); + is(system(@xcpdb, "-R$R", $ibx->{inboxdir}), 0, "xcpdb -R$R"); + my @new_shards = grep(m!/\d+\z!, glob("$ibx->{inboxdir}/xap*/*")); is(scalar(@new_shards), $R, 'resharded to two shards'); my $msgs = $ibx->search->query('s:this'); is(scalar(@$msgs), $ndoc, 'got expected docs after resharding'); |