]> git.decadent.org.uk Git - dak.git/commitdiff
Merge mailtags
authorJoerg Jaspert <joerg@debian.org>
Sat, 10 May 2008 17:54:08 +0000 (19:54 +0200)
committerJoerg Jaspert <joerg@debian.org>
Sat, 10 May 2008 17:54:08 +0000 (19:54 +0200)
ChangeLog
debian/control
tools/debianqueued-0.9/ChangeLog
tools/debianqueued-0.9/debianqueued

index 2aaa4a21b258f1d201ca591d01434467c669000e..bca99f633a58edc290a1b8813dead4a6e3c49962 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-10  Stephen Gran   <sgran@debian.org>
+       * tools/debianqueued-0.9/debianqueued: First pass at a send_mail 
+         implementation that sucks less
+       * Update debian/control to reflect new perl dependency
+
 2008-05-09  Joerg Jaspert  <joerg@debian.org>
 
        * dak/override.py (main): substitute value in X-Debian-Package
index 2d6678b95dad0108e50255e03b5787619c229bdf..a44e363238b44b2173c57d3e7238e557beebd381 100644 (file)
@@ -7,7 +7,7 @@ Standards-Version: 3.5.6.0
 
 Package: dak
 Architecture: any
-Depends: ${python:Depends}, python-pygresql, python2.1-email | python (>= 2.2), python-apt, apt-utils, gnupg (>= 1.0.6-1), ${shlibs:Depends}, dpkg-dev, python-syck (>= 0.61.2-1)
+Depends: ${python:Depends}, python-pygresql, python2.1-email | python (>= 2.2), python-apt, apt-utils, gnupg (>= 1.0.6-1), ${shlibs:Depends}, dpkg-dev, python-syck (>= 0.61.2-1), libemail-send-perl
 Suggests: lintian, linda, less, binutils-multiarch, symlinks, postgresql (>= 7.1.0), dsync
 Description: Debian's archive maintenance scripts
  This is a collection of archive maintenance scripts used by the
index d979a501133cca422b37c2552a336f7f284c4461..77267d99722901eb3b777f6b9e78a69ce46853a7 100644 (file)
@@ -1,3 +1,7 @@
+2008-05-10  Stephen Gran   <sgran@debian.org>
+       * debianqueued: First pass at a send_mail implementation that 
+         sucks less.  This also gives us X-Debian-Package
+
 2008-05-08  Joerg Jaspert  <joerg@debian.org>
 
        * debianqueued: added header X-Debian: DAK
index e84d38528ec697b33dbb5892e9a2541386949260..c4dec406b82b789fa8e4f982f1930c35a3238cd7 100755 (executable)
@@ -281,6 +281,8 @@ package main;
 
 ($main::progname = $0) =~ s,.*/,,;
 
+my %packages = ();
+
 # extract -r and -k args
 $main::arg = "";
 if (@ARGV == 1 && $ARGV[0] =~ /^-[rk]$/) {
@@ -790,6 +792,7 @@ sub process_changes($\@) {
                elsif (/^Source:\s*/i) {
                        chomp( $pkgname = $' );
                        $pkgname =~ s/\s+$//;
+                        $main::packages{$pkgname}++;
                }
                elsif (/^Files:/i) {
                        while( <CHANGES> ) {
@@ -2078,6 +2081,7 @@ sub init_mail(;$) {
 
        $main::mail_addr = "";
        $main::mail_text = "";
+        %main::packages  = ();
        $main::mail_subject = $file ? "Processing of $file" : "";
 }
 
@@ -2120,18 +2124,35 @@ sub send_mail($$$) {
        my $subject = shift;
        my $text = shift;
 
-       debug( "Sending mail to $addr" );
-       debug( "executing $conf::mail -s '$subject' -a 'X-Debian: DAK' '$addr'" );
-       if (!open( MAIL, "|$conf::mail -s '$subject' -a 'X-Debian: DAK' '$addr'" )) {
-               msg( "log", "Could not open pipe to $conf::mail: $!\n" );
-               return 0;
+       my $package = keys %main::packages ? join(' ', keys %main::packages) : "";
+
+       use Email::Send;
+       $Email::Send::Sendmail::SENDMAIL = '/usr/sbin/sendmail';
+
+       my $message = <<__MESSAGE__;
+To: $addr
+From: dak\@ftp-master.debian.org
+Subject: $subject
+X-Debian: DAK
+__MESSAGE__
+
+       if (length $package) {
+               $message .= "X-Debian-Package: $package\n";
        }
-       print MAIL $text;
-       print MAIL "\nGreetings,\n\n\tYour Debian queue daemon\n";
-       if (!close( MAIL )) {
-               msg( "log", "$conf::mail failed (exit status ", $? >> 8, ")\n" );
+
+       $message .= "\n$text";
+       $message .= "\nGreetings,\n\n\tYour Debian queue daemon\n";
+
+       my $mail = Email::Send->new;
+       for ( qw[Sendmail SMTP] ) {
+               $mail->mailer($_) and last if $mail->mailer_available($_);
+       }
+
+       my $ret = $mail->send($message);
+       if ($ret && $ret !~ /Message sent|success/) {
                return 0;
        }
+
        return 1;
 }