]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-compact
ensure Xapian and SQLite are still optional for v1 tests
[public-inbox.git] / script / public-inbox-compact
index b8aaa4bd812f7a54ffe7c8ef0af8d3878205b0c4..d855b9e1bda469dedc05719946a3fc224c06217f 100755 (executable)
@@ -4,9 +4,9 @@
 use strict;
 use warnings;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
-use PublicInbox::V2Writable;
 use PublicInbox::Search;
 use PublicInbox::Config;
+use PublicInbox::InboxWritable;
 use Cwd 'abs_path';
 use File::Temp qw(tempdir);
 use File::Path qw(remove_tree);
@@ -36,15 +36,12 @@ sub commit_changes ($$$) {
        my ($im, $old, $new) = @_;
        my @st = stat($old) or die "failed to stat($old): $!\n";
 
-       for my $suf (qw(.pipe.lock -journal)) {
-               my $orig = "$old/over.sqlite3$suf";
-               link($orig, "$new/over.sqlite3$suf") and next;
-               next if $!{ENOENT};
-               die "failed to link $orig => $new/over.sqlite3$suf: $!\n";
+       my $over = "$old/over.sqlite3";
+       if (-f $over) {
+               require PublicInbox::Over;
+               $over = PublicInbox::Over->new($over);
+               $over->connect->sqlite_backup_to_file("$new/over.sqlite3");
        }
-       link("$old/over.sqlite3", "$new/over.sqlite3") or die
-               "failed to link {$old => $new}/over.sqlite3: $!\n";
-
        rename($old, "$new/old") or die "rename $old => $new/old: $!\n";
        chmod($st[2] & 07777, $new) or die "chmod $old: $!\n";
        rename($new, $old) or die "rename $new => $old: $!\n";