]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/queue.py
include override information in accepted mails
[dak.git] / daklib / queue.py
index 72d226ad21923fdffdd44fe07b0523b27505b5cb..ea8f676aa66ea9e68003be4e9f3481835ecdc487 100644 (file)
@@ -19,7 +19,7 @@
 
 ###############################################################################
 
-import cPickle, errno, os, pg, re, stat, string, sys, time
+import cPickle, errno, os, pg, re, stat, sys, time
 import apt_inst, apt_pkg
 import utils, database
 
@@ -31,6 +31,7 @@ re_isanum = re.compile (r"^\d+$")
 re_default_answer = re.compile(r"\[(.*)\]")
 re_fdnic = re.compile(r"\n\n")
 re_bin_only_nmu = re.compile(r"\+b\d+$")
+
 ###############################################################################
 
 # Convenience wrapper to carry around all the package information in
@@ -174,7 +175,7 @@ class Upload:
                    "closes", "changes" ]:
             d_changes[i] = changes[i]
         # Optional changes fields
-        for i in [ "changed-by", "filecontents", "format", "process-new note", "distribution-version" ]:
+        for i in [ "changed-by", "filecontents", "format", "process-new note", "adv id", "distribution-version" ]:
             if changes.has_key(i):
                 d_changes[i] = changes[i]
         ## dsc
@@ -251,6 +252,7 @@ class Upload:
         if not changes.has_key("distribution") or not isinstance(changes["distribution"], DictType):
             changes["distribution"] = {}
 
+        override_summary ="";
         file_keys = files.keys()
         file_keys.sort()
         for file in file_keys:
@@ -270,6 +272,8 @@ class Upload:
                 files[file]["pool name"] = utils.poolify (changes.get("source",""), files[file]["component"])
                 destination = self.Cnf["Dir::PoolRoot"] + files[file]["pool name"] + file
                 summary += file + "\n  to " + destination + "\n"
+                if files[file]["type"] in ["deb", "udeb", "dsc"]:
+                    override_summary += "%s - %s %s\n" % (file, files[file]["priority"], files[file]["section"])
 
         short_summary = summary
 
@@ -279,6 +283,8 @@ class Upload:
         if byhand or new:
             summary += "Changes: " + f
 
+        summary += "\n\nOverride entries for your package:\n" + override_summary + "\n"
+
         summary += self.announce(short_summary, 0)
 
         return (summary, short_summary)
@@ -644,9 +650,9 @@ distribution."""
         if not manual:
             Subst["__REJECTOR_ADDRESS__"] = Cnf["Dinstall::MyEmailAddress"]
             Subst["__MANUAL_REJECT_MESSAGE__"] = ""
-            Subst["__CC__"] = "X-DAK-Rejection: automatic (moo)"
+            Subst["__CC__"] = "X-DAK-Rejection: automatic (moo)\nX-Katie-Rejection: automatic (moo)"
             os.write(reason_fd, reject_message)
-            reject_mail_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/dak.rejected")
+            reject_mail_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/queue.rejected")
         else:
             # Build up the rejection email
             user_email_address = utils.whoami() + " <%s>" % (Cnf["Dinstall::MyAdminAddress"])
@@ -654,7 +660,7 @@ distribution."""
             Subst["__REJECTOR_ADDRESS__"] = user_email_address
             Subst["__MANUAL_REJECT_MESSAGE__"] = reject_message
             Subst["__CC__"] = "Cc: " + Cnf["Dinstall::MyEmailAddress"]
-            reject_mail_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/dak.rejected")
+            reject_mail_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/queue.rejected")
             # Write the rejection email out as the <foo>.reason file
             os.write(reason_fd, reject_mail_message)
 
@@ -695,11 +701,11 @@ distribution."""
                        if x[1] in s and x[0] not in s:
                                s.append(x[0])
 
-               que = "SELECT s.version FROM source s JOIN src_associations sa ON (s.id = sa.source) JOIN suite su ON (sa.suite = su.id) WHERE s.source = '%s' AND (%s)" % (package, string.join(["su.suite_name = '%s'" % a for a in s], " OR "))
+               que = "SELECT s.version FROM source s JOIN src_associations sa ON (s.id = sa.source) JOIN suite su ON (sa.suite = su.id) WHERE s.source = '%s' AND (%s)" % (package, " OR ".join(["su.suite_name = '%s'" % a for a in s]))
             q = self.projectB.query(que)
 
             # Reduce the query results to a list of version numbers
-            ql = map(lambda x: x[0], q.getresult())
+            ql = [ i[0] for i in q.getresult() ]
 
             # Try (1)
             if source_version in ql:
@@ -774,7 +780,7 @@ distribution."""
         anyversion=None
         anysuite = [suite] + self.Cnf.ValueList("Suite::%s::VersionChecks::Enhances" % (suite))
         for (v, s) in query_result:
-            if s in [ string.lower(x) for x in anysuite ]:
+            if s in [ x.lower() for x in anysuite ]:
                 if not anyversion or apt_pkg.VersionCompare(anyversion, v) <= 0:
                     anyversion=v
         return anyversion
@@ -788,8 +794,8 @@ distribution."""
 
         # Check versions for each target suite
         for target_suite in self.pkg.changes["distribution"].keys():
-            must_be_newer_than = map(string.lower, self.Cnf.ValueList("Suite::%s::VersionChecks::MustBeNewerThan" % (target_suite)))
-            must_be_older_than = map(string.lower, self.Cnf.ValueList("Suite::%s::VersionChecks::MustBeOlderThan" % (target_suite)))
+            must_be_newer_than = [ i.lower for i in self.Cnf.ValueList("Suite::%s::VersionChecks::MustBeNewerThan" % (target_suite)) ]
+            must_be_older_than = [ i.lower for i in self.Cnf.ValueList("Suite::%s::VersionChecks::MustBeOlderThan" % (target_suite)) ]
             # Enforce "must be newer than target suite" even if conffile omits it
             if target_suite not in must_be_newer_than:
                 must_be_newer_than.append(target_suite)