[dak/master] 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 <jamessan@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 d44f6b79..59c311ea 100755
--- a/dak/process_policy.py
+++ b/dak/process_policy.py
@@ -256,6 +256,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 4c75e9d8..55cd729c 100755
--- a/dak/process_upload.py
+++ b/dak/process_upload.py
@@ -274,6 +274,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)
--
2.11.0
Reply to: