Openembedded Core Discussions
 help / color / mirror / Atom feed
* [meta-oe][RFC PATCH v2] insane: Inappropriate patch reasoning
@ 2021-12-16 12:26 Konrad Weihmann
  2021-12-16 14:54 ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Konrad Weihmann @ 2021-12-16 12:26 UTC (permalink / raw)
  To: openembedded-core; +Cc: Konrad Weihmann

if a patch uses Upstream-Status: Inappropriate it should provide a machine
readable reasoning in square brackets.

According to latest wiki entry that would be

not author
native
licensing
configuration
enable feature
disable feature
bugfix .*
embedded specific
no upstream
other

a detailed reasoning could be provided as part of the commit message,
but format of the metadata line is fixed.

This patch adds a check to insane.bbclass and warns if there is a
non-compliant reasoning given, or none at all.

In a follow-up this should be turned into an error, as it was done
with missing Upstream-Status

Can be skipped with newly added patch-metadata key via INSANE_SKIP

Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
---
v2: add possibility to skip with patch-metadata in INSANE_SKIP

 meta/classes/insane.bbclass | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 240f3aad62..eae8e0e549 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -1124,6 +1124,8 @@ python do_qa_staging() {
 python do_qa_patch() {
     import subprocess
 
+    skip = (d.getVar('INSANE_SKIP') or "").split()
+
     ###########################################################################
     # Check patch.log for fuzz warnings
     #
@@ -1191,6 +1193,29 @@ python do_qa_patch() {
                bb.error("Malformed Upstream-Status in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_kinda.group(0)))
            else:
                bb.error("Missing Upstream-Status in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines))
+       
+       if 'patch-metadata' in skip:
+           continue
+       
+       inappr_message_re = r'Inappropriate(\s+\[(?P<reason>.*)\])*'
+       inappr_reasons = [
+            'not author',
+            'native',
+            'licensing',
+            'configuration',
+            'enable feature',
+            'disable feature',
+            'bugfix .*',
+            'embedded specific',
+            'no upstream',
+            'other',
+       ]
+       for match_inappr in re.finditer(inappr_message_re, content, re.IGNORECASE | re.MULTILINE):
+
+           if 'reason' not in match_inappr.groupdict():
+               bb.warning("Missing Upstream-Status: Inappropriate reasoning in patch\n%s\nPlease add according to %s ." % (fullpath, guidelines))
+           elif not any(re.match(x, match_inappr.groupdict().get('reason', '') or '') for x in inappr_reasons):
+               bb.warning("Malformed Upstream-Status: Inappropriate in patch\n%s\nPlease correct according to %s :\n%s" % (fullpath, guidelines, match_inappr.group(0)))
 }
 
 python do_qa_configure() {
-- 
2.25.1



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

end of thread, other threads:[~2021-12-16 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-16 12:26 [meta-oe][RFC PATCH v2] insane: Inappropriate patch reasoning Konrad Weihmann
2021-12-16 14:54 ` [OE-core] " Richard Purdie
2021-12-16 15:05   ` Konrad Weihmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox