user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/3] testcommon: allow OR-ing module dependencies
  2020-06-14  0:25  6% [PATCH 0/3] IMAP fixes for older systems Eric Wong
@ 2020-06-14  0:25  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-06-14  0:25 UTC (permalink / raw)
  To: meta

IMAP requires either the Email::Address::XS or Mail::Address
package (part of perl-MailTools RPM or libmailtools-perl deb);
and Email::Address::XS is not officially packaged for some older
distros, most notably CentOS 7.x.
---
 lib/PublicInbox/TestCommon.pm | 11 ++++++++++-
 t/imap.t                      |  6 +++---
 t/imapd-tls.t                 |  3 ++-
 t/imapd.t                     |  3 ++-
 xt/imapd-mbsync-oimap.t       |  1 +
 xt/imapd-validate.t           |  2 +-
 xt/mem-imapd-tls.t            |  2 +-
 7 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 5e7dc8b0..a97125e5 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -72,7 +72,7 @@ sub require_mods {
 	my @mods = @_;
 	my $maybe = pop @mods if $mods[-1] =~ /\A[0-9]+\z/;
 	my @need;
-	for my $mod (@mods) {
+	while (my $mod = shift(@mods)) {
 		if ($mod eq 'Search::Xapian') {
 			if (eval { require PublicInbox::Search } &&
 				PublicInbox::Search::load_xapian()) {
@@ -83,6 +83,15 @@ sub require_mods {
 				PublicInbox::SearchIdx::load_xapian_writable()){
 					next;
 			}
+		} elsif (index($mod, '||') >= 0) { # "Foo||Bar"
+			my $ok;
+			for my $m (split(/\Q||\E/, $mod)) {
+				eval "require $m";
+				next if $@;
+				$ok = $m;
+				last;
+			}
+			next if $ok;
 		} else {
 			eval "require $mod";
 		}
diff --git a/t/imap.t b/t/imap.t
index 0700f578..83adf553 100644
--- a/t/imap.t
+++ b/t/imap.t
@@ -4,10 +4,10 @@
 # unit tests (no network) for IMAP, see t/imapd.t for end-to-end tests
 use strict;
 use Test::More;
-use PublicInbox::IMAP;
-use PublicInbox::IMAPD;
 use PublicInbox::TestCommon;
-require_mods(qw(DBD::SQLite));
+require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address));
+require_ok 'PublicInbox::IMAP';
+require_ok 'PublicInbox::IMAPD';
 require_git 2.6;
 use POSIX qw(strftime);
 
diff --git a/t/imapd-tls.t b/t/imapd-tls.t
index 5352d100..f81959a5 100644
--- a/t/imapd-tls.t
+++ b/t/imapd-tls.t
@@ -6,7 +6,8 @@ use Test::More;
 use Socket qw(IPPROTO_TCP SOL_SOCKET);
 use PublicInbox::TestCommon;
 # IO::Poll is part of the standard library, but distros may split it off...
-require_mods(qw(DBD::SQLite IO::Socket::SSL Mail::IMAPClient IO::Poll));
+require_mods(qw(DBD::SQLite IO::Socket::SSL Mail::IMAPClient IO::Poll
+	Email::Address::XS||Mail::Address));
 my $imap_client = 'Mail::IMAPClient';
 $imap_client->can('starttls') or
 	plan skip_all => 'Mail::IMAPClient does not support TLS';
diff --git a/t/imapd.t b/t/imapd.t
index f5ca8b7e..0f48e905 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -8,7 +8,8 @@ use Time::HiRes ();
 use PublicInbox::TestCommon;
 use PublicInbox::Config;
 use PublicInbox::Spawn qw(which);
-require_mods(qw(DBD::SQLite Mail::IMAPClient Mail::IMAPClient::BodyStructure));
+require_mods(qw(DBD::SQLite Mail::IMAPClient Mail::IMAPClient::BodyStructure
+	Email::Address::XS||Mail::Address));
 my $imap_client = 'Mail::IMAPClient';
 my $can_compress = $imap_client->can('compress');
 if ($can_compress) { # hope this gets fixed upstream, soon
diff --git a/xt/imapd-mbsync-oimap.t b/xt/imapd-mbsync-oimap.t
index c097a026..edf111fd 100644
--- a/xt/imapd-mbsync-oimap.t
+++ b/xt/imapd-mbsync-oimap.t
@@ -7,6 +7,7 @@ use Test::More;
 use File::Path qw(mkpath);
 use PublicInbox::TestCommon;
 use PublicInbox::Spawn qw(which spawn);
+require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address));
 my $inboxdir = $ENV{GIANT_INBOX_DIR};
 (defined($inboxdir) && -d $inboxdir) or
 	plan skip_all => "GIANT_INBOX_DIR not defined for $0";
diff --git a/xt/imapd-validate.t b/xt/imapd-validate.t
index 9a56c2d0..3e445156 100644
--- a/xt/imapd-validate.t
+++ b/xt/imapd-validate.t
@@ -15,7 +15,7 @@ my $BATCH = $ENV{TEST_BATCH} // 100;
 my $REPEAT = $ENV{TEST_REPEAT} // 1;
 diag "TEST_BATCH=$BATCH TEST_REPEAT=$REPEAT";
 
-require_mods(qw(Mail::IMAPClient));
+require_mods(qw(Mail::IMAPClient Email::Address::XS||Mail::Address));
 my $imap_client = 'Mail::IMAPClient';
 my $can_compress = $imap_client->can('compress');
 if ($can_compress) { # hope this gets fixed upstream, soon
diff --git a/xt/mem-imapd-tls.t b/xt/mem-imapd-tls.t
index accf7564..648a0ad3 100644
--- a/xt/mem-imapd-tls.t
+++ b/xt/mem-imapd-tls.t
@@ -9,7 +9,7 @@ use Socket qw(SOCK_STREAM IPPROTO_TCP SOL_SOCKET);
 use PublicInbox::TestCommon;
 use PublicInbox::Syscall qw(:epoll);
 use PublicInbox::DS;
-require_mods(qw(DBD::SQLite));
+require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address));
 my $inboxdir = $ENV{GIANT_INBOX_DIR};
 my $TEST_TLS;
 SKIP: {

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/3] IMAP fixes for older systems
@ 2020-06-14  0:25  6% Eric Wong
  2020-06-14  0:25  7% ` [PATCH 1/3] testcommon: allow OR-ing module dependencies Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-06-14  0:25 UTC (permalink / raw)
  To: meta

Eric Wong (3):
  testcommon: allow OR-ing module dependencies
  inboxidle: support Linux::Inotify2 1.x
  t/imapd*.t: support older Mail::IMAPClient

 lib/PublicInbox/InboxIdle.pm  |  5 ++++-
 lib/PublicInbox/TestCommon.pm | 11 ++++++++++-
 t/imap.t                      |  6 +++---
 t/imapd-tls.t                 |  7 +++++--
 t/imapd.t                     |  9 +++++----
 xt/imapd-mbsync-oimap.t       |  1 +
 xt/imapd-validate.t           |  2 +-
 xt/mem-imapd-tls.t            |  2 +-
 8 files changed, 30 insertions(+), 13 deletions(-)


^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-06-14  0:25  6% [PATCH 0/3] IMAP fixes for older systems Eric Wong
2020-06-14  0:25  7% ` [PATCH 1/3] testcommon: allow OR-ing module dependencies 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).