[yocto] [patchwork][PATCH] parsemail.py: Improve clean_subject function

Jose Lamego jose.a.lamego at linux.intel.com
Tue Apr 4 10:09:11 PDT 2017


PATCH prefix is not appropriately identified as such if it is not
sepparated from following word in an email Subject line. This leads to
wrong patch naming.

This change allows for appropriate patch naming by checking during
clean_subject function if "PATCH" prefix in Subject line is not
sepparated from following word and adding a space between them.

Signed-off-by: Jose Lamego <jose.a.lamego at linux.intel.com>
---
 patchwork/bin/parsemail.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py
index 3c3046d..2f5aecb 100755
--- a/patchwork/bin/parsemail.py
+++ b/patchwork/bin/parsemail.py
@@ -633,6 +633,12 @@ def clean_subject(subject, drop_prefixes=None):
     in the subject. If drop_prefixes is provided, remove those too,
     comparing case-insensitively."""
 
+    # Check if PATCH prefix is followed by anoter word without a sepparation
+    # space. Add missing space to allow appropriate parsing
+    if patch_pref.match(subject):
+        index = subject.find(patch_pref.match(subject).group(1))
+        subject = subject[:index + 5] + ' ' + subject[index + 5:]
+
     subject = clean_header(subject)
 
     if drop_prefixes is None:
-- 
2.7.4




More information about the yocto mailing list