The following commit has been merged in the master branch:
commit 7eafe08eea0d5be36a534cc6d1b8cc731dfd4be2
Author: James Vega <[email protected]>
Date:   Mon Jun 14 22:56:08 2010 -0400

    bts: Use sendmail to send mails with extra headers when $(DEB)EMAIL aren't 
present.
    
    Closes: #577564

diff --git a/README b/README
index 326446a..4841724 100644
--- a/README
+++ b/README
@@ -27,8 +27,7 @@ And now, in mostly alphabetical order, the scripts:
 - bts: A command-line tool for accessing the BTS, both to
   send mails to [email protected] and to access the web pages and
   SOAP interface of the BTS. [www-browser, libauthen-sasl-perl, 
-  libnet-smtp-ssl-perl, libsoap-lite-perl, libwww-perl, bsd-mailx |
-  mailx | mailutils]
+  libnet-smtp-ssl-perl, libsoap-lite-perl, libwww-perl, bsd-mailx | mailx]
 
 - build-rdeps: Searches for all packages that build-depend on a given package
   [dctrl-tools]
@@ -170,7 +169,7 @@ And now, in mostly alphabetical order, the scripts:
 
 - manpage-alert: locate binaries without corresponding manpages. [man-db]
 
-- mass-bug: mass-file bug reports [bsd-mailx | mailx | mailutils]
+- mass-bug: mass-file bug reports [bsd-mailx | mailx]
 
 - mergechanges: merge .changes files from the same release but built
   on different architectures.
@@ -189,7 +188,7 @@ And now, in mostly alphabetical order, the scripts:
   gnuplot. [libtimedate-perl, gnuplot]
 
 - pts-subscribe: subscribe to the PTS (Package Tracking System) for a
-  limited period of time. [bsd-mailx | mailx | mailutils, at]
+  limited period of time. [bsd-mailx | mailx, at]
 
 - rc-alert: list installed packages which have release-critical bugs [wget]
 
