From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] remove dependency on IPC::Run
Date: Fri, 17 Jun 2016 02:49:30 +0000 [thread overview]
Message-ID: <20160617024930.19450-1-e@80x24.org> (raw)
We no longer depend on it for the core code, and tests
are optional for users. Hopefully this makes this
easier-to-install.
---
INSTALL | 1 -
Makefile.PL | 1 -
t/cgi.t | 5 +++--
t/mda.t | 21 +++++++++++----------
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/INSTALL b/INSTALL
index f2c11d8..e7d4b75 100644
--- a/INSTALL
+++ b/INSTALL
@@ -30,7 +30,6 @@ Requirements (server MDA)
- Email::MIME libemail-mime-perl
- Email::MIME::ContentType libemail-mime-contenttype-perl
- Encode::MIME::Header perl
- - IPC::Run libipc-run-perl
Optional modules:
diff --git a/Makefile.PL b/Makefile.PL
index 0cba59d..171712a 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -22,7 +22,6 @@ WriteMakefile(
'Email::MIME::ContentType' => 0,
'Email::Simple' => 0,
'Encode::MIME::Header' => 0,
- 'IPC::Run' => 0,
'Mail::Thread' => '2.5', # 2.5+ needed for Email::Simple compat
'Plack' => 0,
'URI::Escape' => 0,
diff --git a/t/cgi.t b/t/cgi.t
index 9d2d87f..720925a 100644
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -8,7 +8,8 @@ use Test::More;
use Email::MIME;
use File::Temp qw/tempdir/;
use Cwd;
-use IPC::Run qw/run/;
+eval { require IPC::Run };
+plan skip_all => "missing IPC::Run for t/cgi.t" if $@;
use constant CGI => "blib/script/public-inbox.cgi";
my $index = "blib/script/public-inbox-index";
@@ -238,7 +239,7 @@ done_testing();
sub run_with_env {
my ($env, @args) = @_;
my $init = sub { foreach my $k (keys %$env) { $ENV{$k} = $env->{$k} } };
- run(@args, init => $init);
+ IPC::Run::run(@args, init => $init);
}
sub cgi_run {
diff --git a/t/mda.t b/t/mda.t
index 3456699..f3c5164 100644
--- a/t/mda.t
+++ b/t/mda.t
@@ -6,8 +6,9 @@ use Test::More;
use Email::MIME;
use File::Temp qw/tempdir/;
use Cwd;
-use IPC::Run qw(run);
use PublicInbox::MID qw(mid2path);
+eval { require IPC::Run };
+plan skip_all => "missing IPC::Run for t/mda.t" if $@;
my $mda = "blib/script/public-inbox-mda";
my $learn = "blib/script/public-inbox-learn";
@@ -89,7 +90,7 @@ EOF
# ensure successful message delivery
{
local $ENV{PATH} = $main_path;
- run([$mda], \$in);
+ IPC::Run::run([$mda], \$in);
my $rev = `git --git-dir=$maindir rev-list HEAD`;
like($rev, qr/\A[a-f0-9]{40}/, "good revision committed");
chomp $rev;
@@ -106,7 +107,7 @@ EOF
my @prev = <$faildir/new/*>;
is(scalar @prev, 0 , "nothing in PI_EMERGENCY before");
local $ENV{PATH} = $fail_path;
- run([$mda], \$in);
+ IPC::Run::run([$mda], \$in);
my @revs = `git --git-dir=$maindir rev-list HEAD`;
is(scalar @revs, 1, "bad revision not committed");
my @new = <$faildir/new/*>;
@@ -178,7 +179,7 @@ EOF
{
# deliver the spam message, first
- run([$mda], \$in);
+ IPC::Run::run([$mda], \$in);
my $path = mid2path($mid);
my $msg = `git --git-dir=$maindir cat-file blob HEAD:$path`;
like($msg, qr/\Q$mid\E/, "message delivered");
@@ -186,9 +187,9 @@ EOF
# now train it
local $ENV{GIT_AUTHOR_EMAIL} = 'trainer@example.com';
local $ENV{GIT_COMMITTER_EMAIL} = 'trainer@example.com';
- run([$learn, "spam"], \$msg);
+ IPC::Run::run([$learn, "spam"], \$msg);
is($?, 0, "no failure from learning spam");
- run([$learn, "spam"], \$msg);
+ IPC::Run::run([$learn, "spam"], \$msg);
is($?, 0, "no failure from learning spam idempotently");
}
}
@@ -216,12 +217,12 @@ EOF
local $ENV{GIT_AUTHOR_EMAIL} = 'trainer@example.com';
local $ENV{GIT_COMMITTER_EMAIL} = 'trainer@example.com';
- run([$learn, "ham"], \$in);
+ IPC::Run::run([$learn, "ham"], \$in);
is($?, 0, "learned ham without failure");
my $path = mid2path($mid);
my $msg = `git --git-dir=$maindir cat-file blob HEAD:$path`;
like($msg, qr/\Q$mid\E/, "ham message delivered");
- run([$learn, "ham"], \$in);
+ IPC::Run::run([$learn, "ham"], \$in);
is($?, 0, "learned ham idempotently ");
# ensure trained email is filtered, too
@@ -256,7 +257,7 @@ EOF
{
$in = $mime->as_string;
- run([$learn, "ham"], \$in);
+ IPC::Run::run([$learn, "ham"], \$in);
is($?, 0, "learned ham without failure");
my $path = mid2path($mid);
$msg = `git --git-dir=$maindir cat-file blob HEAD:$path`;
@@ -273,7 +274,7 @@ sub fail_bad_header {
unlink @f if @f;
my ($out, $err) = ("", "");
local $ENV{PATH} = $main_path;
- run([$mda], \$in, \$out, \$err);
+ IPC::Run::run([$mda], \$in, \$out, \$err);
my $rev = `git --git-dir=$maindir rev-list HEAD`;
chomp $rev;
is($rev, $good_rev, "bad revision not commited ($msg)");
reply other threads:[~2016-06-17 2:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160617024930.19450-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).