I've attached patches to fix both of these bugs.

Patch 1 stops apt-listchanges from throwing an exception when
/usr/sbin/sendmail doesn't exist.  This allows the default
apt-listchanges configuration to work on a system that does not have an
MTA installed.

Patch 2 moves "exim4 | mail-transport-agent" from Recommends to
Suggests, since apt-listchanges now works just fine without an MTA.

Patch 3 changes "exim4" to "default-mta" in Suggests.

For convenience, I included updates to debian/changelog in these
patches.  This will introduce conflicts with any new debian/changelog
entries added before applying these patches, but those conflicts should
prove trivial to resolve.

Thanks,
Josh Triplett
>From d6bcd5ae0ac07519984f9e02ddc79a3df5632d2b Mon Sep 17 00:00:00 2001
From: Josh Triplett <j...@joshtriplett.org>
Date: Sat, 28 Apr 2012 15:27:28 -0700
Subject: [PATCH 1/3] Avoid throwing an exception when sendmail does not
 exist. (Closes: 666086)

---
 apt-listchanges.py |   13 +++++++------
 debian/changelog   |    7 +++++++
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/apt-listchanges.py b/apt-listchanges.py
index e8a195f..ad9ec9e 100755
--- a/apt-listchanges.py
+++ b/apt-listchanges.py
@@ -212,13 +212,14 @@ def main():
 
         hostname = commands.getoutput('hostname')
 
-        if config.email_address and changes:
-            subject = _("apt-listchanges: changelogs for %s") % hostname
-            apt_listchanges.mail_changes(config.email_address, changes, subject)
+        if config.email_address and os.path.exists("/usr/sbin/sendmail"):
+            if changes:
+                subject = _("apt-listchanges: changelogs for %s") % hostname
+                apt_listchanges.mail_changes(config.email_address, changes, subject)
 
-        if config.email_address and news:
-            subject = _("apt-listchanges: news for %s") % hostname
-            apt_listchanges.mail_changes(config.email_address, news, subject)
+            if news:
+                subject = _("apt-listchanges: news for %s") % hostname
+                apt_listchanges.mail_changes(config.email_address, news, subject)
 
         # Write out seen db
         if config.save_seen:
diff --git a/debian/changelog b/debian/changelog
index 21b4bff..eff252a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+apt-listchanges (2.85.10) UNRELEASED; urgency=low
+
+  [ Josh Triplett ]
+  * Avoid throwing an exception when sendmail does not exist. (Closes: 666086)
+
+ -- Sandro Tosi <mo...@debian.org>  Sat, 28 Apr 2012 14:58:35 -0700
+
 apt-listchanges (2.85.9) unstable; urgency=low
 
   * Add helpful message to exit from less; thanks to Stuart Prescott for report
-- 
1.7.10

>From 487d89ae4f50d12c23fd931b90567c8e197cc38c Mon Sep 17 00:00:00 2001
From: Josh Triplett <j...@joshtriplett.org>
Date: Sat, 28 Apr 2012 15:30:25 -0700
Subject: [PATCH 2/3] Move mail-transport-agent from Recommends to Suggests.
 (Closes: 599667)

---
 debian/changelog |    1 +
 debian/control   |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index eff252a..b1e955a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ apt-listchanges (2.85.10) UNRELEASED; urgency=low
 
   [ Josh Triplett ]
   * Avoid throwing an exception when sendmail does not exist. (Closes: 666086)
+  * Move mail-transport-agent from Recommends to Suggests. (Closes: 599667)
 
  -- Sandro Tosi <mo...@debian.org>  Sat, 28 Apr 2012 14:58:35 -0700
 
diff --git a/debian/control b/debian/control
index a8c4854..4c33361 100644
--- a/debian/control
+++ b/debian/control
@@ -14,8 +14,8 @@ Package: apt-listchanges
 Architecture: all
 Depends: ${python:Depends}, apt (>= 0.5.3), python-apt (>= 0.7.93),
  ucf (>= 0.28), debianutils (>= 2.0.2), ${misc:Depends}
-Recommends: exim4 | mail-transport-agent
-Suggests: x-terminal-emulator, www-browser, python-glade2, python-gtk2
+Suggests: x-terminal-emulator, www-browser, python-glade2, python-gtk2,
+ exim4 | mail-transport-agent
 Description: package change history notification tool
  The tool apt-listchanges can compare a new version of a
  package with the one currently installed and show what has been
-- 
1.7.10

>From 7b0d8b96d6923f353a724ffad451d2a4013cbfad Mon Sep 17 00:00:00 2001
From: Josh Triplett <j...@joshtriplett.org>
Date: Sat, 28 Apr 2012 15:31:36 -0700
Subject: [PATCH 3/3] Change exim4 to default-mta in Suggests.

---
 debian/changelog |    1 +
 debian/control   |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index b1e955a..e2f6b9c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ apt-listchanges (2.85.10) UNRELEASED; urgency=low
   [ Josh Triplett ]
   * Avoid throwing an exception when sendmail does not exist. (Closes: 666086)
   * Move mail-transport-agent from Recommends to Suggests. (Closes: 599667)
+  * Change exim4 to default-mta in Suggests.
 
  -- Sandro Tosi <mo...@debian.org>  Sat, 28 Apr 2012 14:58:35 -0700
 
diff --git a/debian/control b/debian/control
index 4c33361..84131de 100644
--- a/debian/control
+++ b/debian/control
@@ -15,7 +15,7 @@ Architecture: all
 Depends: ${python:Depends}, apt (>= 0.5.3), python-apt (>= 0.7.93),
  ucf (>= 0.28), debianutils (>= 2.0.2), ${misc:Depends}
 Suggests: x-terminal-emulator, www-browser, python-glade2, python-gtk2,
- exim4 | mail-transport-agent
+ default-mta | mail-transport-agent
 Description: package change history notification tool
  The tool apt-listchanges can compare a new version of a
  package with the one currently installed and show what has been
-- 
1.7.10

Reply via email to