* [PATCH 2/4] convert+compact: fix when running without ~/.public-inbox/config
2018-05-11 19:20 5% [PATCH 0/4] test fixes for latest CPAN modules Eric Wong
@ 2018-05-11 19:20 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2018-05-11 19:20 UTC (permalink / raw)
To: meta; +Cc: Konstantin Ryabitsev
Some users may not have any public-inboxes configured, especially in
tests.
---
script/public-inbox-compact | 10 ++++++----
script/public-inbox-convert | 10 ++++++----
t/convert-compact.t | 1 +
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/script/public-inbox-compact b/script/public-inbox-compact
index 5f18497..d22e403 100755
--- a/script/public-inbox-compact
+++ b/script/public-inbox-compact
@@ -13,12 +13,14 @@ use File::Path qw(remove_tree);
use PublicInbox::Spawn qw(spawn);
my $usage = "Usage: public-inbox-compact REPO_DIR\n";
my $dir = shift or die $usage;
-my $config = PublicInbox::Config->new;
+my $config = eval { PublicInbox::Config->new };
my $ibx;
$dir = abs_path($dir);
-$config->each_inbox(sub {
- $ibx = $_[0] if abs_path($_[0]->{mainrepo}) eq $dir
-});
+if ($config) {
+ $config->each_inbox(sub {
+ $ibx = $_[0] if abs_path($_[0]->{mainrepo}) eq $dir
+ });
+}
unless ($ibx) {
warn "W: $dir not configured in ".
PublicInbox::Config::default_file() . "\n";
diff --git a/script/public-inbox-convert b/script/public-inbox-convert
index 2979a0c..bd8fb98 100755
--- a/script/public-inbox-convert
+++ b/script/public-inbox-convert
@@ -25,12 +25,14 @@ my $old_dir = shift or die $usage;
my $new_dir = shift or die $usage;
die "$new_dir exists\n" if -d $new_dir;
die "$old_dir not a directory\n" unless -d $old_dir;
-my $config = PublicInbox::Config->new;
+my $config = eval { PublicInbox::Config->new };
$old_dir = abs_path($old_dir);
my $old;
-$config->each_inbox(sub {
- $old = $_[0] if abs_path($_[0]->{mainrepo}) eq $old_dir;
-});
+if ($config) {
+ $config->each_inbox(sub {
+ $old = $_[0] if abs_path($_[0]->{mainrepo}) eq $old_dir;
+ });
+}
unless ($old) {
warn "W: $old_dir not configured in " .
PublicInbox::Config::default_file() . "\n";
diff --git a/t/convert-compact.t b/t/convert-compact.t
index ced4541..e923200 100644
--- a/t/convert-compact.t
+++ b/t/convert-compact.t
@@ -54,6 +54,7 @@ foreach (@xdir) {
}
local $ENV{PATH} = "blib/script:$ENV{PATH}";
+local $ENV{PI_CONFIG} = '/dev/null';
open my $err, '>>', "$tmpdir/err.log" or die "open: err.log $!\n";
open my $out, '>>', "$tmpdir/out.log" or die "open: out.log $!\n";
my $rdr = { 1 => fileno($out), 2 => fileno($err) };
^ permalink raw reply related [relevance 7%]
* [PATCH 0/4] test fixes for latest CPAN modules
@ 2018-05-11 19:20 5% Eric Wong
2018-05-11 19:20 7% ` [PATCH 2/4] convert+compact: fix when running without ~/.public-inbox/config Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2018-05-11 19:20 UTC (permalink / raw)
To: meta; +Cc: Konstantin Ryabitsev
A few test fixes for problems encountered by Konstantin on
CentOS 7 and some of the latest CPAN modules.
There's still locking problem in in t/v2mirror.t which I
have not reproduced, yet.
Eric Wong (4):
content_id: workaround quote handling change in Email::* modules
convert+compact: fix when running without ~/.public-inbox/config
t/v2mda: setup emergency Maildir for test
t/search: quiet warning from Encode.pm
script/public-inbox-compact | 10 ++++++----
script/public-inbox-convert | 10 ++++++----
t/content_id.t | 8 ++++----
t/convert-compact.t | 1 +
t/search.t | 2 +-
t/v2mda.t | 2 ++
6 files changed, 20 insertions(+), 13 deletions(-)
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2018-05-11 19:20 5% [PATCH 0/4] test fixes for latest CPAN modules Eric Wong
2018-05-11 19:20 7% ` [PATCH 2/4] convert+compact: fix when running without ~/.public-inbox/config 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).