summaryrefslogtreecommitdiff
path: root/notmuch-slurp-debbug
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-04-05 08:57:47 -0700
committerSean Whitton <spwhitton@spwhitton.name>2019-04-05 08:57:47 -0700
commite14ddc9dc9188b8f92fb251d9a9c1a508a0427dd (patch)
treee73d5acfa9a253f2416077c3bfc72c466a3aa434 /notmuch-slurp-debbug
parenta434b2c3bb331f765b08b43fb58feab6bcb0cca4 (diff)
parenteb46ea661857465629e06e4ca3527a38de3aeea7 (diff)
downloadmailscripts-e14ddc9dc9188b8f92fb251d9a9c1a508a0427dd.tar.gz
Merge tag 'debian/0.7-1' into stretch-bpo
mailscripts release 0.7-1 for unstable (sid) [dgit] [dgit distro=debian] # gpg: Signature made Wed 06 Mar 2019 11:43:53 AM MST # gpg: using RSA key 9B917007AE030E36E4FC248B695B7AE4BF066240 # gpg: Good signature from "Sean Whitton <spwhitton@spwhitton.name>" [ultimate] # Primary key fingerprint: 8DC2 487E 51AB DD90 B5C4 753F 0F56 D055 3B6D 411B # Subkey fingerprint: 9B91 7007 AE03 0E36 E4FC 248B 695B 7AE4 BF06 6240
Diffstat (limited to 'notmuch-slurp-debbug')
-rwxr-xr-xnotmuch-slurp-debbug27
1 files changed, 14 insertions, 13 deletions
diff --git a/notmuch-slurp-debbug b/notmuch-slurp-debbug
index d289e31..d424236 100755
--- a/notmuch-slurp-debbug
+++ b/notmuch-slurp-debbug
@@ -2,7 +2,7 @@
# notmuch-slurp-debbug -- add messages from a Debian bug to notmuch
-# Copyright (C) 2018 Sean Whitton
+# Copyright (C) 2018-2019 Sean Whitton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,10 +21,11 @@ use strict;
use warnings;
use Config::Tiny;
-use File::Spec::Functions 'catfile';
+use File::Spec::Functions qw(catfile);
use File::Which;
use File::Temp;
use Getopt::Long;
+use IPC::System::Simple qw(systemx capturex);
use MIME::Head;
my $Config = Config::Tiny->new;
@@ -62,13 +63,14 @@ die "notmuch-slurp-debbug: $maildir does not look to be a maildir"
&& -d catfile($maildir, "new")
&& -d catfile($maildir, "tmp"));
-my $bts_server_arg = defined $bts_server
- ? "--bts-server $bts_server"
- : "";
+my @bts_server_args = defined $bts_server
+ ? ("--bts-server", $bts_server)
+ : undef;
-# see #904182 (try using this script ;))
-system("bts $bts_server_arg --mbox --mailreader 'true %s' show $bug") == 0
- or die "notmuch-slurp-debbug: bts failed";
+# see #904182 for why we have to do it like this
+my @bts_args = grep defined, @bts_server_args,
+ qw(--mbox --mailreader), "true %s", "show", $bug;
+systemx("bts", @bts_args);
my $dir = File::Temp->newdir();
mkdir catfile($dir, "cur");
@@ -83,8 +85,7 @@ my $mbox = catfile $devscripts_cache, "$bug.mbox";
# note that mb2md won't work; it thinks Debian BTS mboxes contain just
# a single message
-system("mbox2maildir $mbox $dir") == 0
- or die "notmuch-slurp-debbug: mbox2maildir failed";
+systemx("mbox2maildir", $mbox, $dir);
foreach my $message (glob "$dir/*/*") {
my $message_head = MIME::Head->from_file($message);
@@ -93,9 +94,9 @@ foreach my $message (glob "$dir/*/*") {
# that is asking for trouble
next unless defined $mid;
$mid =~ s/(<|>)//g;
- my $match = `notmuch search id:$mid`;
+ my $match = capturex(qw(notmuch search), "id:$mid");
my $match_lines = $match =~ tr/\n//;
- system "mdmv $message $maildir" if ($match_lines == 0);
+ systemx("mdmv", $message, $maildir) if ($match_lines == 0);
}
-system "notmuch new";
+systemx(qw(notmuch new));