Author: adam-guest
Date: 2008-03-24 00:13:06 +0000 (Mon, 24 Mar 2008)
New Revision: 1188
Modified:
trunk/debian/changelog
trunk/scripts/bts.pl
Log:
bts:
+ Make --no-action and --(force-)interactive work if neither DEBEMAIL
nor EMAIL are set
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-03-23 19:53:45 UTC (rev 1187)
+++ trunk/debian/changelog 2008-03-24 00:13:06 UTC (rev 1188)
@@ -1,7 +1,10 @@
devscripts (2.10.20) UNRELEASED; urgency=low
- * bts: Only append a single ellipsis to the mail subject once it becomes
- too long, rather than for each extra command (Closes: #471304)
+ * bts:
+ + Only append a single ellipsis to the mail subject once it becomes
+ too long, rather than for each extra command (Closes: #471304)
+ + Make --no-action and --(force-)interactive work if neither DEBEMAIL
+ nor EMAIL are set
* checkbashisms:
+ Make --version actually produce version information
+ Fix explanation of VAR+=foo
Modified: trunk/scripts/bts.pl
===================================================================
--- trunk/scripts/bts.pl 2008-03-23 19:53:45 UTC (rev 1187)
+++ trunk/scripts/bts.pl 2008-03-24 00:13:06 UTC (rev 1188)
@@ -1896,7 +1896,6 @@
# Message-ID algorithm from git-send-email
my $msgid = sprintf("%s-%s", time(), int(rand(4200)))."-bts-$fromaddress";
my $date = `date -R`;
- my $abortsend = 0;
chomp $date;
my $message = fold_from_header("From: $from") . "\n";
@@ -1911,24 +1910,9 @@
. "# Automatically generated email from bts,"
. " devscripts version $version\n";
- $body = edit($body) if $forceinteractive;
- if ($interactive) {
- while(1) {
- print "\n", $message, "\n", $body, "\n---\n";
- print "OK to send? [Y/n/e] ";
- $_ = <STDIN>;
- if (/^n/i) {
- $abortsend = 1;
- last;
- } elsif (/^(y|$)/i) {
- last;
- } elsif (/^e/i) {
- $body = edit($body);
- }
- }
- }
+ $body = confirmmail($message, $body);
- return if $abortsend;
+ return if not defined $body;
$message .= "$body\n";
@@ -1987,6 +1971,13 @@
$ccemail .= ", " if length $ccemail;
$ccemail .= join("[EMAIL PROTECTED], ", sort (keys %ccbugs)) . "[EMAIL
PROTECTED]";
}
+ if ($ccsecurity) {
+ my $comma = "";
+ if ($ccemail) {
+ $comma = ", ";
+ }
+ $ccemail = "$ccemail$comma$ccsecurity";
+ }
if ($ENV{'DEBEMAIL'} || $ENV{'EMAIL'}) {
# We need to fake the From: line
my ($email, $name);
@@ -2017,17 +2008,29 @@
$charset =~ s/^ANSI_X3\.4-19(68|86)$/US-ASCII/;
$from = MIME_encode_mimewords($from, 'Charset' => $charset);
- if ($ccsecurity) {
- my $comma = "";
- if ($ccemail) {
- $comma = ", ";
- }
- $ccemail = "$ccemail$comma$ccsecurity";
- }
-
send_mail($from, $btsemail, $ccemail, $subject, $body);
}
else { # No DEBEMAIL
+ my $header = "";
+
+ $header = "To: $btsemail\n";
+ $header .= "Cc: $ccemail\n" if length $ccemail;
+ $header .= "X-Debbugs-No-Ack: Yes\n" if $requestack==0;
+ $header .= "Subject: $subject\n"
+ . "X-BTS-Version: $version\n"
+ . "\n"
+ . "# Automatically generated email from bts,"
+ . " devscripts version $version\n";
+
+ $body = confirmmail($header, $body);
+
+ return if not defined $body;
+
+ if ($noaction) {
+ print "$header\n$body\n";
+ return;
+ }
+
unless (system("command -v mail >/dev/null 2>&1") == 0) {
die "bts: You need to either set DEBEMAIL or have the
mailx/mailutils package\ninstalled to send mail!\n";
}
@@ -2051,7 +2054,6 @@
my @args;
@args = ("-s", $subject, "-a", "X-BTS-Version: $version",
$btsemail);
push(@args, "-c", "$ccemail") if $ccemail;
- push(@args, "-c", "$ccsecurity") if $ccsecurity;
push(@args, "-a", "X-Debbugs-No-Ack: Yes")
if $requestack==0;
exec("mail", @args) or die "bts: error running mail: $!\n";
@@ -2060,6 +2062,29 @@
}
}
+sub confirmmail {
+ my ($header, $body) = @_;
+
+ $body = edit($body) if $forceinteractive;
+ if ($interactive) {
+ while(1) {
+ print "\n", $header, "\n", $body, "\n---\n";
+ print "OK to send? [Y/n/e] ";
+ $_ = <STDIN>;
+ if (/^n/i) {
+ $body = undef;
+ last;
+ } elsif (/^(y|$)/i) {
+ last;
+ } elsif (/^e/i) {
+ $body = edit($body);
+ }
+ }
+ }
+
+ return $body;
+}
+
# A simplified version of mailbtsall which sends one message only to
# a specified address using the specified email From: header
sub mailto {
--
To unsubscribe, send mail to [EMAIL PROTECTED]