user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] convert: preserve indexlevel on conversions
@ 2020-02-08 18:08 Eric Wong
  2020-02-08 18:30 ` [PATCH 2/1] t/multi-mid: skip properly w/o DBD::SQLite Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2020-02-08 18:08 UTC (permalink / raw)
  To: meta

We don't want to blow up users storage too badly when converting
v1 to v2 or break because they don't have Xapian bindings installed.
---
 script/public-inbox-convert | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/script/public-inbox-convert b/script/public-inbox-convert
index 906001cb..e13c13f4 100755
--- a/script/public-inbox-convert
+++ b/script/public-inbox-convert
@@ -6,6 +6,7 @@ use warnings;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
 use PublicInbox::InboxWritable;
 use PublicInbox::Config;
+use PublicInbox::Admin;
 use PublicInbox::V2Writable;
 use PublicInbox::Git;
 use PublicInbox::Spawn qw(spawn);
@@ -45,6 +46,14 @@ $old = PublicInbox::InboxWritable->new($old);
 if ($old->version >= 2) {
 	die "Only conversion from v1 inboxes is supported\n";
 }
+
+$old->{indexlevel} //= PublicInbox::Admin::detect_indexlevel($old);
+if ($index) {
+	my $mods = {};
+	PublicInbox::Admin::scan_ibx_modules($mods, $old);
+	PublicInbox::Admin::require_or_die(keys %$mods);
+}
+
 my $new = { %$old };
 $new->{inboxdir} = abs_path($new_dir);
 $new->{version} = 2;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/1] t/multi-mid: skip properly w/o DBD::SQLite
  2020-02-08 18:08 [PATCH] convert: preserve indexlevel on conversions Eric Wong
@ 2020-02-08 18:30 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2020-02-08 18:30 UTC (permalink / raw)
  To: meta

SearchIdx always requires DBD::SQLite, so only require it
after we've passed `require_mods(qw(DBD::SQLite))'.
---
 t/multi-mid.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/multi-mid.t b/t/multi-mid.t
index 94c0e0a2..df865efb 100644
--- a/t/multi-mid.t
+++ b/t/multi-mid.t
@@ -4,9 +4,9 @@ use Test::More;
 use PublicInbox::MIME;
 use PublicInbox::TestCommon;
 use PublicInbox::InboxWritable;
-use PublicInbox::SearchIdx;
 require_git(2.6);
 require_mods(qw(DBD::SQLite));
+require PublicInbox::SearchIdx;
 
 my $addr = 'test@example.com';
 my $bad = PublicInbox::MIME->new(<<EOF);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-08 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-08 18:08 [PATCH] convert: preserve indexlevel on conversions Eric Wong
2020-02-08 18:30 ` [PATCH 2/1] t/multi-mid: skip properly w/o DBD::SQLite Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).