Documentation/public-inbox-config.pod | 19 +++++++++++++------ Documentation/public-inbox-convert.pod | 2 +- Documentation/public-inbox-init.pod | 2 +- Documentation/public-inbox-watch.pod | 4 ++-- examples/public-inbox-config | 6 ++++-- lib/PublicInbox/Admin.pm | 8 ++++---- lib/PublicInbox/AdminEdit.pm | 4 ++-- lib/PublicInbox/AltId.pm | 4 ++-- lib/PublicInbox/Config.pm | 10 +++++++--- lib/PublicInbox/Inbox.pm | 14 +++++++------- lib/PublicInbox/InboxWritable.pm | 2 +- lib/PublicInbox/Search.pm | 6 +++--- lib/PublicInbox/SearchIdx.pm | 8 ++++---- lib/PublicInbox/V2Writable.pm | 16 ++++++++-------- lib/PublicInbox/WwwAtomStream.pm | 2 +- lib/PublicInbox/WwwListing.pm | 2 +- lib/PublicInbox/WwwStream.pm | 2 +- lib/PublicInbox/WwwText.pm | 3 +++ lib/PublicInbox/Xapcmd.pm | 4 ++-- script/public-inbox-convert | 16 ++++++++-------- script/public-inbox-edit | 2 +- script/public-inbox-init | 16 ++++++++-------- script/public-inbox-mda | 2 +- scripts/dupe-finder | 2 +- scripts/import_vger_from_mbox | 6 +++--- t/admin.t | 2 +- t/altid.t | 2 +- t/altid_v2.t | 6 +++--- t/cgi.t | 2 +- t/config.t | 34 +++++++++++++++++++++++++--------- t/config_limiter.t | 4 ++-- t/convert-compact.t | 20 ++++++++++---------- t/edit.t | 32 ++++++++++++++++---------------- t/feed.t | 2 +- t/filter_rubylang.t | 2 +- t/html_index.t | 2 +- t/indexlevels-mirror.t | 16 ++++++++-------- t/mda.t | 2 +- t/mda_filter_rubylang.t | 6 +++--- t/nntp.t | 2 +- t/nntpd-tls.t | 6 +++--- t/nntpd-validate.t | 4 ++-- t/nntpd.t | 6 +++--- t/perf-msgview.t | 2 +- t/perf-nntpd.t | 4 ++-- t/perf-threading.t | 2 +- t/plack.t | 2 +- t/psgi_attach.t | 2 +- t/psgi_bad_mids.t | 6 +++--- t/psgi_mount.t | 2 +- t/psgi_multipart_not.t | 4 ++-- t/psgi_scan_all.t | 6 +++--- t/psgi_search.t | 4 ++-- t/psgi_text.t | 2 +- t/psgi_v2.t | 6 +++--- t/purge.t | 12 ++++++------ t/replace.t | 4 ++-- t/search-thr-index.t | 2 +- t/search.t | 2 +- t/solver_git.t | 6 +++--- t/v1-add-remove-add.t | 6 +++--- t/v1reindex.t | 20 ++++++++++---------- t/v2-add-remove-add.t | 4 ++-- t/v2mda.t | 4 ++-- t/v2mirror.t | 4 ++-- t/v2reindex.t | 18 +++++++++--------- t/v2writable.t | 22 +++++++++++----------- t/watch_filter_rubylang.t | 8 ++++---- t/watch_maildir.t | 2 +- t/watch_maildir_v2.t | 10 +++++----- t/www_listing.t | 6 +++--- t/xcpdb-reshard.t | 8 ++++---- diff --git a/Documentation/public-inbox-config.pod b/Documentation/public-inbox-config.pod index 6a9739f71433c85ac8bba39ea8e0a0a11b0de5a0..1c5ba015e60c7f6cef4762e8e8d4aa575df4f876 100644 --- a/Documentation/public-inbox-config.pod +++ b/Documentation/public-inbox-config.pod @@ -17,12 +17,16 @@ =head2 EXAMPLE [publicinbox "test"] - mainrepo = /home/user/path/to/test.git + inboxdir = /home/user/path/to/test.git ; multiple addresses are supported address = test@example.com ; address = alternate@example.com url = http://example.com/test newsgroup = inbox.test + + ; backwards compatibility with public-inbox pre-1.2.0, + ; "inboxdir" takes precedence over "mainrepo" + mainrepo = /home/user/path/to/test.git =head2 VARIABLES @@ -38,10 +42,13 @@ informational purposes. Default: none, required -=item publicinbox..mainrepo +=item publicinbox..inboxdir The absolute path to the directory which hosts the public-inbox. This must be specified once. + +This was previously known as "mainrepo", which remains supported, +but "inboxdir" takes precedence. Default: none, required @@ -373,20 +380,20 @@ =head3 EXAMPLE WITH NAMED LIMITERS ; big inboxes which require lots of memory to clone: [publicinbox "big1"] - mainrepo = /path/to/big1 + inboxdir = /path/to/big1 address = big1@example.com httpbackendmax = big [publicinbox "big2"] - mainrepo = /path/to/big2 + inboxdir = /path/to/big2 address = big2@example.com httpbackendmax = big ; tiny inboxes which are easily cloned: [publicinbox "tiny1"] - mainrepo = /path/to/tiny1 + inboxdir = /path/to/tiny1 address = tiny1@example.com [publicinbox "tiny2"] - mainrepo = /path/to/tiny2 + inboxdir = /path/to/tiny2 address = tiny2@example.com [publicinboxlimiter "big"] diff --git a/Documentation/public-inbox-convert.pod b/Documentation/public-inbox-convert.pod index 4e358c9d8f689436ecba98f241b3a397516cf2ef..4c790dee689e21b6587148f2044d333a8d1bf1b9 100644 --- a/Documentation/public-inbox-convert.pod +++ b/Documentation/public-inbox-convert.pod @@ -10,7 +10,7 @@ =head1 DESCRIPTION public-inbox-convert copies the contents of an old "v1" inbox into a new "v2" inbox. It makes no changes to the old inbox -and users are expected to update the "mainrepo" path in +and users are expected to update the "inboxdir" path in L to point to the path of NEW_DIR once they are satisfied with the conversion. diff --git a/Documentation/public-inbox-init.pod b/Documentation/public-inbox-init.pod index 377fb2a299d4809f2a42d35eaf56c3eab529c287..f5de6bf966d0f7a03fd4cbe731a62d71e7a9bba1 100644 --- a/Documentation/public-inbox-init.pod +++ b/Documentation/public-inbox-init.pod @@ -11,7 +11,7 @@ Creates an empty public-inbox or reinitializes an existing one. It updates C<~/.public-inbox/config> by creating a C<[publicinbox "NAME"]> section where -C is C, +C is C, C is C, and C is C
. Multiple addresses may be specified for inboxes with multiple addresses. diff --git a/Documentation/public-inbox-watch.pod b/Documentation/public-inbox-watch.pod index 198c170a6951c94d5bf18e24109a13818d3dd9c7..0934eaded070d1f7dfe32abcd771508b4957c145 100644 --- a/Documentation/public-inbox-watch.pod +++ b/Documentation/public-inbox-watch.pod @@ -12,7 +12,7 @@ [publicinbox "test"] ; generic public-inbox-config keys: address = test@example.com url = http://example.com/test - mainrepo = /path/to/test.example.com.git + inboxdir = /path/to/test.example.com.git ; config keys specific to public-inbox-watch: @@ -28,7 +28,7 @@ spamcheck = spamc ; optional, emails marked as read which appear ; here will be trained as spam and deleted from - ; the mainrepos of any public-inboxes which are + ; the inboxdirs of any public-inboxes which are ; configured for watch. ; This is global for all publicinbox.* sections watchspam = maildir:/path/to/maildirs/.INBOX.spam diff --git a/examples/public-inbox-config b/examples/public-inbox-config index 7fcbe0ba52cecd1518f6949841a0079109ec12ba..ba06eec3ed52584313a2553b4db5e37a2e222ec3 100644 --- a/examples/public-inbox-config +++ b/examples/public-inbox-config @@ -4,9 +4,11 @@ [publicinbox "test"] address = try@public-inbox.org address = sandbox@public-inbox.org address = test@public-inbox.org - mainrepo = /home/pi/test-main.git + ; note: "mainrepo" is the old name for "inboxdir", both + ; remain supported for backwards compatibility. + inboxdir = /home/pi/test-main.git url = http://example.com/test [publicinbox "meta"] address = meta@public-inbox.org - mainrepo = /home/pi/meta-main.git + inboxdir = /home/pi/meta-main.git url = http://example.com/meta diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm index 2b25cf0112d9bc99fab402c989e581e4d17203c0..e9fb5d6f1d53b42043ff6393d014b446aa16e250 100644 --- a/lib/PublicInbox/Admin.pm +++ b/lib/PublicInbox/Admin.pm @@ -61,7 +61,7 @@ if ($m eq 'medium') { $l = $m; } elsif ($m ne '') { warn <<""; -$ibx->{mainrepo} has unexpected indexlevel in Xapian: $m +$ibx->{inboxdir} has unexpected indexlevel in Xapian: $m } } @@ -74,7 +74,7 @@ my $name = "unconfigured-$i"; PublicInbox::Inbox->new({ name => $name, address => [ "$name\@example.com" ], - mainrepo => $dir, + inboxdir => $dir, # TODO: consumers may want to warn on this: #-unconfigured => 1, }); @@ -101,12 +101,12 @@ if ($cfg) { $cfg->each_inbox(sub { my ($ibx) = @_; $ibx->{version} ||= 1; - my $path = abs_path($ibx->{mainrepo}); + my $path = abs_path($ibx->{inboxdir}); if (defined($path)) { $dir2ibx{$path} = $ibx; } else { warn <{name} $ibx->{mainrepo}: $! +W: $ibx->{name} $ibx->{inboxdir}: $! EOF } }); diff --git a/lib/PublicInbox/AdminEdit.pm b/lib/PublicInbox/AdminEdit.pm index 2e2a8629da2806f09df171422afc7c012fad4246..d4a92266d95a5d01f3fa6b4c90ddc0c26a86c7f0 100644 --- a/lib/PublicInbox/AdminEdit.pm +++ b/lib/PublicInbox/AdminEdit.pm @@ -25,7 +25,7 @@ # it's possible for a Xapian directory to exist, # but Search::Xapian to go missing/broken. # Make sure it's purged in that case: - $ibx->over or die "no over.sqlite3 in $ibx->{mainrepo}\n"; + $ibx->over or die "no over.sqlite3 in $ibx->{inboxdir}\n"; # $ibx->{search} is populated by $ibx->over call my $xdir_ro = $ibx->{search}->xdir(1); @@ -51,7 +51,7 @@ # takes the output of V2Writable::purge and V2Writable::replace # $rewrites = [ array commits keyed by epoch ] sub show_rewrites ($$$) { my ($fh, $ibx, $rewrites) = @_; - print $fh "$ibx->{mainrepo}:"; + print $fh "$ibx->{inboxdir}:"; if (scalar @$rewrites) { my $epoch = -1; my @out = map {; diff --git a/lib/PublicInbox/AltId.pm b/lib/PublicInbox/AltId.pm index 6103d52e7fba0a4768a0bad20e2d7071bec5b53e..b4daaed2b64c56355ba539bebd60f1e173c7c350 100644 --- a/lib/PublicInbox/AltId.pm +++ b/lib/PublicInbox/AltId.pm @@ -32,9 +32,9 @@ } split(/[&;]/, $query); my $f = $params{file} or die "file: required for $type spec $spec\n"; unless (index($f, '/') == 0) { if (($ibx->{version} || 1) == 1) { - $f = "$ibx->{mainrepo}/public-inbox/$f"; + $f = "$ibx->{inboxdir}/public-inbox/$f"; } else { - $f = "$ibx->{mainrepo}/$f"; + $f = "$ibx->{inboxdir}/$f"; } } bless { diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 509de0a0b844784f6d8c05bbc5d1ac741dd4902b..2da202f99f6dd2e45729cb1a8dcca702d572c726 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -93,7 +93,7 @@ my ($self, $cb) = @_; # may auto-vivify if config file is non-existent: foreach my $section (@{$self->{-section_order}}) { next if $section !~ m!\Apublicinbox\.([^/]+)\z!; - defined($self->{"publicinbox.$1.mainrepo"}) or next; + defined($self->{"publicinbox.$1.inboxdir"}) or next; my $ibx = lookup_name($self, $1) or next; $cb->($ibx); } @@ -362,12 +362,16 @@ sub _fill { my ($self, $pfx) = @_; my $ibx = {}; - foreach my $k (qw(mainrepo filter url newsgroup + foreach my $k (qw(inboxdir filter url newsgroup infourl watch watchheader httpbackendmax replyto feedmax nntpserver indexlevel)) { my $v = $self->{"$pfx.$k"}; $ibx->{$k} = $v if defined $v; } + + # backwards compatibility: + $ibx->{inboxdir} //= $self->{"$pfx.mainrepo"}; + foreach my $k (qw(obfuscate)) { my $v = $self->{"$pfx.$k"}; defined $v or next; @@ -385,7 +389,7 @@ $ibx->{$k} = _array($v); } } - return unless $ibx->{mainrepo}; + return unless $ibx->{inboxdir}; my $name = $pfx; $name =~ s/\Apublicinbox\.//; diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index 85f56acbae18e30eed54a52e342cb4a4885fa355..5feb2154f562fda7ce69271d11f3f40e9ba44b88 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -109,7 +109,7 @@ my $pi_config = delete $opts->{-pi_config}; _set_limiter($opts, $pi_config, 'httpbackend'); _set_uint($opts, 'feedmax', 25); $opts->{nntpserver} ||= $pi_config->{'publicinbox.nntpserver'}; - my $dir = $opts->{mainrepo}; + my $dir = $opts->{inboxdir}; if (defined $dir && -f "$dir/inbox.lock") { $opts->{version} = 2; } @@ -129,7 +129,7 @@ sub git_epoch { my ($self, $epoch) = @_; ($self->{version} || 1) == 2 or return; $self->{"$epoch.git"} ||= eval { - my $git_dir = "$self->{mainrepo}/git/$epoch.git"; + my $git_dir = "$self->{inboxdir}/git/$epoch.git"; my $g = PublicInbox::Git->new($git_dir); $g->{-httpbackend_limiter} = $self->{-httpbackend_limiter}; # no cleanup needed, we never cat-file off this, only clone @@ -140,7 +140,7 @@ sub git { my ($self) = @_; $self->{git} ||= eval { - my $git_dir = $self->{mainrepo}; + my $git_dir = $self->{inboxdir}; $git_dir .= '/all.git' if (($self->{version} || 1) == 2); my $g = PublicInbox::Git->new($git_dir); $g->{-httpbackend_limiter} = $self->{-httpbackend_limiter}; @@ -157,7 +157,7 @@ my $cur = $self->{-max_git_epoch}; my $changed = git($self)->alternates_changed; if (!defined($cur) || $changed) { $self->git->cleanup if $changed; - my $gits = "$self->{mainrepo}/git"; + my $gits = "$self->{inboxdir}/git"; if (opendir my $dh, $gits) { my $max = -1; while (defined(my $git_dir = readdir($dh))) { @@ -177,7 +177,7 @@ my ($self) = @_; $self->{mm} ||= eval { require PublicInbox::Msgmap; _cleanup_later($self); - my $dir = $self->{mainrepo}; + my $dir = $self->{inboxdir}; if (($self->{version} || 1) >= 2) { PublicInbox::Msgmap->new_file("$dir/msgmap.sqlite3"); } else { @@ -220,7 +220,7 @@ sub description { my ($self) = @_; my $desc = $self->{description}; return $desc if defined $desc; - $desc = try_cat("$self->{mainrepo}/description"); + $desc = try_cat("$self->{inboxdir}/description"); local $/ = "\n"; chomp $desc; $desc =~ s/\s+/ /smg; @@ -232,7 +232,7 @@ sub cloneurl { my ($self) = @_; my $url = $self->{cloneurl}; return $url if $url; - $url = try_cat("$self->{mainrepo}/cloneurl"); + $url = try_cat("$self->{inboxdir}/cloneurl"); my @url = split(/\s+/s, $url); local $/ = "\n"; chomp @url; diff --git a/lib/PublicInbox/InboxWritable.pm b/lib/PublicInbox/InboxWritable.pm index 4b22149f48c8f72bf0d0b562ff8ecdd9491c63d2..174e4245ab08157714b05f6e19377018023a1fc9 100644 --- a/lib/PublicInbox/InboxWritable.pm +++ b/lib/PublicInbox/InboxWritable.pm @@ -35,7 +35,7 @@ my ($self, $shards, $skip_epoch, $skip_artnum) = @_; # TODO: honor skip_artnum my $v = $self->{version} || 1; if ($v == 1) { - my $dir = $self->{mainrepo} or die "no mainrepo in inbox\n"; + my $dir = $self->{inboxdir} or die "no inboxdir in inbox\n"; PublicInbox::Import::init_bare($dir); } else { my $v2w = importer($self); diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index a0e6a93b1e4460d08aff18ff2a48a881a5fcd25a..06a84c340e4cd8a5502018801f5b689b6149d70c 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -126,9 +126,9 @@ sub xdir ($;$) { my ($self, $rdonly) = @_; if ($self->{version} == 1) { - "$self->{mainrepo}/public-inbox/xapian" . SCHEMA_VERSION; + "$self->{inboxdir}/public-inbox/xapian" . SCHEMA_VERSION; } else { - my $dir = "$self->{mainrepo}/xap" . SCHEMA_VERSION; + my $dir = "$self->{inboxdir}/xap" . SCHEMA_VERSION; return $dir if $rdonly; my $shard = $self->{shard}; @@ -173,7 +173,7 @@ sub new { my ($class, $ibx) = @_; ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx"; my $self = bless { - mainrepo => $ibx->{mainrepo}, + inboxdir => $ibx->{inboxdir}, altid => $ibx->{altid}, version => $ibx->{version} // 1, }, $class; diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 1b1a21b767b1443367045a845a6c8a3acb37ef22..aed3875a037254b94222faa2147e9f17abe31612 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -32,7 +32,7 @@ sub new { my ($class, $ibx, $creat, $shard) = @_; ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx"; my $levels = qr/\A(?:full|medium|basic)\z/; - my $mainrepo = $ibx->{mainrepo}; + my $inboxdir = $ibx->{inboxdir}; my $version = $ibx->{version} || 1; my $indexlevel = 'full'; my $altid = $ibx->{altid}; @@ -49,7 +49,7 @@ } } $ibx = PublicInbox::InboxWritable->new($ibx); my $self = bless { - mainrepo => $mainrepo, + inboxdir => $inboxdir, -inbox => $ibx, git => $ibx->git, -altid => $altid, @@ -58,7 +58,7 @@ indexlevel => $indexlevel, }, $class; $ibx->umask_prepare; if ($version == 1) { - $self->{lock_path} = "$mainrepo/ssoma.lock"; + $self->{lock_path} = "$inboxdir/ssoma.lock"; my $dir = $self->xdir; $self->{over} = PublicInbox::OverIdx->new("$dir/over.sqlite3"); } elsif ($version == 2) { @@ -603,7 +603,7 @@ my ($self) = @_; die "BUG: _msgmap_init is only for v1\n" if $self->{version} != 1; $self->{mm} ||= eval { require PublicInbox::Msgmap; - PublicInbox::Msgmap->new($self->{mainrepo}, 1); + PublicInbox::Msgmap->new($self->{inboxdir}, 1); }; } diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 627bcba94a0c4ec57239b8e98aa9318bb76ea18c..6a88f62aea1ab3042aef1875a23bd45d3dd643a0 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -76,7 +76,7 @@ sub new { # $creat may be any true value, or 0/undef. A hashref is true, # and $creat->{nproc} may be set to an integer my ($class, $v2ibx, $creat) = @_; - my $dir = $v2ibx->{mainrepo} or die "no mainrepo in inbox\n"; + my $dir = $v2ibx->{inboxdir} or die "no inboxdir in inbox\n"; unless (-d $dir) { if ($creat) { require File::Path; @@ -304,7 +304,7 @@ # Now that all subprocesses are up, we can open the FDs # for SQLite: my $mm = $self->{mm} = PublicInbox::Msgmap->new_file( - "$self->{-inbox}->{mainrepo}/msgmap.sqlite3", 1); + "$self->{-inbox}->{inboxdir}/msgmap.sqlite3", 1); $mm->{dbh}->begin_work; }); } @@ -315,7 +315,7 @@ # $replace_map = { $object_id => $strref, ... } sub _replace_oids ($$$) { my ($self, $mime, $replace_map) = @_; $self->done; - my $pfx = "$self->{-inbox}->{mainrepo}/git"; + my $pfx = "$self->{-inbox}->{inboxdir}/git"; my $rewrites = []; # epoch => commit my $max = $self->{epoch_max}; @@ -663,8 +663,8 @@ sub fill_alternates ($$) { my ($self, $epoch) = @_; - my $pfx = "$self->{-inbox}->{mainrepo}/git"; - my $all = "$self->{-inbox}->{mainrepo}/all.git"; + my $pfx = "$self->{-inbox}->{inboxdir}/git"; + my $all = "$self->{-inbox}->{inboxdir}/all.git"; unless (-d $all) { PublicInbox::Import::init_bare($all); @@ -690,7 +690,7 @@ } sub git_init { my ($self, $epoch) = @_; - my $git_dir = "$self->{-inbox}->{mainrepo}/git/$epoch.git"; + my $git_dir = "$self->{-inbox}->{inboxdir}/git/$epoch.git"; my @cmd = (qw(git init --bare -q), $git_dir); PublicInbox::Import::run_die(\@cmd); @cmd = (qw/git config/, "--file=$git_dir/config", @@ -703,7 +703,7 @@ sub git_dir_latest { my ($self, $max) = @_; $$max = -1; - my $pfx = "$self->{-inbox}->{mainrepo}/git"; + my $pfx = "$self->{-inbox}->{inboxdir}/git"; return unless -d $pfx; my $latest; opendir my $dh, $pfx or die "opendir $pfx: $!\n"; @@ -935,7 +935,7 @@ } last_epoch_commit($self, $i, $cmt); } -sub git_dir_n ($$) { "$_[0]->{-inbox}->{mainrepo}/git/$_[1].git" } +sub git_dir_n ($$) { "$_[0]->{-inbox}->{inboxdir}/git/$_[1].git" } sub last_commits ($$) { my ($self, $epoch_max) = @_; diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm index 05659f1fad7e2355cdd3052f1e597daebee54449..83984d37e1813525f621a72afe9a09dc67079706 100644 --- a/lib/PublicInbox/WwwAtomStream.pm +++ b/lib/PublicInbox/WwwAtomStream.pm @@ -84,7 +84,7 @@ $title = title_tag($ibx->description); $self_url .= 'new.atom'; $page_id = "mailto:$ibx->{-primary_address}"; } - my $mtime = (stat($ibx->{mainrepo}))[9] || time; + my $mtime = (stat($ibx->{inboxdir}))[9] || time; qq(\n) . qq({mainrepo}; + my $git_dir = $ibx->{inboxdir}; if (defined $epoch) { $git_dir .= "/git/$epoch.git"; $url_path .= "/git/$epoch.git"; diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index f5338c39a67486d3569993d182b639c5ec6516bb..6696cc35d4d1e24e402ab6ad49f03275a0761333 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@ -98,7 +98,7 @@ if (defined($max)) { # v2 $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 --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm index bcda665c75b9572c029b86b9a829db09e27834fa..1c7b92bd466e5a1a5aeeeee97fc950a413a3184c 100644 --- a/lib/PublicInbox/WwwText.pm +++ b/lib/PublicInbox/WwwText.pm @@ -145,6 +145,9 @@ ; example public-inbox config snippet for "$name" ; see public-inbox-config(5) manpage for more details: ; https://public-inbox.org/public-inbox-config.html [publicinbox "$name"] + inboxdir = /path/to/top-level-inbox + ; note: public-inbox before v1.2.0 used "mainrepo" + ; instead of "inboxdir", both remain supported after 1.2 mainrepo = /path/to/top-level-inbox EOS for my $k (qw(address listid)) { diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm index 819d7829d37dbd95398fcaebb2163365f29d74a2..22e56f42263bf2e85b4a857cfd7b8c4a8381228c 100644 --- a/lib/PublicInbox/Xapcmd.pm +++ b/lib/PublicInbox/Xapcmd.pm @@ -153,7 +153,7 @@ sub run { my ($ibx, $task, $opt) = @_; # task = 'cpdb' or 'compact' my $cb = \&${\"PublicInbox::Xapcmd::$task"}; PublicInbox::Admin::progress_prepare($opt ||= {}); - my $dir = $ibx->{mainrepo} or die "no mainrepo in inbox\n"; + my $dir = $ibx->{inboxdir} or die "no inboxdir in inbox\n"; runnable_or_die($XAPIAN_COMPACT) if $opt->{compact}; my $reindex; # v1:{ from => $x40 }, v2:{ from => [ $x40, $x40, .. ] } } my $from; # per-epoch ranges @@ -181,7 +181,7 @@ # so v2 shards can keep "xap$SCHEMA_VERSION" on a separate FS. if ($v == 1) { if (defined $reshard) { warn -"--reshard=$reshard ignored for v1 $ibx->{mainrepo}\n"; +"--reshard=$reshard ignored for v1 $ibx->{inboxdir}\n"; } my $old_parent = dirname($old); same_fs_or_die($old_parent, $old); diff --git a/script/public-inbox-convert b/script/public-inbox-convert index 9d2d2512a403f99f2d994429d43f166796575e9e..3182410e0a6f0e5037bc41b3b0a8bd040389f072 100755 --- a/script/public-inbox-convert +++ b/script/public-inbox-convert @@ -30,14 +30,14 @@ $old_dir = abs_path($old_dir); my $old; if ($config) { $config->each_inbox(sub { - $old = $_[0] if abs_path($_[0]->{mainrepo}) eq $old_dir; + $old = $_[0] if abs_path($_[0]->{inboxdir}) eq $old_dir; }); } unless ($old) { warn "W: $old_dir not configured in " . PublicInbox::Config::default_file() . "\n"; $old = { - mainrepo => $old_dir, + inboxdir => $old_dir, name => 'ignored', address => [ 'old@example.com' ], }; @@ -48,7 +48,7 @@ if (($old->{version} || 1) >= 2) { die "Only conversion from v1 inboxes is supported\n"; } my $new = { %$old }; -$new->{mainrepo} = abs_path($new_dir); +$new->{inboxdir} = abs_path($new_dir); $new->{version} = 2; $new = PublicInbox::InboxWritable->new($new); my $v2w; @@ -62,9 +62,9 @@ cp($src, $dst) or die "cp $src, $dst failed: $!\n"; } $old->with_umask(sub { - my $old_cfg = "$old->{mainrepo}/config"; + my $old_cfg = "$old->{inboxdir}/config"; local $ENV{GIT_CONFIG} = $old_cfg; - my $new_cfg = "$new->{mainrepo}/all.git/config"; + my $new_cfg = "$new->{inboxdir}/all.git/config"; $v2w = PublicInbox::V2Writable->new($new, 1); $v2w->init_inbox($jobs); unlink $new_cfg; @@ -79,9 +79,9 @@ $dst = $dst->{filename}; $src->mm_alt->{dbh}->sqlite_backup_to_file($dst); } } - my $desc = "$old->{mainrepo}/description"; - link_or_copy($desc, "$new->{mainrepo}/description") if -e $desc; - my $clone = "$old->{mainrepo}/cloneurl"; + my $desc = "$old->{inboxdir}/description"; + link_or_copy($desc, "$new->{inboxdir}/description") if -e $desc; + my $clone = "$old->{inboxdir}/cloneurl"; if (-e $clone) { warn <<""; $clone may not be valid after migrating to v2, not copying diff --git a/script/public-inbox-edit b/script/public-inbox-edit index 6884fd0cb276623f64f4e27b7cb5e965c4140256..f2090abfe583992ab6c398213438c3a76a3775d3 100755 --- a/script/public-inbox-edit +++ b/script/public-inbox-edit @@ -65,7 +65,7 @@ } sub show_cmd ($$) { my ($ibx, $smsg) = @_; - " GIT_DIR=$ibx->{mainrepo}/all.git \\\n git show $smsg->{blob}\n"; + " GIT_DIR=$ibx->{inboxdir}/all.git \\\n git show $smsg->{blob}\n"; } sub show_found () { diff --git a/script/public-inbox-init b/script/public-inbox-init index 8fd2f9dc2f5c490cb8325dbd8b6b74b91febd5be..507112661ddc6a61619b7e30cfc2bbbca59cec71 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -31,7 +31,7 @@ ); GetOptions(%opts) or usage(); PublicInbox::Admin::indexlevel_ok_or_die($indexlevel) if defined $indexlevel; my $name = shift @ARGV or usage(); -my $mainrepo = shift @ARGV or usage(); +my $inboxdir = shift @ARGV or usage(); my $http_url = shift @ARGV or usage(); my (@address) = @ARGV; @address or usage(); @@ -112,18 +112,18 @@ my $pfx = "publicinbox.$name"; my @x = (qw/git config/, "--file=$pi_config_tmp"); -$mainrepo = abs_path($mainrepo); -if (-f "$mainrepo/inbox.lock") { +$inboxdir = abs_path($inboxdir); +if (-f "$inboxdir/inbox.lock") { if (!defined $version) { $version = 2; } elsif ($version != 2) { - die "$mainrepo is a -V2 repo, -V$version specified\n" + die "$inboxdir is a -V2 repo, -V$version specified\n" } -} elsif (-d "$mainrepo/objects") { +} elsif (-d "$inboxdir/objects") { if (!defined $version) { $version = 1; } elsif ($version != 1) { - die "$mainrepo is a -V1 repo, -V$version specified\n" + die "$inboxdir is a -V1 repo, -V$version specified\n" } } @@ -134,7 +134,7 @@ die "--skip-epoch is only supported for -V2 repos\n"; } my $ibx = PublicInbox::Inbox->new({ - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => $name, version => $version, -primary_address => $address[0], @@ -152,7 +152,7 @@ next if $seen{lc($addr)}; x(@x, "--add", "$pfx.address", $addr); } x(@x, "$pfx.url", $http_url); -x(@x, "$pfx.mainrepo", $mainrepo); +x(@x, "$pfx.inboxdir", $inboxdir); if (defined($indexlevel)) { x(@x, "$pfx.indexlevel", $indexlevel); diff --git a/script/public-inbox-mda b/script/public-inbox-mda index 2655a6c5ed064aad67b97f0c575a3212cde68344..dea49dc547820616ad88a53d0bd2e39b91ab34f1 100755 --- a/script/public-inbox-mda +++ b/script/public-inbox-mda @@ -51,7 +51,7 @@ die "ORIGINAL_RECIPIENT not defined in ENV\n"; } 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; diff --git a/scripts/dupe-finder b/scripts/dupe-finder index 1e98093685a5d946b7ca5fd7322b5b2a4604845d..8060a9d7e7f10de3ee7a76b65a76f59713718a25 100644 --- a/scripts/dupe-finder +++ b/scripts/dupe-finder @@ -14,7 +14,7 @@ my $ibx; if (index($repo, '@') > 0) { $ibx = PublicInbox::Config->new->lookup($repo); } elsif (-d $repo) { - $ibx = { mainrepo => $repo, address => 'unnamed@example.com' }; + $ibx = { inboxdir => $repo, address => 'unnamed@example.com' }; $ibx = PublicInbox::Inbox->new($ibx); } else { $ibx = PublicInbox::Config->new->lookup_name($repo); diff --git a/scripts/import_vger_from_mbox b/scripts/import_vger_from_mbox index b2dd5b3ab471c8da2d81dc5e7c2ff8144ba7c70e..6329dd16090095e379f24676da6868849e4b0960 100644 --- a/scripts/import_vger_from_mbox +++ b/scripts/import_vger_from_mbox @@ -23,9 +23,9 @@ die "Unsupported mbox variant: $variant\n"; } my $name = shift or die $usage; # git my $email = shift or die $usage; # git@vger.kernel.org -my $mainrepo = shift or die $usage; # /path/to/v2/repo +my $inboxdir = shift or die $usage; # /path/to/v2/repo my $ibx = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => $name, version => $version, address => [ $email ], @@ -37,7 +37,7 @@ if ($version >= 2) { require PublicInbox::V2Writable; PublicInbox::V2Writable->new($ibx, 1)->init_inbox(0); } else { - system(qw(git init --bare -q), $mainrepo) == 0 or die; + system(qw(git init --bare -q), $inboxdir) == 0 or die; } } $ibx = PublicInbox::InboxWritable->new($ibx); diff --git a/t/admin.t b/t/admin.t index 3790c9e2e20a2248e22c259e63b027bc346244e6..0024df1516c2fd0ad8401abd5dc7c7c41e503634 100644 --- a/t/admin.t +++ b/t/admin.t @@ -56,7 +56,7 @@ } 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', diff --git a/t/altid.t b/t/altid.t index b8d32f781773f018b11aad77e640ef0973fc66ae..4ab004c4d8e8fc2ec8e30b49c50a8cf77619e8d3 100644 --- a/t/altid.t +++ b/t/altid.t @@ -43,7 +43,7 @@ )); $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 35ab7a1b25080263987b3d871ef453c7f9577ee7..2c1d8616cae3d051085d78316640abb94785c30c 100644 --- a/t/altid_v2.t +++ b/t/altid_v2.t @@ -14,12 +14,12 @@ 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 @@ ok(0 == $mm->mid_set(1, 'a@example.com'), 'mid_set fails with dup MID'); } my $ibx = { - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'test-v2writable', version => 2, -primary_address => 'test@example.com', diff --git a/t/cgi.t b/t/cgi.t index 51d649142cabda7aecb2ed453b76d546e475753c..1b4b06cb5eb47bb205ae128c9b53ee3e6e167307 100644 --- a/t/cgi.t +++ b/t/cgi.t @@ -29,7 +29,7 @@ print $fh "test for public-inbox\n"; 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) { diff --git a/t/config.t b/t/config.t index 3b4b12b32c20715ccfa60c6a665b43da9036212a..0866f264e151bffcabda1f9d1bb9055bdc48d33f 100644 --- a/t/config.t +++ b/t/config.t @@ -24,7 +24,7 @@ ok(-r $f, "$f is readable"); 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 @@ 'address' => ['try@public-inbox.org', '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(\<lookup_name('test'); + is($ibx->{inboxdir}, '/path/to/non/existent', 'mainrepo still works'); + + $config = PublicInbox::Config->new(\<lookup_name('test'); + is($ibx->{inboxdir}, '/path/to/non/existent', + 'inboxdir takes precedence'); } { my $pfx = "publicinbox.test"; my $str = <new(\$str); @@ -81,7 +97,7 @@ is($ibx->{nntpserver}, 'news.example.com', 'global NNTP server'); $str = <new(\$str); @@ -95,9 +111,9 @@ my $pfx = "publicinbox.test"; my $pfx2 = "publicinbox.foo"; my $str = <new(\<lookup_name('test'); @@ -27,7 +27,7 @@ { my $config = PublicInbox::Config->new(\<lookup_name('test'); diff --git a/t/convert-compact.t b/t/convert-compact.t index 6d09103176c69cb31ad95f6f1f65e3e5e933fe2e..dbccfbadf59b45bca05d82c7b9b848c2a802bc9f 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 @@ eval { PublicInbox::SearchIdx->new($ibx, 1)->index_sync; }; 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 @@ $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*/*"); diff --git a/t/edit.t b/t/edit.t index 6b4e35c3a7751a9575a38f1aa3dacd6fd77cb07b..1e9597f1f98b8ae6d46785c04b3c1a30f2768579 100644 --- a/t/edit.t +++ b/t/edit.t @@ -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 = '-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 @@ $in = $out = $err = ''; 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 @@ $in = $out = $err = ''; 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 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 = '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 @@ "$^X -i -p -e 's/boolean prefix/bool pfx/'"); 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 = '--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 = '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 .= ' 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`; diff --git a/t/feed.t b/t/feed.t index 4a887b49953df6fbe22369a0e9365eca8f373b74..eb1f35fb0158e6aa357b4f07cde8927040b8a300 100644 --- a/t/feed.t +++ b/t/feed.t @@ -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 9ed6684b804a68f5859358331d5d9e8ada6eecce..7b1da11cddf7ed55f441d23b1428d7179c03f286 100644 --- a/t/filter_rubylang.t +++ b/t/filter_rubylang.t @@ -30,7 +30,7 @@ my $git_dir = tempdir('pi-filter_rubylang-XXXXXX', 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 b9f866b3e842061744c2dac168df8cd1ea72da18..2f4b4d1b71747b2b42227677f46dc1f072c540aa 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 b685da145fefcbe49bfd490186364a2ded5832d1..40afe4e9e7f9234111f1d34247f5fc349c0d6215 100644 --- a/t/indexlevels-mirror.t +++ b/t/indexlevels-mirror.t @@ -36,7 +36,7 @@ my ($v, $level) = @_; 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 @@ ok($im->add($mime), 'first message added'); $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 @@ # clone 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 @@ is(system($index, $mirror), 0, "v$v index mirror OK"); # read-only access my $ro_mirror = PublicInbox::Inbox->new({ - mainrepo => $mirror, + inboxdir => $mirror, indexlevel => $level, }); ($nr, $msgs) = $ro_mirror->recent; @@ -101,7 +101,7 @@ is_deeply([sort { $a cmp $b } map { $_->{mid} } @$msgs], ['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 @@ is_deeply([map { $_->{mid} } @$msgs], ['m@1'], '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') { diff --git a/t/mda.t b/t/mda.t index 3cab590b78f9a9d2728c213706bc229e3ba81aad..1be41bcb34b67b5c4e246666527e331b7953faa8 100644 --- a/t/mda.t +++ b/t/mda.t @@ -38,7 +38,7 @@ is(0, system(qw(git init -q --bare), $maindir), "git init (main)"); 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 279afaac6e7c58d8928d7894217b6fc86f55232b..f7d872c9c8d351fa115fde92b8429b9ca824bba0 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); diff --git a/t/nntp.t b/t/nntp.t index f3a9c7d81e802a6b69c0cc32b80a1f6bf6243df4..aabfd4ffb46798f58240405f0cd70cb0d12fed79 100644 --- a/t/nntp.t +++ b/t/nntp.t @@ -99,7 +99,7 @@ { # test setting NNTP headers in HEAD and ARTICLE requests 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 1a74924c81a60ea9997c430a35074be90fdc7674..0b6afcefdff750ec189947a9697505922dbb404f 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 @@ } }; my $ibx = PublicInbox::Inbox->new({ - mainrepo => $mainrepo, + inboxdir => $inboxdir, name => 'nntpd-tls', version => $version, -primary_address => $addr, @@ -64,7 +64,7 @@ { open my $fh, '>', $pi_config or die "open: $!\n"; print $fh < $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 @@ open my $fh, '>', $pi_config or die "open($pi_config): $!"; 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): $!"; diff --git a/t/nntpd.t b/t/nntpd.t index 153204dfdc14d39e3393e451b43dbfc15661b7bb..462e2da97b9922c6c165c5e59977c543fd84e472 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -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 @@ }; $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 0defafc4ad7d90a07791113af89584eb38949b15..492ed4877a90d517b3ca2ae354121eee0f669eff 100644 --- a/t/perf-msgview.t +++ b/t/perf-msgview.t @@ -20,7 +20,7 @@ "git <2.19, cat-file lacks --unordered, locality suffers\n"; } 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 f272e18add0c13c046c8836e9bd5b5ab47a0a151..7abf2249ef32386ad7677fff22272b2e417d216e 100644 --- a/t/perf-nntpd.t +++ b/t/perf-nntpd.t @@ -27,7 +27,7 @@ ($host_port, $group) = ($1, $2); $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 @@ open my $fh, '>', $pi_config or die "open($pi_config): $!"; 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 3bed05c425349b3d2af19647c3289ca67148a346..8d28b3a0fb8394d18707e187ba9bc32991f23fd7 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; diff --git a/t/plack.t b/t/plack.t index f9a55e4366b5d98c4cad0d480a1dda4f08bc5668..7e65ad742e8f03ccc9102668fb1b3d09a5a5b37f 100644 --- a/t/plack.t +++ b/t/plack.t @@ -29,7 +29,7 @@ print $fh "test for public-inbox\n"; 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 f5140f44c308371e4971439833fa6919d8f4f49c..96f0cb473ae714b4b39b6fe48591845d75531460 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(\<new($maindir); diff --git a/t/psgi_bad_mids.t b/t/psgi_bad_mids.t index 95196a3f4b91f18859791090845be414d17ba00e..c7c947188e9499622b8562365c86de91a42d7e4a 100644 --- a/t/psgi_bad_mids.t +++ b/t/psgi_bad_mids.t @@ -15,10 +15,10 @@ plan skip_all => "$mod missing for psgi_bad_mids.t" if $@; } 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 = <{-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 7160896bb6c2f5071f6e7572ba5e643e89a73938..aa7c863f5274421e528c4a4e79d28a48a27b41db 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(\<new($maindir); diff --git a/t/psgi_multipart_not.t b/t/psgi_multipart_not.t index 2670c47a76f9afae7a5fc6738d168ac4dc27eb4a..40bc3c18c6c8e423c306521af87defbb95b2ef69 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 @@ my $cfgpfx = "publicinbox.v2test"; my $cfg = <{-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 2e00b6d843160e43391f2d54b8dc5227f181b42f..707807a7f0ac21caf5795facabeaaa009dec1be2 100644 --- a/t/psgi_scan_all.t +++ b/t/psgi_scan_all.t @@ -19,12 +19,12 @@ 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 ab6892bcfc205aa9ffcdbdc5b595350d456ecf0a..4cd0e499c1841035e72877feb22c9a0c75a513d1 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 @@ my $cfgpfx = "publicinbox.test"; my $config = PublicInbox::Config->new(\<new($config); test_psgi(sub { $www->call(@_) }, sub { diff --git a/t/psgi_text.t b/t/psgi_text.t index 944a647637ba011140808c19c1de5650833dd1d6..da7c6f57ba6a49d8db34917a43e9dc480b032e48 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(\<new($config); diff --git a/t/psgi_v2.t b/t/psgi_v2.t index e4f7306e1606b3f93abcb33471f5b817d65c72b7..cb5ece638b1d79f334ab96f90ff30ba7585f62d9 100644 --- a/t/psgi_v2.t +++ b/t/psgi_v2.t @@ -18,9 +18,9 @@ plan skip_all => "$mod missing for psgi_v2_dupes.t" if $@; } 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 @@ my $cfgpfx = "publicinbox.v2test"; my $cfg = <{-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/purge.t b/t/purge.t index 384f32a652bfce92eb917093cfbc5ba37002c9bc..67c4e58d47e9f5ee444e74ddddcbcaf95611f97c 100644 --- a/t/purge.t +++ b/t/purge.t @@ -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 @@ # 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 < 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 @@ is_deeply([grep(/\bOct 1993\b/, @all)], [], 'nothing from Oct 1993'); 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 4b26f2ee34580c9d3e074afe83f5513fcc0466e9..26339989cf8de4592f2bfa31476689aed8897546 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'; diff --git a/t/search.t b/t/search.t index a728d79f77aa725355f9eaa8da4f1d9fc269adaa..b6531ab37bf5c4009f310aaa628a4991230c9e7e 100644 --- a/t/search.t +++ b/t/search.t @@ -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 0b7d7c49485088d123d9c0040a5db61531955268..baab40a49a3d72bd85b029786dedb140fbfeb6d3 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 @@ $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 4777a307848e06452cdd8bb48f505145e10d6e23..3facd87e10bb7919e73231ef0033d4a5594478c4 100644 --- a/t/v1-add-remove-add.t +++ b/t/v1-add-remove-add.t @@ -12,10 +12,10 @@ eval "require $mod"; 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 d14a117d3663099688e594226ae66a051fcd2d26..e35477535800626e47bda9bd64546c32d3514098 100644 --- a/t/v1reindex.t +++ b/t/v1reindex.t @@ -16,10 +16,10 @@ plan skip_all => "$mod missing for v1reindex.t" if $@; } 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 ($min, $max) = $ibx->mm->minmax; 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 @@ my ($min, $max) = $ibx->mm->minmax; 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 @@ my ($min, $max) = $ibx->mm->minmax; 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 @@ my ($min, $max) = @$minmax; 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 @@ my ($min, $max) = $ibx->mm->minmax; 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 @@ is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } # 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 @@ } # 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 c758dbb6728e8dd7a27a9a8f2812c45fdce2700f..438fe3db7367d934da926935f6d35f06a22cf5d9 100644 --- a/t/v2-add-remove-add.t +++ b/t/v2-add-remove-add.t @@ -13,9 +13,9 @@ eval "require $mod"; 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', diff --git a/t/v2mda.t b/t/v2mda.t index 92b3333e3cb271e513241fdd4aa7062edc1a70a2..ebcbd1f4dde040047601a790ca1f2bf0caae80e6 100644 --- a/t/v2mda.t +++ b/t/v2mda.t @@ -18,7 +18,7 @@ } 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 86ca895d34aaa130cf05ebfc0973854d82e3e4b7..a097a7f3a2cd0da80f109ec098210c034d0eef43 100644 --- a/t/v2mirror.t +++ b/t/v2mirror.t @@ -28,7 +28,7 @@ { 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 @@ 'alt@example.com'); 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 1dcefbe36b0f5bb2f40e42209bb593f15ed13355..7c5a6b07bb4f055f3bc9501577a7daf54410b61b 100644 --- a/t/v2reindex.t +++ b/t/v2reindex.t @@ -15,9 +15,9 @@ eval "require $mod"; 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 ($min, $max) = $ibx->mm->minmax; 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 @@ my ($min, $max) = $ibx->mm->minmax; 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 @@ is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged'); } 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 @@ my ($min, $max) = $ibx->mm->minmax; 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 @@ my ($min, $max) = $ibx->mm->minmax; 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 @@ } # 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 @@ } # 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 c1c9196fb4df00b088d8a4032f69dc7f58f58f9b..c2daac2f8484b4feb72ea752948af6cf9ac2cd2f 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -14,9 +14,9 @@ plan skip_all => "$mod missing for nntpd.t" if $@; } 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 $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 @@ 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 @@ } { 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 <new($spamdir); @@ -72,7 +72,7 @@ PublicInbox::Emergency->new($maildir)->prepare(\"$spam"); my $orig = <new($spamdir); # create dirs my $config = PublicInbox::Config->new(\< "$mod missing for watch_maildir_v2.t" if $@; } 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 = <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 @@ my $v1addr = 'v1-public@example.com'; is(system(qw(git init -q --bare), $v1repo), 0, 'v1 init OK'); my $cfg2 = <new(\$cfg2); diff --git a/t/www_listing.t b/t/www_listing.t index 990233c8ba203a5ce53b4c866c24901c402a7697..9f71257d1361facc58f8f21cf598783767abfc71 100644 --- a/t/www_listing.t +++ b/t/www_listing.t @@ -91,15 +91,15 @@ ok(unlink("$bare->{git_dir}/description"), 'removed bare/description'); 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 d921e12f562ccc163995b58e04146c0582d2a683..43e08639d8ba72e0f3894f5d6f49eefabd1544a4 100644 --- a/t/xcpdb-reshard.t +++ b/t/xcpdb-reshard.t @@ -27,7 +27,7 @@ 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 @@ $mime->header_set('Message-ID', ""); 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 @@ # 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');