All of lore.kernel.org
 help / color / mirror / Atom feed
* [patchwork][PATCH] patchwork/bin/parsemail: Make "[PATCH" prefix mandatory
@ 2017-01-06 23:03 Jose Lamego
  2017-01-09 10:49 ` Patrick Ohly
  0 siblings, 1 reply; 4+ messages in thread
From: Jose Lamego @ 2017-01-06 23:03 UTC (permalink / raw)
  To: yocto

Patchwork may incorrectly identify emails containing patch-like content as
patches.
This change makes "[PATCH" prefix in subject mandatory for emails to be
considered as new patches.

[YOCTO #10764]

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

diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py
index 476118d..8d6529c 100755
--- a/patchwork/bin/parsemail.py
+++ b/patchwork/bin/parsemail.py
@@ -399,7 +399,8 @@ def find_content(project, mail):
     refs = build_references_list(mail)
     is_root = refs == []
     is_cover_letter = is_root and x == 0
-    is_patch = patchbuf is not None
+    patch_prefix = re.search('\[\s*PATCH', mail.get('Subject'))
+    is_patch = patchbuf is not None and patch_prefix
 
     drop_patch = not is_attachment and \
         project.git_send_email_only and not is_git_send_email(mail)
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patchwork][PATCH] patchwork/bin/parsemail: Make "[PATCH" prefix mandatory
  2017-01-06 23:03 [patchwork][PATCH] patchwork/bin/parsemail: Make "[PATCH" prefix mandatory Jose Lamego
@ 2017-01-09 10:49 ` Patrick Ohly
  2017-01-09 22:34   ` Jose Lamego
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Ohly @ 2017-01-09 10:49 UTC (permalink / raw)
  To: Jose Lamego; +Cc: yocto

On Fri, 2017-01-06 at 17:03 -0600, Jose Lamego wrote:
> Patchwork may incorrectly identify emails containing patch-like content as
> patches.
> This change makes "[PATCH" prefix in subject mandatory for emails to be
> considered as new patches.
> 
> [YOCTO #10764]
> 
> Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
> ---
>  patchwork/bin/parsemail.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py
> index 476118d..8d6529c 100755
> --- a/patchwork/bin/parsemail.py
> +++ b/patchwork/bin/parsemail.py
> @@ -399,7 +399,8 @@ def find_content(project, mail):
>      refs = build_references_list(mail)
>      is_root = refs == []
>      is_cover_letter = is_root and x == 0
> -    is_patch = patchbuf is not None
> +    patch_prefix = re.search('\[\s*PATCH', mail.get('Subject'))
> +    is_patch = patchbuf is not None and patch_prefix

This is indeed enough to weed out diffs that were inlined in normal
discussions (example from YOCTO #10764).

But we also have other examples and another bug (YOCTO #10877) where a
reply to a patch caused patchwork to create a new entry:

Subject: Re: [OE-core] [PATCH v2 1/2] grub_git: extend recipe for proper
target  deployment
...
Ping!

I'm wondering if we can address two bugs with the same fix, something
that requires that the Subject line is starting with a set of tags plus
the [PATCH] tag. For example:

patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject'))

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patchwork][PATCH] patchwork/bin/parsemail: Make "[PATCH" prefix mandatory
  2017-01-09 10:49 ` Patrick Ohly
@ 2017-01-09 22:34   ` Jose Lamego
  2017-01-11 17:01     ` [patchwork][PATCH] patchwork/bin/parsemail: Improve new patch filtering Jose Lamego
  0 siblings, 1 reply; 4+ messages in thread
From: Jose Lamego @ 2017-01-09 22:34 UTC (permalink / raw)
  To: yocto


[-- Attachment #1.1: Type: text/plain, Size: 1382 bytes --]



On 01/09/2017 04:49 AM, Patrick Ohly wrote:
>...
> 
> I'm wondering if we can address two bugs with the same fix, something
> that requires that the Subject line is starting with a set of tags plus
> the [PATCH] tag. For example:
> 
> patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject'))
> 

Based on Patrick's suggestion, v2 of this patch would require for any
new email message to be handled as a likely new patch (message content
still needs to be parsed as usual):

	- Message subject MUST start only with any of the accepted OE layer's
prefixes; in other words, subject must start with square bracket "["
plus prefix (maybe only the bracket will be enough).
and
	- Message subject MUST contain the "[PATCH" prefix.

messages with a subject that starts with any other character (including
"Re: " and "Fwd: " or that do not include the "[PATCH" prefix will be
handled either as a comment to an existing patch or as an ordinary
mailing list post, depending on the included email references and
content parsing.

I see no conflicts with steps on the wiki "How to submit a patch to
OpenEmbedded":
http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

Please provide feedback on this approach before I implement a test in
the staging instance.

-- 
Jose Lamego | OTC Embedded Platforms & Tools | GDC


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 501 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patchwork][PATCH] patchwork/bin/parsemail: Improve new patch filtering
  2017-01-09 22:34   ` Jose Lamego
@ 2017-01-11 17:01     ` Jose Lamego
  0 siblings, 0 replies; 4+ messages in thread
From: Jose Lamego @ 2017-01-11 17:01 UTC (permalink / raw)
  To: yocto; +Cc: Jose Lamego

From: Jose Lamego <jose.a.lamego@intel.com>

Patchwork may incorrectly identify emails containing patch-like content or
that are replies/forwards from a previous message as patches, thus wrongly
creating a new series revision.
This change makes "[PATCH" prefix in subject mandatory for emails to be
considered as possible new patches, and makes any email with a subject
starting with any character other than a square bracket ("[") to be handled
as a possible comment to an existing patch.

[YOCTO #10764]
[YOCTO #10877]

Signed-off-by: Jose Lamego <jose.a.lamego@intel.com>
---

Notes:
    v2 renamed to reflect that the subject filtering now includes ruling-out emails with a Subject header not starting with the expected square bracket

 patchwork/bin/parsemail.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py
index 1c2c774..94c7669 100755
--- a/patchwork/bin/parsemail.py
+++ b/patchwork/bin/parsemail.py
@@ -399,7 +399,8 @@ def find_content(project, mail):
     refs = build_references_list(mail)
     is_root = refs == []
     is_cover_letter = is_root and x == 0
-    is_patch = patchbuf is not None
+    patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject'))
+    is_patch = patchbuf is not None and patch_prefix
 
     drop_patch = not is_attachment and \
         project.git_send_email_only and not is_git_send_email(mail)
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-11 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-06 23:03 [patchwork][PATCH] patchwork/bin/parsemail: Make "[PATCH" prefix mandatory Jose Lamego
2017-01-09 10:49 ` Patrick Ohly
2017-01-09 22:34   ` Jose Lamego
2017-01-11 17:01     ` [patchwork][PATCH] patchwork/bin/parsemail: Improve new patch filtering Jose Lamego

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.