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.sandberg@arm.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Jason Lowe-Power
parent
ed3e52663b
commit
ce06a4715e
@@ -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 @@ def _printErrorQuit(error_message):
|
||||
|
||||
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 @@ def _validateTags(commit_header):
|
||||
"""
|
||||
|
||||
# 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)):
|
||||
|
||||
1
util/maint/__init__.py
Normal file
1
util/maint/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
#!/usr/bin/env python3
|
||||
Reference in New Issue
Block a user