[gem5-dev] Change in gem5/gem5[develop]: util: Use MAINTAINERS.yaml for valid tags in git hook

2020-11-20 Thread Jason Lowe-Power (Gerrit) via gem5-dev
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 
Reviewed-by: Daniel Carvalho 
Reviewed-by: Giacomo Travaglini 
Reviewed-by: Jason Lowe-Power 
Reviewed-by: Nikos Nikoleris 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
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 000..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 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Boris Shingarov 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Hoa Nguyen 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: util: Use MAINTAINERS.yaml for valid tags in git hook

2020-11-07 Thread Matthew Poremba (Gerrit) via gem5-dev
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 
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