diff options
author | Paul Keith <javelinanddart@gmail.com> | 2017-06-30 16:10:43 -0500 |
---|---|---|
committer | Harry Youd <harry@harryyoud.co.uk> | 2017-08-07 15:20:06 +0000 |
commit | 63b1b6f833753eeda7900434cfedb67426d3fc4f (patch) | |
tree | ab5e0d230166a3b0dafdb0e629ffb180096cb4b4 | |
parent | 1569d26a451938fe0313e4b99030dc438b3f585a (diff) | |
download | scripts-63b1b6f833753eeda7900434cfedb67426d3fc4f.tar.gz scripts-63b1b6f833753eeda7900434cfedb67426d3fc4f.tar.bz2 scripts-63b1b6f833753eeda7900434cfedb67426d3fc4f.zip |
maintainers: Add optional checking of jira developer status
* Also unify code style a bit
Change-Id: Ibc3a23aa07d6c17db9e042e0b6b298844d0edfeb
-rwxr-xr-x | maintainer-checks/maintainers.py | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/maintainer-checks/maintainers.py b/maintainer-checks/maintainers.py index d357603..11aba13 100755 --- a/maintainer-checks/maintainers.py +++ b/maintainer-checks/maintainers.py @@ -10,6 +10,7 @@ mydir = os.path.dirname(os.path.abspath(__file__)) parser = argparse.ArgumentParser() parser.add_argument('-m', '--maintainers', help='list maintainers for devices', action='store_true', required=False) +parser.add_argument('-j', '--jira', dest="jira_file", required=False, help='Path to list of jira developers', metavar='FILE') args = parser.parse_args() # Paths to certain repos @@ -26,6 +27,8 @@ codenames = [] cve_entries = [] # List of devices with updater pages updater_pages = [] +# List of jira developers +jira_devs = [] # Open file and input lines as items in list hudson_file = os.path.join(mydir, repo["hudson"] + "/lineage-build-targets") @@ -70,11 +73,12 @@ for codename in codenames: # Wiki checking for codename in codenames: wiki_yml_file = os.path.join(mydir, repo["wiki"] + "/_data/devices/" + codename + ".yml") - if not os.path.isfile(wiki_yml_file): + try: + with open(wiki_yml_file) as f: + yml = yaml.load(f) + except FileNotFoundError: print("{} doesn't have a wiki page".format(codename)) continue - with open(wiki_yml_file) as f: - yml = yaml.load(f) try: if not yml["maintainers"]: print("{} doesn't have a maintainer listed".format(codename)) @@ -110,12 +114,12 @@ if args.maintainers: for codename in codenames: wiki_yml_file = os.path.join(mydir, repo["wiki"] + "/_data/devices/" + codename + ".yml") toprint = "{}:".format(codename) - if not os.path.isfile(wiki_yml_file): + try: + with open(wiki_yml_file) as f: + yml = yaml.load(f) + except FileNotFoundError: # Skip devices without wiki pages, we already errored about it continue - with open(wiki_yml_file) as f: - yml = yaml.load(f) - try: for maintainer in yml["maintainers"]: toprint += ", {}".format(maintainer) @@ -123,3 +127,23 @@ if args.maintainers: # Skip devices without maintainer fields, we already errored about it continue print(toprint.replace(":,", ":")) + +if args.jira_file: + with open(args.jira_file) as f: + for line in f: + jira_devs.append(line.strip()) + for codename in codenames: + wiki_yml_file = os.path.join(mydir, repo["wiki"] + "/_data/devices/" + codename + ".yml") + try: + with open(wiki_yml_file) as f: + yml = yaml.load(f) + except FileNotFoundError: + # Skip devices without wiki pages, we already errored about it + continue + try: + for maintainer in yml["maintainers"]: + if maintainer not in jira_devs: + print("{} is listed as a maintainer for {} but doesn't have a jira developer account".format(maintainer, codename)) + except KeyError: + # Skip devices without maintainer fields, we already errored about it + continue |