* [PATCH 1/2] patchreview: various fixes
@ 2018-12-03 10:26 Ross Burton
2018-12-03 10:26 ` [PATCH 2/2] mdadm: add back lost Upstream-Status tags Ross Burton
0 siblings, 1 reply; 2+ messages in thread
From: Ross Burton @ 2018-12-03 10:26 UTC (permalink / raw)
To: openembedded-core
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
scripts/contrib/patchreview.py | 46 ++++++++++++++++++++++++++++++++----------
1 file changed, 35 insertions(+), 11 deletions(-)
diff --git a/scripts/contrib/patchreview.py b/scripts/contrib/patchreview.py
index a4d5ba68676..072166504da 100755
--- a/scripts/contrib/patchreview.py
+++ b/scripts/contrib/patchreview.py
@@ -5,6 +5,7 @@
# - test suite
# - validate signed-off-by
+status_values = ("accepted", "pending", "inappropriate", "backport", "submitted", "denied")
class Result:
# Whether the patch has an Upstream-Status or not
@@ -35,25 +36,26 @@ def blame_patch(patch):
"--format=%s (%aN <%aE>)",
"--", patch)).decode("utf-8").splitlines()
-def patchreview(patches):
- import re
+def patchreview(path, patches):
+ import re, os.path
# General pattern: start of line, optional whitespace, tag with optional
# hyphen or spaces, maybe a colon, some whitespace, then the value, all case
# insensitive.
sob_re = re.compile(r"^[\t ]*(Signed[-_ ]off[-_ ]by:?)[\t ]*(.+)", re.IGNORECASE | re.MULTILINE)
status_re = re.compile(r"^[\t ]*(Upstream[-_ ]Status:?)[\t ]*(\w*)", re.IGNORECASE | re.MULTILINE)
- status_values = ("accepted", "pending", "inappropriate", "backport", "submitted", "denied")
cve_tag_re = re.compile(r"^[\t ]*(CVE:)[\t ]*(.*)", re.IGNORECASE | re.MULTILINE)
cve_re = re.compile(r"cve-[0-9]{4}-[0-9]{4,6}", re.IGNORECASE)
results = {}
for patch in patches:
+
+ fullpath = os.path.join(path, patch)
result = Result()
- results[patch] = result
+ results[fullpath] = result
- content = open(patch, encoding='ascii', errors='ignore').read()
+ content = open(fullpath, encoding='ascii', errors='ignore').read()
# Find the Signed-off-by tag
match = sob_re.search(content)
@@ -122,6 +124,8 @@ def analyse(results, want_blame=False, verbose=True):
missing_status += 1
if r.malformed_upstream_status or r.unknown_upstream_status:
malformed_status += 1
+ # Count patches with no status as pending
+ pending_patches +=1
if r.missing_cve:
missing_cve += 1
if r.upstream_status == "pending":
@@ -132,7 +136,6 @@ def analyse(results, want_blame=False, verbose=True):
need_blame = True
if verbose:
print("Missing Signed-off-by tag (%s)" % patch)
-
if r.malformed_sob:
need_blame = True
if verbose:
@@ -198,14 +201,35 @@ if __name__ == "__main__":
args.add_argument("-b", "--blame", action="store_true", help="show blame for malformed patches")
args.add_argument("-v", "--verbose", action="store_true", help="show per-patch results")
args.add_argument("-g", "--histogram", action="store_true", help="show patch histogram")
- args.add_argument("directory", nargs="?", help="directory to scan")
+ args.add_argument("-j", "--json", help="update JSON")
+ args.add_argument("directory", help="directory to scan")
args = args.parse_args()
- if args.directory:
- os.chdir(args.directory)
- patches = subprocess.check_output(("git", "ls-files", "recipes-*/**/*.patch", "recipes-*/**/*.diff")).decode("utf-8").split()
- results = patchreview(patches)
+ patches = subprocess.check_output(("git", "-C", args.directory, "ls-files", "recipes-*/**/*.patch", "recipes-*/**/*.diff")).decode("utf-8").split()
+ results = patchreview(args.directory, patches)
analyse(results, want_blame=args.blame, verbose=args.verbose)
+
+ if args.json:
+ import json, os.path, collections
+ if os.path.isfile(args.json):
+ data = json.load(open(args.json))
+ else:
+ data = []
+
+ row = collections.Counter()
+ row["total"] = len(results)
+ row["date"] = subprocess.check_output(["git", "-C", args.directory, "show", "-s", "--pretty=format:%cd", "--date=format:%s"]).decode("utf-8").strip()
+ for r in results.values():
+ if r.upstream_status in status_values:
+ row[r.upstream_status] += 1
+ if r.malformed_upstream_status or r.missing_upstream_status:
+ row['malformed-upstream-status'] += 1
+ if r.malformed_sob or r.missing_sob:
+ row['malformed-sob'] += 1
+
+ data.append(row)
+ json.dump(data, open(args.json, "w"))
+
if args.histogram:
print()
histogram(results)
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] mdadm: add back lost Upstream-Status tags
2018-12-03 10:26 [PATCH 1/2] patchreview: various fixes Ross Burton
@ 2018-12-03 10:26 ` Ross Burton
0 siblings, 0 replies; 2+ messages in thread
From: Ross Burton @ 2018-12-03 10:26 UTC (permalink / raw)
To: openembedded-core
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
.../0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch | 2 +-
.../files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch | 2 +-
.../mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch | 2 +-
| 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-extended/mdadm/files/0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch b/meta/recipes-extended/mdadm/files/0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch
index 72368cb17b1..12bf6a59207 100644
--- a/meta/recipes-extended/mdadm/files/0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch
+++ b/meta/recipes-extended/mdadm/files/0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch
@@ -8,7 +8,7 @@ its possible that build host gcc is version 7+ but the
cross compile used for compiling mdadm is < version 7
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
+Upstream-Status: Pending
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch b/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch
index bdedbb2d984..6293f9b2b37 100644
--- a/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch
+++ b/meta/recipes-extended/mdadm/files/0001-include-sys-sysmacros.h-for-major-minor-defintions.patch
@@ -25,7 +25,7 @@ Fixes
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
+Upstream-Status: Pending
---
mdadm.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/recipes-extended/mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch b/meta/recipes-extended/mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch
index e10905c63b5..a1e7e59323b 100644
--- a/meta/recipes-extended/mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch
+++ b/meta/recipes-extended/mdadm/files/0001-mdadm.h-Undefine-dprintf-before-redefining.patch
@@ -14,7 +14,7 @@ In file included from policy.c:25:
/mnt/oe/openembedded-core/build/tmp-glibc/sysroots/qemux86/usr/include/bits/stdio2.h:145:12: note: previous definition is here
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
+Upstream-Status: Pending
---
mdadm.h | 2 ++
1 file changed, 2 insertions(+)
--git a/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch b/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch
index d279fddfb6a..0bd556d4372 100644
--- a/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch
+++ b/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch
@@ -10,7 +10,7 @@ compiler warnings
This works in cross and native compilation case
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
+Upstream-Status: Submitted
---
Grow.c | 4 ++++
bitmap.c | 8 ++++++++
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-03 10:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-03 10:26 [PATCH 1/2] patchreview: various fixes Ross Burton
2018-12-03 10:26 ` [PATCH 2/2] mdadm: add back lost Upstream-Status tags Ross Burton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox