Matthew Poremba has uploaded this change for review. ( 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 that to parse the valid tag options. Some
additional special tags are added (WIP, RFC) and tags that were
previously valid but not in the MAINTAINERS.yaml file.

Change-Id: I3de8f0b6f8507aa1afd2118bc4373ac0610cce40
---
M util/git-commit-msg.py
1 file changed, 8 insertions(+), 12 deletions(-)



diff --git a/util/git-commit-msg.py b/util/git-commit-msg.py
index 9cba896..de23691 100755
--- a/util/git-commit-msg.py
+++ b/util/git-commit-msg.py
@@ -32,6 +32,7 @@
 import os
 import re
 import sys
+import yaml

 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
+    with open(r'MAINTAINERS.yaml') as maint_file:
+        valid_tags = [key for key in yaml.load(maint_file)]

-    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', 'stats', 'sim-power'])

     tags = ''.join(commit_header.split(':')[0].split()).split(',')
     if (any(tag not in valid_tags for tag in tags)):

--
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: 1
Gerrit-Owner: Matthew Poremba <matthew.pore...@amd.com>
Gerrit-MessageType: newchange
_______________________________________________
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