On Sun, Dec 01, 2013 at 08:52:19PM -0500, James McCoy wrote:
> Please consider the attached patch.

Updated patch which also changes dak/process_policy.py.

I didn't touch daklib/changes.py's add_known_changes since it seemed
like the original data should be preserved in the db.  That may mean
other tools need to perform checks similar to what is being done in my
patch, though.

If eliding the comment in the db is appropriate, then would it be
simpler to just change the value of the urgency in daklib/upload.py's
Changes class?

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <james...@debian.org>
From 7d4dec85efd7d05bf114ab37a2b1fd2b09ee4527 Mon Sep 17 00:00:00 2001
From: James McCoy <james...@debian.org>
Date: Sun, 1 Dec 2013 20:29:15 -0500
Subject: [PATCH] dak/process_{upload,policy}.py: handle an urgency with a
 comment

Policy allows a changes file's urgency to have a trailing comment
(separated by a space).  If such a comment exists, the urgency needs to
be extracted so it is properly parsed.  This ensures the urgency is
propagated properly.

Signed-off-by: James McCoy <james...@debian.org>
---
 dak/process_policy.py | 4 ++++
 dak/process_upload.py | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/dak/process_policy.py b/dak/process_policy.py
index 7dd55a8..39fa62e 100755
--- a/dak/process_policy.py
+++ b/dak/process_policy.py
@@ -185,6 +185,10 @@ def comment_accept(upload, srcqueue, comments, transaction):
 
     if upload.source is not None and not Options['No-Action']:
         urgency = upload.changes.urgency
+        # As per policy 5.6.17, the urgency can be followed by a space and a
+        # comment.  Extract only the urgency from the string.
+        if ' ' in urgency:
+          (urgency, comment) = urgency.split(' ', 1)
         if urgency not in cnf.value_list('Urgency::Valid'):
             urgency = cnf['Urgency::Default']
         UrgencyLog().log(upload.source.source, upload.source.version, urgency)
diff --git a/dak/process_upload.py b/dak/process_upload.py
index 1518d26..797df4e 100755
--- a/dak/process_upload.py
+++ b/dak/process_upload.py
@@ -273,6 +273,10 @@ def accept(directory, upload):
     control = upload.changes.changes
     if sourceful_upload and not Options['No-Action']:
         urgency = control.get('Urgency')
+        # As per policy 5.6.17, the urgency can be followed by a space and a
+        # comment.  Extract only the urgency from the string.
+        if ' ' in urgency:
+          (urgency, comment) = urgency.split(' ', 1)
         if urgency not in cnf.value_list('Urgency::Valid'):
             urgency = cnf['Urgency::Default']
         UrgencyLog().log(control['Source'], control['Version'], urgency)
-- 
1.8.5.rc3

Attachment: signature.asc
Description: Digital signature

Reply via email to