blob: 099bc98d2e8667eb2d133bb333338184144646bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/usr/bin/python3
import yaml
import re
import os
import json
# Paths to certain repos
repo = {
"updater": "../../updater",
"wiki": "../../wiki",
"hudson": "../../jenkins",
"cve": "../../cve"
}
# List of all codenames in hudson
codenames = []
# List of devices in cve tracker
cve_entries = []
# List of devices with updater pages
updater_pages = []
# Open file and input lines as items in list
hudson_file = repo["hudson"] + "/lineage-build-targets"
with open(hudson_file) as f:
for line in f:
# Ignore blank lines or lines with comments
if re.match(r"^\s*$", line) or re.match(r"#", line):
continue
# Add codenames to list
codenames.append(re.sub(r" .*", "", line.strip()))
# Sort codenames alphabetically
codenames.sort()
# Create list of devices in cve tracker
cve_json_file = repo["cve"] + "/kernels.json"
with open(cve_json_file) as f:
json_file = json.load(f)
for kernel in json_file:
for device in json_file[kernel]:
device = re.sub(r"android_device_[a-zA-Z0-9]*_", "", device)
cve_entries.append(device)
# CVE tracker checking
for codename in codenames:
if codename not in cve_entries:
print("{} doesn't have an entry in the CVE tracker".format(codename))
# Create list of updater pages
updater_json_file = repo["updater"] + "/devices.json"
with open(updater_json_file) as f:
json_file = json.load(f)
for device in json_file:
updater_pages.append(device["model"])
# Updater checking
for codename in codenames:
if codename not in updater_pages:
print("{} doesn't have an updater page".format(codename))
# Wiki checking
for codename in codenames:
wiki_yml_file = repo["wiki"] + "/_data/devices/" + codename + ".yml"
if not os.path.isfile(wiki_yml_file):
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))
except KeyError:
print("{} doesn't have a maintainers field".format(codename))
try:
if not yml["install_method"] or "TODO" in yml["install_method"]:
print("{} doesn't have an install method listed".format(codename))
except KeyError:
print("{} doesn't have an install method field".format(codename))
|