]> git.decadent.org.uk Git - dak.git/commitdiff
indicate who rejected a package
authorAnsgar Burchardt <ansgar@debian.org>
Mon, 30 Jul 2012 13:43:21 +0000 (15:43 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Sat, 11 Aug 2012 11:43:18 +0000 (13:43 +0200)
Signed-off-by: Ansgar Burchardt <ansgar@debian.org>
dak/process_policy.py
daklib/policy.py

index 3945737f665cf44225f1b9433101f72ead410609..695751c457de1e2bf46684fb6381fb866ca22b48 100755 (executable)
@@ -33,6 +33,7 @@
 
 import os
 import datetime
+import re
 import sys
 import traceback
 import apt_pkg
@@ -232,6 +233,14 @@ def real_comment_reject(upload, srcqueue, comments, transaction, notify=True):
         subst = subst_for_upload(upload)
         subst['__MANUAL_REJECT_MESSAGE__'] = ''
         subst['__REJECT_MESSAGE__'] = comments
+
+        # Try to use From: from comment file if there is one.
+        # This is not very elegant...
+        match = re.match(r"\AFrom: ([^\n]+)\n\n", comments)
+        if match:
+            subst['__REJECTOR_ADDRESS__'] = match.group(1)
+            subst['__REJECT_MESSAGE__'] = '\n'.join(comments.splitlines()[2:])
+
         message = utils.TemplateSubst(subst, os.path.join(cnf['Dir::Templates'], 'queue.rejected'))
         utils.send_mail(message)
 
index 3a1cb32ca2ad0c7e4955549c6b8ea3c92ca9d84c..eef18a4f343f4bde8fe8f17bb1900d4b2d2893d0 100644 (file)
@@ -20,6 +20,7 @@ from .config import Config
 from .dbconn import BinaryMetadata, Component, MetadataKey, Override, OverrideType, get_mapped_component
 from .fstransactions import FilesystemTransaction
 from .regexes import re_file_changes, re_file_safe
+import daklib.utils as utils
 
 import errno
 import os
@@ -180,6 +181,8 @@ class PolicyQueueUploadHandler(object):
         @type  reason: str
         @param reason: reason for the rejection
         """
+        cnf = Config()
+
         fn1 = 'REJECT.{0}'.format(self._changes_prefix)
         assert re_file_safe.match(fn1)
 
@@ -187,6 +190,7 @@ class PolicyQueueUploadHandler(object):
         try:
             fh = os.open(fn, os.O_CREAT | os.O_EXCL | os.O_WRONLY)
             os.write(fh, 'NOTOK\n')
+            os.write(fh, 'From: {0} <{1}>\n\n'.format(utils.whoami(), cnf['Dinstall::MyAdminAddress']))
             os.write(fh, reason)
             os.close(fh)
         except OSError as e: