}
sub _init_v1 {
- my ($self, $skip_artnum) = @_;
+ my ($self) = @_;
+ my $skip_artnum = ($self->{-creat_opt} // {})->{'skip-artnum'};
if (defined($self->{indexlevel}) || defined($skip_artnum)) {
require PublicInbox::SearchIdx;
require PublicInbox::Msgmap;
}
sub init_inbox {
- my ($self, $shards, $skip_epoch, $skip_artnum) = @_;
+ my ($self, $shards, $skip_epoch) = @_;
if ($self->version == 1) {
my $dir = assert_usable_dir($self);
PublicInbox::Import::init_bare($dir);
- $self->with_umask(\&_init_v1, $self, $skip_artnum);
+ $self->with_umask(\&_init_v1, $self);
} else {
- my $v2w = importer($self);
- $v2w->init_inbox($shards, $skip_epoch, $skip_artnum);
+ importer($self)->init_inbox($shards, $skip_epoch);
}
}
# public (for now?)
sub init_inbox {
- my ($self, $shards, $skip_epoch, $skip_artnum) = @_;
+ my ($self, $shards, $skip_epoch) = @_;
if (defined $shards) {
$self->{parallel} = 0 if $shards == 0;
$self->{shards} = $shards if $shards > 0;
$max = $skip_epoch if (defined($skip_epoch) && !defined($max));
$self->{mg}->add_epoch($max // 0);
$self->idx_init;
+ my $skip_artnum = ($self->{ibx}->{-creat_opt} // {})->{'skip-artnum'};
$self->{mm}->skip_artnum($skip_artnum) if defined $skip_artnum;
$self->done;
}
require PublicInbox::Admin;
PublicInbox::Admin::require_or_die('-base');
-my ($version, $indexlevel, $skip_epoch, $skip_artnum, $jobs, $show_help);
+my ($version, $indexlevel, $skip_epoch, $jobs, $show_help);
my $skip_docdata;
my $ng = '';
my (@c_extra, @chdir);
+my $creat_opt = {};
my %opts = (
'V|version=i' => \$version,
'L|index-level|indexlevel=s' => \$indexlevel,
'S|skip|skip-epoch=i' => \$skip_epoch,
- 'skip-artnum=i' => \$skip_artnum,
+ 'skip-artnum=i' => \($creat_opt->{'skip-artnum'}),
'j|jobs=i' => \$jobs,
'ng|newsgroup=s' => \$ng,
'skip-docdata' => \$skip_docdata,
indexlevel => $indexlevel,
});
-my $creat_opt = {};
if (defined $jobs) {
die "--jobs is only supported for -V2 inboxes\n" if $version == 1;
die "--jobs=$jobs must be >= 1\n" if $jobs <= 0;
die "--skip-docdata ignored with --indexlevel=basic\n";
$ibx->{-skip_docdata} = $skip_docdata;
}
-$ibx->init_inbox(0, $skip_epoch, $skip_artnum);
+$ibx->init_inbox(0, $skip_epoch);
my $f = "$inboxdir/description";
if (sysopen $fh, $f, O_CREAT|O_EXCL|O_WRONLY) {