]> err.no Git - dak/commitdiff
centralise No-Mail handling
authorMark Hymers <mhy@debian.org>
Sat, 5 Dec 2009 14:22:08 +0000 (14:22 +0000)
committerMark Hymers <mhy@debian.org>
Sat, 5 Dec 2009 14:22:08 +0000 (14:22 +0000)
Signed-off-by: Mark Hymers <mhy@debian.org>
dak/process_new.py
daklib/queue.py
daklib/queue_install.py
daklib/utils.py

index 17cf4e8f0bd1ac810fbb392abe7a6fff5f223b71..5a88ffcfab435fd1bb281b0e3d625044870caf16 100755 (executable)
@@ -493,9 +493,8 @@ def prod_maintainer (note, upload):
     prod_mail_message = utils.TemplateSubst(
         Subst,cnf["Dir::Templates"]+"/process-new.prod")
 
-    # Send the prod mail if appropriate
-    if not cnf["Dinstall::Options::No-Mail"]:
-        utils.send_mail(prod_mail_message)
+    # Send the prod mail
+    utils.send_mail(prod_mail_message)
 
     print "Sent proding message"
 
@@ -846,9 +845,6 @@ def main():
         sys.stderr.write("Sorting changes...\n")
     changes_files = sort_changes(changes_files, session)
 
-    # Kill me now? **FIXME**
-    cnf["Dinstall::Options::No-Mail"] = ""
-
     for changes_file in changes_files:
         changes_file = utils.validate_changes_file_arg(changes_file, 0)
         if not changes_file:
index 9a238bb3a13e1d01858da43ac6e8a5fcffdc63d1..a01a1e5ba620eea7c888fde260535924308e5228 100755 (executable)
@@ -1927,16 +1927,13 @@ distribution."""
         if self.pkg.changes["architecture"].has_key("source") and cnf.get("Dir::UrgencyLog"):
             UrgencyLog().log(self.pkg.dsc["source"], self.pkg.dsc["version"], self.pkg.changes["urgency"])
 
-        # Send accept mail, announce to lists, close bugs and check for
-        # override disparities
-        if not cnf["Dinstall::Options::No-Mail"]:
-            self.update_subst()
-            self.Subst["__SUITE__"] = ""
-            self.Subst["__SUMMARY__"] = summary
-            mail_message = utils.TemplateSubst(self.Subst,
-                                               os.path.join(cnf["Dir::Templates"], 'process-unchecked.accepted'))
-            utils.send_mail(mail_message)
-            self.announce(short_summary, 1)
+        self.update_subst()
+        self.Subst["__SUITE__"] = ""
+        self.Subst["__SUMMARY__"] = summary
+        mail_message = utils.TemplateSubst(self.Subst,
+                                           os.path.join(cnf["Dir::Templates"], 'process-unchecked.accepted'))
+        utils.send_mail(mail_message)
+        self.announce(short_summary, 1)
 
         ## Helper stuff for DebBugs Version Tracking
         if cnf.Find("Dir::Queue::BTSVersionTrack"):
@@ -1998,11 +1995,8 @@ distribution."""
 
         cnf = Config()
 
-        # Abandon the check if:
-        #  a) override disparity checks have been disabled
-        #  b) we're not sending mail
-        if not cnf.FindB("Dinstall::OverrideDisparityCheck") or \
-           cnf["Dinstall::Options::No-Mail"]:
+        # Abandon the check if override disparity checks have been disabled
+        if not cnf.FindB("Dinstall::OverrideDisparityCheck"):
             return
 
         summary = self.pkg.check_override()
@@ -2192,9 +2186,8 @@ distribution."""
 
         os.close(reason_fd)
 
-        # Send the rejection mail if appropriate
-        if not cnf["Dinstall::Options::No-Mail"]:
-            utils.send_mail(reject_mail_message)
+        # Send the rejection mail
+        utils.send_mail(reject_mail_message)
 
         if self.logger:
             self.logger.log(["rejected", self.pkg.changes_file])
index 3283e1eff7591bb6ccfcd058b005198f82d9cca4..912fdcbb6c6862ccded879592e4cf1a262dcfc9f 100644 (file)
@@ -69,13 +69,12 @@ def package_to_queue(u, summary, short_summary, queue, chg, session, announce=No
     u.check_override()
 
     # Send accept mail, announce to lists and close bugs
-    if announce and not cnf["Dinstall::Options::No-Mail"]:
-        template = os.path.join(cnf["Dir::Templates"], announce)
-        u.update_subst()
-        u.Subst["__SUITE__"] = ""
-        mail_message = utils.TemplateSubst(u.Subst, template)
-        utils.send_mail(mail_message)
-        u.announce(short_summary, True)
+    template = os.path.join(cnf["Dir::Templates"], announce)
+    u.update_subst()
+    u.Subst["__SUITE__"] = ""
+    mail_message = utils.TemplateSubst(u.Subst, template)
+    utils.send_mail(mail_message)
+    u.announce(short_summary, True)
 
 ################################################################################
 
@@ -233,13 +232,12 @@ def acknowledge_new(u, summary, short_summary, chg, session):
     session.add(chg)
     session.commit()
 
-    if not cnf["Dinstall::Options::No-Mail"]:
-        print "Sending new ack."
-        template = os.path.join(cnf["Dir::Templates"], 'process-unchecked.new')
-        u.update_subst()
-        u.Subst["__SUMMARY__"] = summary
-        new_ack_message = utils.TemplateSubst(u.Subst, template)
-        utils.send_mail(new_ack_message)
+    print "Sending new ack."
+    template = os.path.join(cnf["Dir::Templates"], 'process-unchecked.new')
+    u.update_subst()
+    u.Subst["__SUMMARY__"] = summary
+    new_ack_message = utils.TemplateSubst(u.Subst, template)
+    utils.send_mail(new_ack_message)
 
 ################################################################################
 
index e745e1eb6a87b9096e4816ae8dd4e40446630810..9c008b19e7305b7ada50b538de36644187aa2f34 100644 (file)
@@ -572,6 +572,10 @@ def build_file_list(changes, is_a_dsc=0, field="files", hashname="md5sum"):
 def send_mail (message, filename=""):
     """sendmail wrapper, takes _either_ a message string or a file as arguments"""
 
+    # Check whether we're supposed to be sending mail
+    if Cnf.has_key("Dinstall::Options::No-Mail") and Cnf["Dinstall::Options::No-Mail"]:
+        return
+
     # If we've been passed a string dump it into a temporary file
     if message:
         (fd, filename) = tempfile.mkstemp()