my $new = { %$old };
$new->{inboxdir} = PublicInbox::Config::rel2abs_collapsed($new_dir);
$new->{version} = 2;
-my $creat_opt = { nproc => $opt->{jobs} };
-$creat_opt->{wal} = 1 if $opt->{wal};
-$creat_opt->{fsync} = $opt->{fsync};
-$new = PublicInbox::InboxWritable->new($new, $creat_opt);
+$opt->{nproc} = $opt->{jobs}; # FIXME validate
+$new = PublicInbox::InboxWritable->new($new, $opt);
my $v2w;
sub link_or_copy ($$) {
require PublicInbox::Admin;
PublicInbox::Admin::require_or_die('-base');
-my $creat_opt = {};
my $usage_cb = sub {
print STDERR $help;
exit 1;
skip-docdata help|h
c=s@ C=s@
)) or $usage_cb->();
-for (qw(wal skip-epoch skip-artnum)) {
- $creat_opt->{$_} = $opt->{$_} if exists $opt->{$_};
-}
if ($opt->{help}) { print $help; exit 0 };
my $ng = $opt->{newsgroup} // '';
my $version = $opt->{version} if defined $opt->{version};
my $indexlevel = $opt->{indexlevel} if defined $opt->{indexlevel};
-my $jobs = $opt->{jobs} if defined $opt->{jobs};
my $name = shift @ARGV or $usage_cb->();
my $inboxdir = shift @ARGV or $usage_cb->();
my $http_url = shift @ARGV or $usage_cb->();
$version = 1 unless defined $version;
-if ($version == 1 && defined $creat_opt->{'skip-epoch'}) {
+if ($version == 1 && defined $opt->{'skip-epoch'}) {
die "--skip-epoch is only supported for -V2 inboxes\n";
}
indexlevel => $indexlevel,
});
-if (defined $jobs) {
+if (defined(my $jobs = $opt->{jobs})) {
die "--jobs is only supported for -V2 inboxes\n" if $version == 1;
die "--jobs=$jobs must be >= 1\n" if $jobs <= 0;
- $creat_opt->{nproc} = $jobs;
+ $opt->{nproc} = $jobs;
}
require PublicInbox::InboxWritable;
-$ibx = PublicInbox::InboxWritable->new($ibx, $creat_opt);
+$ibx = PublicInbox::InboxWritable->new($ibx, $opt);
if ($opt->{'skip-docdata'}) {
$ibx->{indexlevel} //= 'full'; # ensure init_inbox writes xdb
$ibx->{indexlevel} eq 'basic' and