"mainrepo" ws a bad name and artifact from the early days when I
intended for there to be a "spamrepo" (now just the
ENV{PI_EMERGENCY} Maildir). With v2, "mainrepo" can be
especially confusing, since v2 needs at least two git
repositories (epoch + all.git) to function and we shouldn't
confuse users by having them point to a git repository for v2.
Much of our documentation already references "INBOX_DIR" for
command-line arguments, so use "inboxdir" as the
git-config(1)-friendly variant for that.
"mainrepo" remains supported indefinitely for compatibility.
Users may need to revert to old versions, or may be referring
to old documentation and must not be forced to change config
files to account for this change.
So if you're using "mainrepo" today, I do NOT recommend changing
it right away because other bugs can lurk.
Link: https://public-inbox.org/meta/874l0ice8v.fsf@alyssa.is/
72 files changed:
=head2 EXAMPLE
[publicinbox "test"]
=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
; 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
+
-=item publicinbox.<name>.mainrepo
+=item publicinbox.<name>.inboxdir
The absolute path to the directory which hosts the
public-inbox. This must be specified once.
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
=item publicinbox.<name>.url
Default: none, required
=item publicinbox.<name>.url
; big inboxes which require lots of memory to clone:
[publicinbox "big1"]
; 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"]
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"]
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"]
address = tiny1@example.com
[publicinbox "tiny2"]
- mainrepo = /path/to/tiny2
+ inboxdir = /path/to/tiny2
address = tiny2@example.com
[publicinboxlimiter "big"]
address = tiny2@example.com
[publicinboxlimiter "big"]
public-inbox-convert copies the contents of an old "v1" inbox
into a new "v2" inbox. It makes no changes to the old inbox
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<public-inbox-config(5)> to point to the path of NEW_DIR
once they are satisfied with the conversion.
L<public-inbox-config(5)> to point to the path of NEW_DIR
once they are satisfied with the conversion.
Creates an empty public-inbox or reinitializes an existing one.
It updates C<~/.public-inbox/config> by creating a
C<[publicinbox "NAME"]> section where
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<publicinbox.NAME.mainrepo> is C<INBOX_DIR>,
+C<publicinbox.NAME.inboxdir> is C<INBOX_DIR>,
C<publicinbox.NAME.url> is C<HTTP_URL>, and
C<publicinbox.NAME.address> is C<ADDRESS>. Multiple addresses
may be specified for inboxes with multiple addresses.
C<publicinbox.NAME.url> is C<HTTP_URL>, and
C<publicinbox.NAME.address> is C<ADDRESS>. Multiple addresses
may be specified for inboxes with multiple addresses.
; generic public-inbox-config keys:
address = test@example.com
url = http://example.com/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:
; config keys specific to public-inbox-watch:
; optional, emails marked as read which appear
; here will be trained as spam and deleted from
; 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
; configured for watch.
; This is global for all publicinbox.* sections
watchspam = maildir:/path/to/maildirs/.INBOX.spam
address = try@public-inbox.org
address = sandbox@public-inbox.org
address = test@public-inbox.org
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
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
url = http://example.com/meta
$l = $m;
} elsif ($m ne '') {
warn <<"";
$l = $m;
} elsif ($m ne '') {
warn <<"";
-$ibx->{mainrepo} has unexpected indexlevel in Xapian: $m
+$ibx->{inboxdir} has unexpected indexlevel in Xapian: $m
PublicInbox::Inbox->new({
name => $name,
address => [ "$name\@example.com" ],
PublicInbox::Inbox->new({
name => $name,
address => [ "$name\@example.com" ],
# TODO: consumers may want to warn on this:
#-unconfigured => 1,
});
# TODO: consumers may want to warn on this:
#-unconfigured => 1,
});
$cfg->each_inbox(sub {
my ($ibx) = @_;
$ibx->{version} ||= 1;
$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 <<EOF;
if (defined($path)) {
$dir2ibx{$path} = $ibx;
} else {
warn <<EOF;
-W: $ibx->{name} $ibx->{mainrepo}: $!
+W: $ibx->{name} $ibx->{inboxdir}: $!
# it's possible for a Xapian directory to exist,
# but Search::Xapian to go missing/broken.
# Make sure it's purged in that case:
# 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);
# $ibx->{search} is populated by $ibx->over call
my $xdir_ro = $ibx->{search}->xdir(1);
# $rewrites = [ array commits keyed by epoch ]
sub show_rewrites ($$$) {
my ($fh, $ibx, $rewrites) = @_;
# $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 {;
if (scalar @$rewrites) {
my $epoch = -1;
my @out = map {;
my $f = $params{file} or die "file: required for $type spec $spec\n";
unless (index($f, '/') == 0) {
if (($ibx->{version} || 1) == 1) {
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";
- $f = "$ibx->{mainrepo}/$f";
+ $f = "$ibx->{inboxdir}/$f";
# may auto-vivify if config file is non-existent:
foreach my $section (@{$self->{-section_order}}) {
next if $section !~ m!\Apublicinbox\.([^/]+)\z!;
# 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);
}
my $ibx = lookup_name($self, $1) or next;
$cb->($ibx);
}
my ($self, $pfx) = @_;
my $ibx = {};
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;
}
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;
foreach my $k (qw(obfuscate)) {
my $v = $self->{"$pfx.$k"};
defined $v or next;
- return unless $ibx->{mainrepo};
+ return unless $ibx->{inboxdir};
my $name = $pfx;
$name =~ s/\Apublicinbox\.//;
my $name = $pfx;
$name =~ s/\Apublicinbox\.//;
_set_limiter($opts, $pi_config, 'httpbackend');
_set_uint($opts, 'feedmax', 25);
$opts->{nntpserver} ||= $pi_config->{'publicinbox.nntpserver'};
_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;
}
if (defined $dir && -f "$dir/inbox.lock") {
$opts->{version} = 2;
}
my ($self, $epoch) = @_;
($self->{version} || 1) == 2 or return;
$self->{"$epoch.git"} ||= eval {
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
my $g = PublicInbox::Git->new($git_dir);
$g->{-httpbackend_limiter} = $self->{-httpbackend_limiter};
# no cleanup needed, we never cat-file off this, only clone
sub git {
my ($self) = @_;
$self->{git} ||= eval {
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};
$git_dir .= '/all.git' if (($self->{version} || 1) == 2);
my $g = PublicInbox::Git->new($git_dir);
$g->{-httpbackend_limiter} = $self->{-httpbackend_limiter};
my $changed = git($self)->alternates_changed;
if (!defined($cur) || $changed) {
$self->git->cleanup if $changed;
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))) {
if (opendir my $dh, $gits) {
my $max = -1;
while (defined(my $git_dir = readdir($dh))) {
$self->{mm} ||= eval {
require PublicInbox::Msgmap;
_cleanup_later($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 {
if (($self->{version} || 1) >= 2) {
PublicInbox::Msgmap->new_file("$dir/msgmap.sqlite3");
} else {
my ($self) = @_;
my $desc = $self->{description};
return $desc if defined $desc;
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;
local $/ = "\n";
chomp $desc;
$desc =~ s/\s+/ /smg;
my ($self) = @_;
my $url = $self->{cloneurl};
return $url if $url;
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;
my @url = split(/\s+/s, $url);
local $/ = "\n";
chomp @url;
# TODO: honor skip_artnum
my $v = $self->{version} || 1;
if ($v == 1) {
# 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);
PublicInbox::Import::init_bare($dir);
} else {
my $v2w = importer($self);
sub xdir ($;$) {
my ($self, $rdonly) = @_;
if ($self->{version} == 1) {
sub xdir ($;$) {
my ($self, $rdonly) = @_;
if ($self->{version} == 1) {
- "$self->{mainrepo}/public-inbox/xapian" . SCHEMA_VERSION;
+ "$self->{inboxdir}/public-inbox/xapian" . SCHEMA_VERSION;
- my $dir = "$self->{mainrepo}/xap" . SCHEMA_VERSION;
+ my $dir = "$self->{inboxdir}/xap" . SCHEMA_VERSION;
return $dir if $rdonly;
my $shard = $self->{shard};
return $dir if $rdonly;
my $shard = $self->{shard};
my ($class, $ibx) = @_;
ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx";
my $self = bless {
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;
altid => $ibx->{altid},
version => $ibx->{version} // 1,
}, $class;
my ($class, $ibx, $creat, $shard) = @_;
ref $ibx or die "BUG: expected PublicInbox::Inbox object: $ibx";
my $levels = qr/\A(?:full|medium|basic)\z/;
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};
my $version = $ibx->{version} || 1;
my $indexlevel = 'full';
my $altid = $ibx->{altid};
}
$ibx = PublicInbox::InboxWritable->new($ibx);
my $self = bless {
}
$ibx = PublicInbox::InboxWritable->new($ibx);
my $self = bless {
-inbox => $ibx,
git => $ibx->git,
-altid => $altid,
-inbox => $ibx,
git => $ibx->git,
-altid => $altid,
}, $class;
$ibx->umask_prepare;
if ($version == 1) {
}, $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) {
my $dir = $self->xdir;
$self->{over} = PublicInbox::OverIdx->new("$dir/over.sqlite3");
} elsif ($version == 2) {
die "BUG: _msgmap_init is only for v1\n" if $self->{version} != 1;
$self->{mm} ||= eval {
require PublicInbox::Msgmap;
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);
# $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) = @_;
# $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;
unless (-d $dir) {
if ($creat) {
require File::Path;
# Now that all subprocesses are up, we can open the FDs
# for SQLite:
my $mm = $self->{mm} = PublicInbox::Msgmap->new_file(
# 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;
});
}
$mm->{dbh}->begin_work;
});
}
sub _replace_oids ($$$) {
my ($self, $mime, $replace_map) = @_;
$self->done;
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};
my $rewrites = []; # epoch => commit
my $max = $self->{epoch_max};
sub fill_alternates ($$) {
my ($self, $epoch) = @_;
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);
unless (-d $all) {
PublicInbox::Import::init_bare($all);
sub git_init {
my ($self, $epoch) = @_;
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",
my @cmd = (qw(git init --bare -q), $git_dir);
PublicInbox::Import::run_die(\@cmd);
@cmd = (qw/git config/, "--file=$git_dir/config",
sub git_dir_latest {
my ($self, $max) = @_;
$$max = -1;
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";
return unless -d $pfx;
my $latest;
opendir my $dh, $pfx or die "opendir $pfx: $!\n";
last_epoch_commit($self, $i, $cmt);
}
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) = @_;
sub last_commits ($$) {
my ($self, $epoch_max) = @_;
$self_url .= 'new.atom';
$page_id = "mailto:$ibx->{-primary_address}";
}
$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(<?xml version="1.0" encoding="us-ascii"?>\n) .
qq(<feed\nxmlns="http://www.w3.org/2005/Atom"\n) .
qq(<?xml version="1.0" encoding="us-ascii"?>\n) .
qq(<feed\nxmlns="http://www.w3.org/2005/Atom"\n) .
sub manifest_add ($$;$$) {
my ($manifest, $ibx, $epoch, $default_desc) = @_;
my $url_path = "/$ibx->{name}";
sub manifest_add ($$;$$) {
my ($manifest, $ibx, $epoch, $default_desc) = @_;
my $url_path = "/$ibx->{name}";
- my $git_dir = $ibx->{mainrepo};
+ my $git_dir = $ibx->{inboxdir};
if (defined $epoch) {
$git_dir .= "/git/$epoch.git";
$url_path .= "/git/$epoch.git";
if (defined $epoch) {
$git_dir .= "/git/$epoch.git";
$url_path .= "/git/$epoch.git";
$seen{$http} = 1;
for my $i (0..$max) {
# old parts my be deleted:
$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";
my $url = "$http/$i";
$seen{$url} = 1;
push @urls, "$url $dir/git/$i.git";
; see public-inbox-config(5) manpage for more details:
; https://public-inbox.org/public-inbox-config.html
[publicinbox "$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)) {
mainrepo = /path/to/top-level-inbox
EOS
for my $k (qw(address listid)) {
my ($ibx, $task, $opt) = @_; # task = 'cpdb' or 'compact'
my $cb = \&${\"PublicInbox::Xapcmd::$task"};
PublicInbox::Admin::progress_prepare($opt ||= {});
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
runnable_or_die($XAPIAN_COMPACT) if $opt->{compact};
my $reindex; # v1:{ from => $x40 }, v2:{ from => [ $x40, $x40, .. ] } }
my $from; # per-epoch ranges
if ($v == 1) {
if (defined $reshard) {
warn
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);
}
my $old_parent = dirname($old);
same_fs_or_die($old_parent, $old);
my $old;
if ($config) {
$config->each_inbox(sub {
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 = {
});
}
unless ($old) {
warn "W: $old_dir not configured in " .
PublicInbox::Config::default_file() . "\n";
$old = {
name => 'ignored',
address => [ 'old@example.com' ],
};
name => 'ignored',
address => [ 'old@example.com' ],
};
die "Only conversion from v1 inboxes is supported\n";
}
my $new = { %$old };
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;
$new->{version} = 2;
$new = PublicInbox::InboxWritable->new($new);
my $v2w;
- my $old_cfg = "$old->{mainrepo}/config";
+ my $old_cfg = "$old->{inboxdir}/config";
local $ENV{GIT_CONFIG} = $old_cfg;
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;
$v2w = PublicInbox::V2Writable->new($new, 1);
$v2w->init_inbox($jobs);
unlink $new_cfg;
$src->mm_alt->{dbh}->sqlite_backup_to_file($dst);
}
}
$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
if (-e $clone) {
warn <<"";
$clone may not be valid after migrating to v2, not copying
sub show_cmd ($$) {
my ($ibx, $smsg) = @_;
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";
GetOptions(%opts) or usage();
PublicInbox::Admin::indexlevel_ok_or_die($indexlevel) if defined $indexlevel;
my $name = shift @ARGV or usage();
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();
my $http_url = shift @ARGV or usage();
my (@address) = @ARGV;
@address or usage();
my $pfx = "publicinbox.$name";
my @x = (qw/git config/, "--file=$pi_config_tmp");
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) {
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) {
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"
}
my $ibx = PublicInbox::Inbox->new({
}
my $ibx = PublicInbox::Inbox->new({
name => $name,
version => $version,
-primary_address => $address[0],
name => $name,
version => $version,
-primary_address => $address[0],
x(@x, "--add", "$pfx.address", $addr);
}
x(@x, "$pfx.url", $http_url);
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);
if (defined($indexlevel)) {
x(@x, "$pfx.indexlevel", $indexlevel);
}
defined $dst or do_exit(67); # EX_NOUSER 5.1.1 user unknown
}
}
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;
$dst = PublicInbox::InboxWritable->new($dst);
# pre-check, MDA has stricter rules than an importer might;
if (index($repo, '@') > 0) {
$ibx = PublicInbox::Config->new->lookup($repo);
} elsif (-d $repo) {
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);
$ibx = PublicInbox::Inbox->new($ibx);
} else {
$ibx = PublicInbox::Config->new->lookup_name($repo);
}
my $name = shift or die $usage; # git
my $email = shift or die $usage; # git@vger.kernel.org
}
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
name => $name,
version => $version,
address => [ $email ],
name => $name,
version => $version,
address => [ $email ],
require PublicInbox::V2Writable;
PublicInbox::V2Writable->new($ibx, 1)->init_inbox(0);
} else {
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);
}
}
$ibx = PublicInbox::InboxWritable->new($ibx);
use_ok 'PublicInbox::V2Writable';
use_ok 'PublicInbox::Inbox';
my $ibx = PublicInbox::Inbox->new({
use_ok 'PublicInbox::V2Writable';
use_ok 'PublicInbox::Inbox';
my $ibx = PublicInbox::Inbox->new({
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
- $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;
$ibx->{altid} = $altid;
my $rw = PublicInbox::SearchIdx->new($ibx, 1);
$rw->index_sync;
use_ok 'PublicInbox::V2Writable';
use_ok 'PublicInbox::Inbox';
my $tmpdir = tempdir('pi-altidv2-XXXXXX', TMPDIR => 1, CLEANUP => 1);
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' ];
{
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');
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');
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
close $fh or die "close: $!\n";
my %cfg = (
"$cfgpfx.address" => $addr,
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) {
"$cfgpfx.indexlevel" => 'basic',
);
while (my ($k,$v) = each %cfg) {
my $cfg = PublicInbox::Config->new($f);
is_deeply($cfg->lookup('meta@public-inbox.org'), {
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',
'address' => [ 'meta@public-inbox.org' ],
'domain' => 'public-inbox.org',
'url' => 'http://example.com/meta',
'sandbox@public-inbox.org',
'test@public-inbox.org'],
-primary_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,
'domain' => 'public-inbox.org',
'name' => 'test',
feedmax => 25,
EOF
my $ibx = $config->lookup_name('test');
is_deeply($ibx->{altid}, [ @altid ]);
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
}
{
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);
publicinbox.nntpserver=news.example.com
EOF
my $cfg = PublicInbox::Config->new(\$str);
$str = <<EOF;
$pfx.address=test\@example.com
$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);
$pfx.nntpserver=news.alt.example.com
EOF
$cfg = PublicInbox::Config->new(\$str);
my $pfx2 = "publicinbox.foo";
my $str = <<EOF;
$pfx.address=test\@example.com
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.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
publicinbox.noobfuscate=public-inbox.org \@example.com z\@EXAMPLE.com
$pfx.obfuscate=true
EOF
push @expect, "$i";
print $fh <<"" or die "print: $!";
[publicinbox "$i"]
push @expect, "$i";
print $fh <<"" or die "print: $!";
[publicinbox "$i"]
- mainrepo = /path/to/$i.git
+ inboxdir = /path/to/$i.git
address = $i\@example.com
}
address = $i\@example.com
}
my $pfx2 = "publicinbox.test2";
my $str = <<EOF;
$pfx1.address=test\@example.com
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.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
$pfx1.coderepo=project
$pfx2.coderepo=project
coderepo.project.dir=/path/to/project.git
{
my $config = PublicInbox::Config->new(\<<EOF);
$cfgpfx.address=test\@example.com
{
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');
$cfgpfx.httpbackendmax=12
EOF
my $ibx = $config->lookup_name('test');
my $config = PublicInbox::Config->new(\<<EOF);
publicinboxlimiter.named.max=3
$cfgpfx.address=test\@example.com
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');
$cfgpfx.httpbackendmax=named
EOF
my $ibx = $config->lookup_name('test');
use PublicInbox::Import;
my $tmpdir = tempdir('convert-compact-XXXXXX', TMPDIR => 1, CLEANUP => 1);
my $ibx = {
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',
};
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');
'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);
qw(config core.sharedRepository 0644)]), 'set sharedRepository');
$ibx = PublicInbox::Inbox->new($ibx);
my $im = PublicInbox::Import->new($ibx->git, undef, undef, $ibx);
is($@, '', 'no errors syncing');
}
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');
'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');
'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,
foreach (@xdir) {
my @st = stat($_);
is($st[2] & 07777, -f _ ? 0644 : 0755,
open my $out, '>>', "$tmpdir/out.log" or die "open: out.log $!\n";
my $rdr = { 1 => fileno($out), 2 => fileno($err) };
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');
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');
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) {
ok(PublicInbox::Import::run_die($cmd, undef, $rdr), 'convert works');
@xdir = glob("$tmpdir/v2/xap*/*");
foreach (@xdir) {
$cmd = [ 'public-inbox-compact', "$tmpdir/v2" ];
my $env = { NPROC => 2 };
ok(PublicInbox::Import::run_die($cmd, $env, $rdr), 'v2 compact works');
$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*/*");
$ibx->{version} = 2;
@xdir = glob("$tmpdir/v2/xap*/*");
my $cmd_pfx = 'blib/script/public-inbox';
my $tmpdir = tempdir('pi-edit-XXXXXX', TMPDIR => 1, CLEANUP => 1);
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({
my $ibx = PublicInbox::Inbox->new({
name => 'test-v2edit',
version => 2,
-primary_address => 'test@example.com',
name => 'test-v2edit',
version => 2,
-primary_address => 'test@example.com',
ok($im->add($mime), 'add message to be edited');
$im->done;
my ($in, $out, $err, $cmd, $cur, $t);
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/'";
$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");
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");
$t = '-m MESSAGE_ID'; {
$in = $out = $err = '';
local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'";
$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");
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");
$in = $out = $err = '';
my $before = `git $__git_dir rev-parse HEAD`;
local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'";
$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));
ok(run($cmd, \$in, \$out, \$err), "$t succeeds");
my $prev = $cur;
$cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
my $before = `git $__git_dir rev-parse HEAD`;
local $ENV{MAIL_EDITOR} =
"$^X -i -p -e 's/^Subject:.*/Status: RO\\n\$&/'";
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));
ok(run($cmd, \$in, \$out, \$err), "$t succeeds");
my $prev = $cur;
$cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
my $before = `git $__git_dir rev-parse HEAD`;
local $ENV{MAIL_EDITOR} =
"$^X -i -p -e 's/^Subject:.*/Received: x\\n\$&/'";
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/,
ok(run($cmd, \$in, \$out, \$err), "$t succeeds");
$cur = PublicInbox::MIME->new($ibx->msg_by_mid($mid));
like($cur->header('Subject'), qr/boolean prefix/,
$t = '-m miss'; {
$in = $out = $err = '';
local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/boolean/FAIL/'";
$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");
}
ok(!run($cmd, \$in, \$out, \$err), "$t fails on invalid MID");
like($err, qr/No message found/, "$t shows error");
}
$t = 'non-interactive editor failure'; {
$in = $out = $err = '';
local $ENV{MAIL_EDITOR} = "$^X -i -p -e 'END { exit 1 }'";
$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");
}
ok(!run($cmd, \$in, \$out, \$err), "$t detected");
like($err, qr/END \{ exit 1 \}' failed:/, "$t shows error");
}
is($rc, 0, 'set publicinbox.mailEditor');
local $ENV{MAIL_EDITOR};
local $ENV{GIT_EDITOR} = 'echo should not run';
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");
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");
$t = '--raw and mbox escaping'; {
$in = $out = $err = '';
local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^\$/\\nFrom not mbox\\n/'";
$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/'";
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'";
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");
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");
$t = 'edit ambiguous Message-ID with -m'; {
$in = $out = $err = '';
local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/bool pfx/boolean prefix/'";
$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");
ok(!run($cmd, \$in, \$out, \$err), "$t fails w/o --force");
like($err, qr/Multiple messages with different content found matching/,
"$t shows matches");
$t .= ' and --force'; {
$in = $out = $err = '';
local $ENV{MAIL_EDITOR} = "$^X -i -p -e 's/^Subject:.*/Subject:x/i'";
$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`;
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`;
my $ibx = PublicInbox::Inbox->new({
address => 'test@example',
name => 'testbox',
my $ibx = PublicInbox::Inbox->new({
address => 'test@example',
name => 'testbox',
url => 'http://example.com/test',
feedmax => 3,
});
url => 'http://example.com/test',
feedmax => 3,
});
TMPDIR => 1, CLEANUP => 1);
is(mkdir("$git_dir/public-inbox"), 1, "created public-inbox dir");
my $altid = [ "serial:ruby-core:file=msgmap.sqlite3" ];
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';
altid => $altid });
$f = PublicInbox::Filter::RubyLang->new(-inbox => $ibx);
$msg = <<'EOF';
my $ibx = PublicInbox::Inbox->new({
address => 'test@example',
name => 'tester',
my $ibx = PublicInbox::Inbox->new({
address => 'test@example',
name => 'tester',
url => 'http://example.com/test',
});
my $git = $ibx->git;
url => 'http://example.com/test',
});
my $git = $ibx->git;
my $this = "pi-$v-$level-indexlevels";
my $tmpdir = tempdir("$this-tmp-XXXXXX", TMPDIR => 1, CLEANUP => 1);
my $ibx = PublicInbox::Inbox->new({
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',
name => $this,
version => $v,
-primary_address => 'test@example.com',
$im->done;
# index master (required for v1)
$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({
my $ro_master = PublicInbox::Inbox->new({
- mainrepo => $ibx->{mainrepo},
+ inboxdir => $ibx->{inboxdir},
indexlevel => $level
});
my ($nr, $msgs) = $ro_master->recent;
indexlevel => $level
});
my ($nr, $msgs) = $ro_master->recent;
my @cmd = (qw(git clone --mirror -q));
my $mirror = "$tmpdir/mirror-$v";
if ($v == 1) {
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;
- 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");
}
my $fetch_dir = $cmd[-1];
is(system(@cmd), 0, "v$v clone OK");
# read-only access
my $ro_mirror = PublicInbox::Inbox->new({
# read-only access
my $ro_mirror = PublicInbox::Inbox->new({
indexlevel => $level,
});
($nr, $msgs) = $ro_mirror->recent;
indexlevel => $level,
});
($nr, $msgs) = $ro_mirror->recent;
['m@1','m@2'], 'got both messages in mirror');
# incremental index master (required for v1)
['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],
($nr, $msgs) = $ro_master->recent;
is($nr, 2, '2nd message seen in master');
is_deeply([sort { $a cmp $b } map { $_->{mid} } @$msgs],
'message unavailable in mirror');
if ($v == 2 && $level eq 'basic') {
'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') {
'no Xapian shard directories for v2 basic');
}
if ($level ne 'basic') {
my %cfg = (
"$cfgpfx.address" => $addr,
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),
);
while (my ($k,$v) = each %cfg) {
is(0, system(qw(git config --file), $pi_config, $k, $v),
my @warn;
$SIG{__WARN__} = sub { push @warn, @_ };
my $cfgpfx = "publicinbox.$v";
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 $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');
"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);
is(system(@cfg, "$cfgpfx.filter", 'PublicInbox::Filter::RubyLang'), 0);
is(system(@cfg, "$cfgpfx.altid",
'serial:alerts:file=msgmap.sqlite3'), 0);
require Email::MIME;
my $u = 'https://example.com/a/';
my $ng = PublicInbox::Inbox->new({ name => 'test',
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',
address => 'a@example.com',
-primary_address => 'a@example.com',
newsgroup => 'test',
my $tmpdir = tempdir('pi-nntpd-tls-XXXXXX', TMPDIR => 1, CLEANUP => 1);
my $err = "$tmpdir/stderr.log";
my $out = "$tmpdir/stdout.log";
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';
my $pi_config = "$tmpdir/pi_config";
my $group = 'test-nntpd-tls';
my $addr = $group . '@example.com';
};
my $ibx = PublicInbox::Inbox->new({
};
my $ibx = PublicInbox::Inbox->new({
name => 'nntpd-tls',
version => $version,
-primary_address => $addr,
name => 'nntpd-tls',
version => $version,
-primary_address => $addr,
open my $fh, '>', $pi_config or die "open: $!\n";
print $fh <<EOF
[publicinbox "nntpd-tls"]
open my $fh, '>', $pi_config or die "open: $!\n";
print $fh <<EOF
[publicinbox "nntpd-tls"]
address = $addr
indexlevel = basic
newsgroup = $group
address = $addr
indexlevel = basic
newsgroup = $group
sub make_local_server {
require PublicInbox::Inbox;
$group = 'inbox.test.perf.nntpd';
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";
$ibx = PublicInbox::Inbox->new($ibx);
my $nntpd = 'blib/script/public-inbox-nntpd';
my $pi_config = "$tmpdir/config";
print $fh <<"" or die "print $pi_config: $!";
[publicinbox "test"]
newsgroup = $group
print $fh <<"" or die "print $pi_config: $!";
[publicinbox "test"]
newsgroup = $group
address = test\@example.com
close $fh or die "close($pi_config): $!";
address = test\@example.com
close $fh or die "close($pi_config): $!";
my $home = "$tmpdir/pi-home";
my $err = "$tmpdir/stderr.log";
my $out = "$tmpdir/stdout.log";
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';
my $group = 'test-nntpd';
my $addr = $group . '@example.com';
my $nntpd = 'blib/script/public-inbox-nntpd';
END { kill 'TERM', $pid if defined $pid };
my $ibx = {
END { kill 'TERM', $pid if defined $pid };
my $ibx = {
name => $group,
version => $version,
-primary_address => $addr,
name => $group,
version => $version,
-primary_address => $addr,
$ibx = PublicInbox::Inbox->new($ibx);
{
local $ENV{HOME} = $home;
$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",
push @cmd, "-V$version", '-Lbasic';
is(system(@cmd), 0, 'init OK');
is(system(qw(git config), "--file=$home/.public-inbox/config",
-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 = '';
my $git = $ibx->git;
my $fh = $git->popen(@cat);
my $vec = '';
$host_port .= ":119" unless index($host_port, ':') > 0;
} else {
$group = 'inbox.test.perf.nntpd';
$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);
$ibx = PublicInbox::Inbox->new($ibx);
my $nntpd = 'blib/script/public-inbox-nntpd';
my $tmpdir = tempdir('perf-nntpd-XXXXXX', TMPDIR => 1, CLEANUP => 1);
print $fh <<"" or die "print $pi_config: $!";
[publicinbox "test"]
newsgroup = $group
print $fh <<"" or die "print $pi_config: $!";
[publicinbox "test"]
newsgroup = $group
address = test\@example.com
close $fh or die "close($pi_config): $!";
address = test\@example.com
close $fh or die "close($pi_config): $!";
use PublicInbox::Inbox;
my $pi_dir = $ENV{GIANT_PI_DIR};
plan skip_all => "GIANT_PI_DIR not defined for $0" unless $pi_dir;
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;
eval { require PublicInbox::Search };
my $srch = $ibx->search;
plan skip_all => "$pi_dir not configured for search $0 $@" unless $srch;
close $fh or die "close: $!\n";
my %cfg = (
"$cfgpfx.address" => $addr,
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',
);
"$cfgpfx.url" => 'http://example.com/test/',
"$cfgpfx.newsgroup" => 'inbox.test',
);
use Plack::Builder;
my $config = PublicInbox::Config->new(\<<EOF);
$cfgpfx.address=$addr
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);
EOF
is(0, system(qw(git init -q --bare), $maindir), "git init (main)");
my $git = PublicInbox::Git->new($maindir);
}
use_ok($_) for @mods;
use_ok 'PublicInbox::V2Writable';
}
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 = {
my $cfgpfx = "publicinbox.bad-mids";
my $ibx = {
name => 'bad-mids',
version => 2,
-primary_address => 'test@example.com',
name => 'bad-mids',
version => 2,
-primary_address => 'test@example.com',
my $cfg = <<EOF;
$cfgpfx.address=$ibx->{-primary_address}
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);
EOF
my $config = PublicInbox::Config->new(\$cfg);
my $www = PublicInbox::WWW->new($config);
use Plack::App::URLMap;
my $config = PublicInbox::Config->new(\<<EOF);
$cfgpfx.address=$addr
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);
EOF
is(0, system(qw(git init -q --bare), $maindir), "git init (main)");
my $git = PublicInbox::Git->new($maindir);
use_ok 'PublicInbox::V2Writable';
my $repo = tempdir('pi-psgi-multipart-not.XXXXXX', TMPDIR => 1, CLEANUP => 1);
my $ibx = PublicInbox::Inbox->new({
use_ok 'PublicInbox::V2Writable';
my $repo = tempdir('pi-psgi-multipart-not.XXXXXX', TMPDIR => 1, CLEANUP => 1);
my $ibx = PublicInbox::Inbox->new({
name => 'multipart-not',
version => 2,
-primary_address => 'test@example.com',
name => 'multipart-not',
version => 2,
-primary_address => 'test@example.com',
my $cfgpfx = "publicinbox.v2test";
my $cfg = <<EOF;
$cfgpfx.address=$ibx->{-primary_address}
my $cfgpfx = "publicinbox.v2test";
my $cfg = <<EOF;
$cfgpfx.address=$ibx->{-primary_address}
EOF
my $config = PublicInbox::Config->new(\$cfg);
my $www = PublicInbox::WWW->new($config);
EOF
my $config = PublicInbox::Config->new(\$cfg);
my $www = PublicInbox::WWW->new($config);
foreach my $i (1..2) {
my $cfgpfx = "publicinbox.test-$i";
my $addr = "test-$i\@example.com";
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.address=$addr\n";
- $cfg .= "$cfgpfx.mainrepo=$mainrepo\n";
+ $cfg .= "$cfgpfx.inboxdir=$inboxdir\n";
$cfg .= "$cfgpfx.url=http://example.com/$i\n";
my $opt = {
$cfg .= "$cfgpfx.url=http://example.com/$i\n";
my $opt = {
name => "test-$i",
version => 2,
indexlevel => 'basic',
name => "test-$i",
version => 2,
indexlevel => 'basic',
my $tmpdir = tempdir('pi-psgi-search.XXXXXX', TMPDIR => 1, CLEANUP => 1);
my $ibx = PublicInbox::Inbox->new({
my $tmpdir = tempdir('pi-psgi-search.XXXXXX', TMPDIR => 1, CLEANUP => 1);
my $ibx = PublicInbox::Inbox->new({
address => 'git@vger.kernel.org',
name => 'test',
});
address => 'git@vger.kernel.org',
name => 'test',
});
my $cfgpfx = "publicinbox.test";
my $config = PublicInbox::Config->new(\<<EOF);
$cfgpfx.address=git\@vger.kernel.org
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 {
EOF
my $www = PublicInbox::WWW->new($config);
test_psgi(sub { $www->call(@_) }, sub {
use Plack::Builder;
my $config = PublicInbox::Config->new(\<<EOF);
$cfgpfx.address=$addr
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);
EOF
is(0, system(qw(git init -q --bare), $maindir), "git init (main)");
my $www = PublicInbox::WWW->new($config);
}
use_ok($_) for @mods;
use_ok 'PublicInbox::V2Writable';
}
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);
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
my $cfgpfx = "publicinbox.v2test";
my $cfg = <<EOF;
$cfgpfx.address=$ibx->{-primary_address}
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);
EOF
my $config = PublicInbox::Config->new(\$cfg);
my $www = PublicInbox::WWW->new($config);
my $purge = abs_path('blib/script/public-inbox-purge');
my $tmpdir = tempdir('pi-purge-XXXXXX', TMPDIR => 1, CLEANUP => 1);
use_ok 'PublicInbox::V2Writable';
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({
my $ibx = PublicInbox::Inbox->new({
name => 'test-v2purge',
version => 2,
-primary_address => 'test@example.com',
name => 'test-v2purge',
version => 2,
-primary_address => 'test@example.com',
# failing cases, first:
my $in = "$raw\nMOAR\n";
my ($out, $err) = ('', '');
# 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 = '';
'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:
'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"]
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"]
address = test\@example.com
indexlevel = basic
filter = PublicInbox::Filter::Vger
address = test\@example.com
indexlevel = basic
filter = PublicInbox::Filter::Vger
my $this = "pi-$v-$level-replace";
my $tmpdir = tempdir("$this-tmp-XXXXXX", TMPDIR => 1, CLEANUP => 1);
my $ibx = PublicInbox::Inbox->new({
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',
name => $this,
version => $v,
-primary_address => 'test@example.com',
my $t19931002 = qr/ 749520000 /;
is_deeply([grep(/$t19931002/, @all)], [], "nothing matches $t19931002");
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");
my ($bn) = ($dir =~ m!([^/]+)\z!);
is(system(qw(git --git-dir), $dir, qw(fsck --strict)), 0,
"git fsck is clean in epoch $bn");
my $git_dir = "$tmpdir/a.git";
is(0, system(qw(git init -q --bare), $git_dir), "git init (main)");
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';
my $rw = PublicInbox::SearchIdx->new($ibx, 1);
ok($rw, "search indexer created");
my $data = <<'EOF';
use Email::MIME;
my $tmpdir = tempdir('pi-search-XXXXXX', TMPDIR => 1, CLEANUP => 1);
my $git_dir = "$tmpdir/a.git";
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)")
my ($root_id, $last_id);
is(0, system(qw(git init --shared -q --bare), $git_dir), "git init (main)")
use_ok "PublicInbox::$_" for (qw(Inbox V2Writable MIME Git SolverGit));
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);
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
$ibx->{-repo_objs} = [ $git ];
my $res;
my $solver = PublicInbox::SolverGit->new($ibx, sub { $res = $_[0] });
$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!');
my $psgi_env = { 'psgi.errors' => *STDERR };
$solver->solve($psgi_env, $log, '69df7d5', {});
ok($res, 'solved a blob!');
plan skip_all => "$mod missing for v1-add-remove-add.t" if $@;
}
require PublicInbox::SearchIdx;
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);
name => 'test-add-remove-add',
-primary_address => 'test@example.com',
};
name => 'test-add-remove-add',
-primary_address => 'test@example.com',
};
}
use_ok 'PublicInbox::SearchIdx';
use_ok 'PublicInbox::Import';
}
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);
name => 'test-v1reindex',
-primary_address => 'test@example.com',
indexlevel => 'full',
name => 'test-v1reindex',
-primary_address => 'test@example.com',
indexlevel => 'full',
is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
}
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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed');
{
is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
}
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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
}
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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
}
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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
}
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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
}
# An incremental indexing test
}
# 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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
# Another incremental indexing test
# 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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
plan skip_all => "$mod missing for v2-add-remove-add.t" if $@;
}
use_ok 'PublicInbox::V2Writable';
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);
- mainrepo => "$mainrepo/v2",
+ inboxdir => "$inboxdir/v2",
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
use_ok 'PublicInbox::V2Writable';
my $tmpdir = tempdir('pi-v2mda-XXXXXX', TMPDIR => 1, CLEANUP => 1);
my $ibx = {
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' ],
};
name => 'test-v2writable',
address => [ 'test@example.com' ],
};
local $ENV{PI_EMERGENCY} = $faildir;
ok(mkdir $faildir);
my @cmd = (qw(public-inbox-init), "-V$V", $ibx->{name},
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');
$ibx->{address}->[0]);
ok(PublicInbox::Import::run_die(\@cmd), 'initialized v2 inbox');
open my $fh, '>', $pi_config or die "open($pi_config): $!";
print $fh <<"" or die "print $pi_config: $!";
[publicinbox "v2"]
open my $fh, '>', $pi_config or die "open($pi_config): $!";
print $fh <<"" or die "print $pi_config: $!";
[publicinbox "v2"]
address = test\@example.com
close $fh or die "close($pi_config): $!";
address = test\@example.com
close $fh or die "close($pi_config): $!";
is(system(@cmd), 0, 'initialized public-inbox -V2');
is(system("$script-index", "$tmpdir/m"), 0, 'indexed');
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');
$mibx = PublicInbox::Inbox->new($mibx);
is_deeply([$mibx->mm->minmax], [$ibx->mm->minmax], 'index synched minmax');
plan skip_all => "$mod missing for v2reindex.t" if $@;
}
use_ok 'PublicInbox::V2Writable';
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);
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
}
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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed');
{
is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
}
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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
-ok(unlink "$mainrepo/msgmap.sqlite3", 'remove msgmap');
+ok(unlink "$inboxdir/msgmap.sqlite3", 'remove msgmap');
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
}
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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
}
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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
# An incremental indexing test
# 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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
# Another incremental indexing test
# 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');
{
remove_tree($xap);
ok(!-d $xap, 'Xapian directories removed again');
{
}
use_ok 'PublicInbox::V2Writable';
umask 007;
}
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);
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
my $im = PublicInbox::V2Writable->new($ibx, {nproc => 1});
is($im->{shards}, 1, 'one shard when forced');
ok($im->add($mime), 'ordinary message added');
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,
my @st = stat($f);
my ($bn) = (split(m!/!, $f))[-1];
is($st[2] & 07777, -f _ ? 0660 : 0770,
my $git0;
if ('ensure git configs are correct') {
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");
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)));
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)));
- 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 $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"]
open my $fh, '>', $pi_config or die "open: $!\n";
print $fh <<EOF
[publicinbox "test-v2writable"]
version = 2
address = test\@example.com
newsgroup = $group
version = 2
address = test\@example.com
newsgroup = $group
my @warn;
$SIG{__WARN__} = sub { push @warn, @_ };
my $cfgpfx = "publicinbox.$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 $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') {
"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);
}
PublicInbox::Emergency->new($spamdir);
my $orig = <<EOF;
$cfgpfx.address=$addr
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
$cfgpfx.watch=maildir:$maildir
$cfgpfx.filter=PublicInbox::Filter::RubyLang
$cfgpfx.altid=serial:alerts:file=msgmap.sqlite3
my $config = PublicInbox::Config->new(\<<EOF);
$cfgpfx.address=$addr
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
$cfgpfx.watch=maildir:$maildir
$cfgpfx.filter=PublicInbox::Filter::Vger
publicinboxlearn.watchspam=maildir:$spamdir
}
require PublicInbox::V2Writable;
my $tmpdir = tempdir('watch_maildir-v2-XXXXXX', TMPDIR => 1, CLEANUP => 1);
}
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 $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');
'http://example.com/v2list', $addr);
local $ENV{PI_CONFIG} = "$tmpdir/pi_config";
is(system(@cmd), 0, 'public-inbox init OK');
my $orig = <<EOF;
$cfgpfx.address=$addr
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
$cfgpfx.watch=maildir:$maildir
$cfgpfx.filter=PublicInbox::Filter::Vger
publicinboxlearn.watchspam=maildir:$spamdir
my ($total, undef) = $srch->reopen->query('');
is($total, 1, 'got one revision');
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');
# my @list = $git->qx(qw(rev-list refs/heads/master));
# is(scalar @list, 1, 'one revision in rev-list');
is(system(qw(git init -q --bare), $v1repo), 0, 'v1 init OK');
my $cfg2 = <<EOF;
$orig$v1pfx.address=$v1addr
is(system(qw(git init -q --bare), $v1repo), 0, 'v1 init OK');
my $cfg2 = <<EOF;
$orig$v1pfx.address=$v1addr
$v1pfx.watch=maildir:$maildir
EOF
my $config = PublicInbox::Config->new(\$cfg2);
$v1pfx.watch=maildir:$maildir
EOF
my $config = PublicInbox::Config->new(\$cfg2);
open $fh, '>', $cfgfile or die;
print $fh <<"" or die;
[publicinbox "bare"]
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"]
url = http://$host/bare
address = bare\@example.com
[publicinbox "alt"]
url = http://$host/alt
address = alt\@example.com
[publicinbox "v2"]
url = http://$host/alt
address = alt\@example.com
[publicinbox "v2"]
url = http://$host/v2
address = v2\@example.com
url = http://$host/v2
address = v2\@example.com
my ($this) = (split('/', $0))[-1];
my $tmpdir = tempdir($this.'-XXXXXX', TMPDIR => 1, CLEANUP => 1);
my $ibx = PublicInbox::Inbox->new({
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',
name => $this,
version => 2,
-primary_address => 'test@example.com',
ok($im->add($mime), "message $i added");
}
$im->done;
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;
is(scalar(@shards), $nproc, 'got expected shards');
my $orig = $ibx->over->query_xover(1, $ndoc);
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
# 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');
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');