[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

ftpmaster-dak r1091: Merge mailtags



------------------------------------------------------------
revno: 1091
committer: Joerg Jaspert <joerg@debian.org>
branch nick: upstream
timestamp: Sat 2008-05-10 19:54:08 +0200
message:
  Merge mailtags
modified:
  ChangeLog
  debian/control
  tools/debianqueued-0.9/ChangeLog
  tools/debianqueued-0.9/debianqueued
    ------------------------------------------------------------
    revno: 1090.1.1
    committer: Stephen Gran <steve@lobefin.net>
    branch nick: ftpmaster-dak-mail
    timestamp: Sat 2008-05-10 15:25:31 +0100
    message:
      Rewrite the send_mail() function in debianqueued to not use mailx (blech).  
      Doing it this way also gives us an easy way to add arbitrary headers, so 
      I've added X-Debian-Package while I was there.
    modified:
      ChangeLog
      tools/debianqueued-0.9/ChangeLog
      tools/debianqueued-0.9/debianqueued
    ------------------------------------------------------------
    revno: 1090.1.2
    committer: Stephen Gran <steve@lobefin.net>
    branch nick: ftpmaster-dak-mail
    timestamp: Sat 2008-05-10 15:37:50 +0100
    message:
      Avoid possible undefined variable complaint with length function.
    modified:
      tools/debianqueued-0.9/debianqueued
    ------------------------------------------------------------
    revno: 1090.1.3
    committer: Stephen Gran <steve@lobefin.net>
    branch nick: ftpmaster-dak-mail
    timestamp: Sat 2008-05-10 15:40:26 +0100
    message:
      Update debian/control to reflect new perl dependency
    modified:
      ChangeLog
      debian/control
    ------------------------------------------------------------
    revno: 1090.1.4
    committer: Stephen Gran <steve@lobefin.net>
    branch nick: ftpmaster-dak-mail
    timestamp: Sat 2008-05-10 17:42:25 +0100
    message:
      Sigh, I should test a bit more thoroughly occasionally
    modified:
      tools/debianqueued-0.9/debianqueued
    ------------------------------------------------------------
    revno: 1090.1.5
    committer: Stephen Gran <steve@lobefin.net>
    branch nick: ftpmaster-dak-mail
    timestamp: Sat 2008-05-10 18:43:11 +0100
    message:
      Readd signature, and use tabs like the rest of the script
    modified:
      tools/debianqueued-0.9/debianqueued
    ------------------------------------------------------------
    revno: 1090.2.1
    committer: Joerg Jaspert <joerg@debian.org>
    branch nick: mailtags
    timestamp: Sat 2008-05-10 19:53:49 +0200
    message:
      Merge from sgran
    modified:
      ChangeLog
      debian/control
      tools/debianqueued-0.9/ChangeLog
      tools/debianqueued-0.9/debianqueued
=== modified file 'ChangeLog'
--- a/ChangeLog	2008-05-09 22:27:53 +0000
+++ b/ChangeLog	2008-05-10 14:40:26 +0000
@@ -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

=== modified file 'debian/control'
--- a/debian/control	2008-03-02 22:39:16 +0000
+++ b/debian/control	2008-05-10 14:40:26 +0000
@@ -7,7 +7,7 @@
 
 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

=== modified file 'tools/debianqueued-0.9/ChangeLog'
--- a/tools/debianqueued-0.9/ChangeLog	2008-05-07 22:43:45 +0000
+++ b/tools/debianqueued-0.9/ChangeLog	2008-05-10 14:25:31 +0000
@@ -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

=== modified file 'tools/debianqueued-0.9/debianqueued'
--- a/tools/debianqueued-0.9/debianqueued	2008-05-08 07:10:24 +0000
+++ b/tools/debianqueued-0.9/debianqueued	2008-05-10 17:43:11 +0000
@@ -281,6 +281,8 @@
 
 ($main::progname = $0) =~ s,.*/,,;
 
+my %packages = ();
+
 # extract -r and -k args
 $main::arg = "";
 if (@ARGV == 1 && $ARGV[0] =~ /^-[rk]$/) {
@@ -790,6 +792,7 @@
 		elsif (/^Source:\s*/i) {
 			chomp( $pkgname = $' );
 			$pkgname =~ s/\s+$//;
+                        $main::packages{$pkgname}++;
 		}
 		elsif (/^Files:/i) {
 			while( <CHANGES> ) {
@@ -2078,6 +2081,7 @@
 
 	$main::mail_addr = "";
 	$main::mail_text = "";
+        %main::packages  = ();
 	$main::mail_subject = $file ? "Processing of $file" : "";
 }
 
@@ -2120,18 +2124,35 @@
 	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;
-	}
-	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" );
-		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";
+	}
+
+	$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;
 }
 


Reply to: