Jason Lowe-Power has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/37220 )

Change subject: util: Use MAINTAINERS.yaml for valid tags in git hook
......................................................................

util: Use MAINTAINERS.yaml for valid tags in git hook

There is a mismatch between the tags in MAINTAINERS.yaml and the
valid_tags in the git hook. This means if a user consults the
MAINTAINERS.yaml file to find the appropriate tag, there is a chance of
the commit being rejected due to this mismatch. Now that the maintainers
file is in yaml format, use the util/maint library to parse the valid
tag options. Additional meta tags are added (WIP, RFC) and tags that
were previously valid but not in the MAINTAINERS.yaml file.

Change-Id: I3de8f0b6f8507aa1afd2118bc4373ac0610cce40
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/37220
Reviewed-by: Andreas Sandberg <andreas.sandb...@arm.com>
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Reviewed-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Reviewed-by: Nikos Nikoleris <nikos.nikole...@arm.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M util/git-commit-msg.py
A util/maint/__init__.py
2 files changed, 10 insertions(+), 13 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  Andreas Sandberg: Looks good to me, approved
  Nikos Nikoleris: Looks good to me, approved
  Giacomo Travaglini: Looks good to me, but someone else must approve
  Daniel Carvalho: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/util/git-commit-msg.py b/util/git-commit-msg.py
index 9cba896..2bddf12 100755
--- a/util/git-commit-msg.py
+++ b/util/git-commit-msg.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Copyright (c) 2019 Inria
 # All rights reserved
@@ -32,6 +32,7 @@
 import os
 import re
 import sys
+from maint.lib import maintainers

 from style.repo import GitRepo

@@ -57,8 +58,8 @@

     print("""
 The first line of a commit must contain one or more gem5 tags separated by
-commas (see MAINTAINERS for the possible tags), followed by a colon and a
-commit title. There must be no leading nor trailing whitespaces.
+commas (see MAINTAINERS.yaml for the possible tags), followed by a colon and
+a commit title. There must be no leading nor trailing whitespaces.

This header line must then be followed by an empty line. A detailed message, although highly recommended, is not mandatory and can follow that empty line.
@@ -85,17 +86,12 @@
     """

     # List of valid tags
-    # @todo this is error prone, and should be extracted automatically from
-    #       a file
+    maintainer_dict = maintainers.Maintainers.from_file()
+    valid_tags = [tag for tag, _ in maintainer_dict]

-    valid_tags = ["arch", "arch-arm", "arch-gcn3",
-        "arch-mips", "arch-power", "arch-riscv", "arch-sparc", "arch-x86",
-        "base", "configs", "cpu", "cpu-kvm", "cpu-minor", "cpu-o3",
-        "cpu-simple", "dev", "dev-arm", "dev-hsa", "dev-virtio", "ext",
-        "fastmodel", "gpu-compute", "learning-gem5", "mem", "mem-cache",
-        "mem-garnet", "mem-ruby", "misc", "python", "scons", "sim", "sim-se",
-        "sim-power", "stats", "system", "system-arm", "systemc", "tests",
-        "util", "RFC", "WIP"]
+    # Remove non-tag 'pmc' and add special tags not in MAINTAINERS.yaml
+    valid_tags.remove('pmc')
+    valid_tags.extend(['RFC', 'WIP'])

     tags = ''.join(commit_header.split(':')[0].split()).split(',')
     if (any(tag not in valid_tags for tag in tags)):
diff --git a/util/maint/__init__.py b/util/maint/__init__.py
new file mode 100644
index 0000000..e5a0d9b
--- /dev/null
+++ b/util/maint/__init__.py
@@ -0,0 +1 @@
+#!/usr/bin/env python3

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37220
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I3de8f0b6f8507aa1afd2118bc4373ac0610cce40
Gerrit-Change-Number: 37220
Gerrit-PatchSet: 3
Gerrit-Owner: Matthew Poremba <matthew.pore...@amd.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Boris Shingarov <shinga...@gmail.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to