diff --git a/debian/changelog b/debian/changelog
index 53c8315..dd341cf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ devscripts (2.10.65) UNRELEASED; urgency=low
   [ James Vega ]
   * Remove mergechanges from the set of commands which use completion of
     package names.  (Closes: #578167)
+  * bts: Use sendmail to send mails with extra headers when $(DEB)EMAIL aren't
+    present.  (Closes: #577564)
 
   [ Martin Zobel-Helas ]
   * Remove svk from Recommends, it is no longer in the archive. (Closes:
diff --git a/debian/control b/debian/control
index 7f6d78f..cc603ed 100644
--- a/debian/control
+++ b/debian/control
@@ -17,7 +17,7 @@ Recommends: at, curl | wget, dctrl-tools, debian-keyring, 
debian-maintainers,
  dput | dupload, equivs, fakeroot, gnupg, libauthen-sasl-perl,
  libcrypt-ssleay-perl, libparse-debcontrol-perl, libsoap-lite-perl,
  libterm-size-perl, libtimedate-perl, liburi-perl, libwww-perl,
- libyaml-syck-perl, lintian, lsb-release, bsd-mailx | mailx | mailutils, 
+ libyaml-syck-perl, lintian, lsb-release, bsd-mailx | mailx,
  man-db, patch, patchutils, ssh-client, strace, unzip, wdiff, www-browser,
  subversion | cvs | darcs | tla | bzr | git-core | mercurial, lzma,
  xz-utils, sensible-utils, libjson-perl
@@ -33,7 +33,7 @@ Description: scripts to make the life of a Debian Package 
maintainer easier
   - archpath: print tla/Bazaar package names [tla | bazaar]
   - bts: a command-line tool for manipulating the BTS [www-browser,
     libauthen-sasl-perl, libnet-smtp-ssl-perl, libsoap-lite-perl, libwww-perl,
-    bsd-mailx | mailx | mailutils]
+    bsd-mailx | mailx]
   - build-rdeps: Searches for all packages that build-depend on a
     given package [dctrl-tools]
   - chdist: tool to easily play with several distributions [dctrl-tools]
@@ -96,7 +96,7 @@ Description: scripts to make the life of a Debian Package 
maintainer easier
   - licensecheck: attempt to determine the license of source files
   - list-unreleased: searches for unreleased packages
   - manpage-alert: locate binaries without corresponding manpages [man-db]
-  - mass-bug: mass-file bug reports [bsd-mailx | mailx | mailutils]
+  - mass-bug: mass-file bug reports [bsd-mailx | mailx]
   - mergechanges: merge .changes files from a package built on different
     architectures
   - mk-build-deps: Given a package name and/or control file, generate a binary
@@ -108,7 +108,7 @@ Description: scripts to make the life of a Debian Package 
maintainer easier
   - plotchangelog: view a nice plot of the data in a changelog file
     [libtimedate-perl, gnuplot]
   - pts-subscribe: subscribe to the PTS for a limited period of time
-    [bsd-mailx | mailx | mailutils, at]
+    [bsd-mailx | mailx, at]
   - rc-alert: list installed packages which have release-critical bugs [wget]
   - rmadison: remotely query the Debian archive database about packages
     [wget | curl, liburi-perl]
diff --git a/scripts/bts.pl b/scripts/bts.pl
index a2d100d..158b091 100755
--- a/scripts/bts.pl
+++ b/scripts/bts.pl
@@ -2525,7 +2525,7 @@ sub send_mail {
        if ($pid) {
            # parent
            print MAIL $message;
-           close MAIL or die "$progname: sendmail error: $!\n";
+           close MAIL or die "$progname: $sendmailcmd error: $!\n";
        }
        else {
            # child
@@ -2536,7 +2536,7 @@ sub send_mail {
                my @mailcmd = split ' ', $sendmailcmd;
                push @mailcmd, "-t" if $sendmailcmd =~ /$sendmail_t/;
                exec @mailcmd
-                   or die "$progname: error running sendmail: $!\n";
+                   or die "$progname: error running $sendmailcmd: $!\n";
            }
        }
     }
@@ -2621,22 +2621,20 @@ sub mailbtsall {
        return if not defined $body;
 
        if ($noaction) {
-           print "$header\n$body\n";
+           print "$header$body\n";
            return;
        }
 
-       unless (system("command -v mail >/dev/null 2>&1") == 0) {
-           die "$progname: You need to either set DEBEMAIL or have the 
mailx/mailutils package\ninstalled to send mail!\n";
-       }
        my $pid = open(MAIL, "|-");
        if (! defined $pid) {
            die "$progname: Couldn't fork: $!\n";
        }
-       $SIG{'PIPE'} = sub { die "$progname: pipe for mail broke\n"; };
+       $SIG{'PIPE'} = sub { die "$progname: pipe for $sendmailcmd broke\n"; };
        if ($pid) {
            # parent
+           print MAIL $header;
            print MAIL $body;
-           close MAIL or die "$progname: mail: $!\n";
+           close MAIL or die "$progname: $sendmailcmd: $!\n";
        }
        else {
            # child
@@ -2644,13 +2642,10 @@ sub mailbtsall {
                exec("/bin/cat")
                    or die "$progname: error running cat: $!\n";
            } else {
-               $ccemail =~ s/ //g;
-               my @args;
-               @args = ("-s", $subject, "-a", "User-Agent: devscripts 
bts/$version$toolname", $btsemail);
-               push(@args, "-c", "$ccemail") if $ccemail;
-               push(@args, "-a", "X-Debbugs-No-Ack: Yes")
-                   if $requestack==0;
-               exec("mail", @args) or die "$progname: error running mail: 
$!\n";
+               my @mailcmd = split ' ', $sendmailcmd;
+               push @mailcmd, "-t" if $sendmailcmd =~ /$sendmail_t/;
+               exec @mailcmd
+                   or die "$progname: error running $sendmailcmd: $!\n";
            }
        }
     }
@@ -2748,18 +2743,18 @@ sub mailto {
        send_mail($from, $to, '', $subject, $body);
     }
     else {  # No $from
-       unless (system("command -v mail >/dev/null 2>&1") == 0) {
-           die "$progname: You need to either specify an email address (say 
using DEBEMAIL)\n or have the mailx/mailutils package installed to send 
mail!\n";
+       unless (system("command -v mailx >/dev/null 2>&1") == 0) {
+           die "$progname: You need to either specify an email address (say 
using DEBEMAIL)\nor have the bsd-mailx package (or another package providing 
mailx) installed\nto send mail!\n";
        }
        my $pid = open(MAIL, "|-");
        if (! defined $pid) {
            die "$progname: Couldn't fork: $!\n";
        }
-       $SIG{'PIPE'} = sub { die "$progname: pipe for mail broke\n"; };
+       $SIG{'PIPE'} = sub { die "$progname: pipe for mailx broke\n"; };
        if ($pid) {
            # parent
            print MAIL $body;
-           close MAIL or die "$progname: mail: $!\n";
+           close MAIL or die "$progname: mailx: $!\n";
        }
        else {
            # child
@@ -2767,8 +2762,8 @@ sub mailto {
                exec("/bin/cat")
                    or die "$progname: error running cat: $!\n";
            } else {
-               exec("mail", "-s", $subject, $to)
-                   or die "$progname: error running mail: $!\n";
+               exec("mailx", "-s", $subject, $to)
+                   or die "$progname: error running mailx: $!\n";
            }
        }
     }

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to