get_maintainer.py: add --release-to
Adds an option to scripts/get_maintainer.py showing the email addresses
to be used for release announcements. All addresses in Maintainer (M:)
or Reviewer (R:) entries are shown.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
diff --git a/scripts/get_maintainer.py b/scripts/get_maintainer.py
index 6600c44..3431fea 100755
--- a/scripts/get_maintainer.py
+++ b/scripts/get_maintainer.py
@@ -46,20 +46,28 @@
help='Github pull request ID. The script will '
'download the patchset from Github to a temporary '
'file and process it.')
+ parser.add_argument('-r', '--release-to', action='store_true',
+ help='show all the recipients to be used in release '
+ 'announcement emails (i.e., maintainers and reviewers)'
+ 'and exit.')
return parser.parse_args()
+def check_cwd():
+ cwd = os.getcwd()
+ parent = os.path.dirname(os.path.realpath(__file__)) + "/../"
+ if (os.path.realpath(cwd) != os.path.realpath(parent)):
+ print("Error: this script must be run from the top-level of the "
+ "optee_os tree")
+ exit(1)
+
+
# Parse MAINTAINERS and return a dictionary of subsystems such as:
# {'Subsystem name': {'R': ['foo', 'bar'], 'S': ['Maintained'],
# 'F': [ 'path1', 'path2' ]}, ...}
def parse_maintainers():
subsystems = {}
- cwd = os.getcwd()
- parent = os.path.dirname(os.path.realpath(__file__)) + "/../"
- if (os.path.realpath(cwd) != os.path.realpath(parent)):
- print("Error: this script must be run from the top-level of the "
- "optee_os tree")
- exit(1)
+ check_cwd()
with open("MAINTAINERS", "r") as f:
start_found = False
ss = {}
@@ -224,10 +232,23 @@
return f.name
+def show_release_to():
+ check_cwd()
+ with open("MAINTAINERS", "r") as f:
+ emails = sorted(set(re.findall(r'[RM]:\t(.*[\w]*<[\w\.-]+@[\w\.-]+>)',
+ f.read())))
+ print(*emails, sep=', ')
+
+
def main():
global args
args = get_args()
+
+ if args.release_to:
+ show_release_to()
+ return
+
all_subsystems = parse_maintainers()
paths = []
arglist = []