Hi,

On Wed, 31 Dec 2014 16:13:55 +0100 Johannes Schauer <j.scha...@email.de> wrote:
> firstly, libsbuild-perl currently has a hard dependency on "exim |
> mail-transport-agent" even though it runs just fine without a sendmail binary
> being installed. Looking through the code, none of the calls to functions
> that end up invoking sendmail (send_mail, ll_send_mail and send_build_log)
> check for successful completion. Thus, sbuild runs fine without "exim |
> mail-transport-agent", just with reduced functionality.  Additionally,
> sending reports by email is hardly useful when not running as a buildd.
> Furthermore, mail transport agents will start a service in the background
> which has to be manually disabled. It would be great if sbuild could be
> installed without having to either run a new service in the background or
> having to disable it (which one might forget). It would thus be great if this
> Depends could be made a Recommends.

the patch needs a small addition to work in practice. Please find it attached.

cheers, josch
From aff4de41cb7e7a143287e4e94744f8137eda0fa1 Mon Sep 17 00:00:00 2001
From: Johannes 'josch' Schauer <jo...@mister-muffin.de>
Date: Sat, 11 Jul 2015 08:54:56 +0200
Subject: [PATCH] sbuild-perl: demote Depends: exim | mail-transport-agend to
 Recommends

---
 debian/changelog       |  8 ++++++++
 debian/control         |  3 ++-
 lib/Sbuild/ConfBase.pm | 11 ++++++++++-
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a49f5c2..b95047c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+sbuild (0.65.2-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * sbuild-perl: demote Depends: exim | mail-transport-agend to Recommends
+    (Closes: #774310)
+
+ -- Johannes Schauer <jo...@debian.org>  Sat, 11 Jul 2015 08:53:06 +0200
+
 sbuild (0.65.2-1) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/control b/debian/control
index b2d2e2e..c025c9b 100644
--- a/debian/control
+++ b/debian/control
@@ -27,7 +27,6 @@ Depends: adduser,
          dctrl-tools,
          devscripts (>= 2.10.26),
          dpkg-dev,
-         exim4 | mail-transport-agent,
          libdpkg-perl (>= 1.17.2),
          libexception-class-perl,
          libfilesys-df-perl,
@@ -36,6 +35,8 @@ Depends: adduser,
          schroot (>= 1.6.0),
          ${misc:Depends},
          ${perl:Depends}
+Recommends:
+         exim4 | mail-transport-agent,
 Replaces: sbuild (<= 0.58.4-1)
 Description: Tool for building Debian binary packages from Debian sources
  The sbuild suite of programs (wanna-build, buildd and sbuild) are
diff --git a/lib/Sbuild/ConfBase.pm b/lib/Sbuild/ConfBase.pm
index 47441e1..d7640ba 100644
--- a/lib/Sbuild/ConfBase.pm
+++ b/lib/Sbuild/ConfBase.pm
@@ -143,7 +143,16 @@ sub init_allowed_keys {
 	    TYPE => 'STRING',
 	    VARNAME => 'mailprog',
 	    GROUP => 'Programs',
-	    CHECK => $validate_program,
+	    CHECK => sub {
+		my $conf = shift;
+		my $entry = shift;
+		my $key = $entry->{'NAME'};
+
+		# Only validate if needed.
+		if ($conf->get('MAILTO')) {
+		    $validate_program->($conf, $entry);
+		}
+	    },
 	    DEFAULT => '/usr/sbin/sendmail',
 	    HELP => 'Program to use to send mail'
 	},
-- 
2.1.4

Attachment: signature.asc
Description: signature

Reply via email to