diff options
author | Eric Wong <e@80x24.org> | 2019-05-15 01:18:08 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-05-15 01:18:54 +0000 |
commit | 0b1de991a099b5e8b9a9e3e85b5eaaacc9362dbb (patch) | |
tree | a9295edad8c28aec3f87fc35c9142d87d4fea39e /script | |
parent | 70caf43a131fc5bdf7104f82f2acee9d5353d6a8 (diff) | |
download | public-inbox-0b1de991a099b5e8b9a9e3e85b5eaaacc9362dbb.tar.gz |
More tests work without Search::Xapian, now. Usability issues still need to be fixed
Diffstat (limited to 'script')
-rwxr-xr-x | script/public-inbox-index | 25 | ||||
-rwxr-xr-x | script/public-inbox-init | 1 | ||||
-rwxr-xr-x | script/public-inbox-purge | 5 |
3 files changed, 24 insertions, 7 deletions
diff --git a/script/public-inbox-index b/script/public-inbox-index index b353093e..53def9a7 100755 --- a/script/public-inbox-index +++ b/script/public-inbox-index @@ -26,10 +26,12 @@ if ($@) { my $reindex; my $prune; my $jobs = undef; +my $indexlevel; my %opts = ( '--reindex' => \$reindex, '--jobs|j=i' => \$jobs, '--prune' => \$prune, + 'L|indexlevel=s' => \$indexlevel, ); GetOptions(%opts) or die "bad command-line args\n$usage"; die "--jobs must be positive\n" if defined $jobs && $jobs < 0; @@ -55,18 +57,27 @@ defined($config) and $config->each_inbox(sub { }); foreach my $dir (@dirs) { - if (!ref($dir) && -f "$dir/inbox.lock") { # v2 - my $ibx = { mainrepo => $dir, name => 'unnamed' }; + if (!ref($dir)) { + unless (-d $dir) { + die "$dir does not appear to be an inbox repository\n"; + } + my $ibx = { + mainrepo => $dir, + name => 'unnamed', + indexlevel => $indexlevel, + version => -f "$dir/inbox.lock" ? 2 : 1, + }; $dir = PublicInbox::Inbox->new($ibx); + } elsif (defined $indexlevel && !defined($dir->{indexlevel})) { + # XXX: users can shoot themselves in the foot, with this... + $dir->{indexlevel} = $indexlevel; } - index_dir($dir); + + index_inbox($dir); } -sub index_dir { +sub index_inbox { my ($repo) = @_; - if (!ref $repo && ! -d $repo) { - die "$repo does not appear to be an inbox repository\n"; - } if (ref($repo) && ($repo->{version} || 1) == 2) { eval { require PublicInbox::V2Writable }; die "v2 requirements not met: $@\n" if $@; diff --git a/script/public-inbox-init b/script/public-inbox-init index 8bb78451..9f0bd1bd 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -109,6 +109,7 @@ my $ibx = PublicInbox::Inbox->new({ name => $name, version => $version, -primary_address => $address[0], + indexlevel => $indexlevel, }); if ($version >= 2) { diff --git a/script/public-inbox-purge b/script/public-inbox-purge index 688dd950..264bcdef 100755 --- a/script/public-inbox-purge +++ b/script/public-inbox-purge @@ -63,6 +63,11 @@ if ($all) { mainrepo => $dir, }); }; + + # somebody could "rm -r" all the Xapian directories; + # let them purge the overview, at least + $ibx->{indexlevel} ||= 'basic' unless $ibx->search; + push @inboxes, $ibx; } |