CI: wiki: check if device name is on Renamed Devices page (MR 2559)

Since the wiki applies to all branches, renaming devices is really
difficult without breaking the wiki check. To simplify this, download
the Renamed Devices page additionally, and just print a WARNING if
a device is missing in the wiki, but is listed there.
This commit is contained in:
Minecrell 2021-09-28 11:43:12 +02:00
parent 23b6654f88
commit f9fae7bf4e
No known key found for this signature in database
GPG key ID: 6FE3B029D9D9FAFF

View file

@ -53,6 +53,13 @@ def get_wiki_devices_html(path):
return {"booting": split[0], "not_booting": split[1]}
def get_wiki_renamed_devices_html():
""":returns: HTML of the page"""
# Download wiki page
url = "http://wiki.postmarketos.org/wiki/Renamed_Devices"
return urllib.request.urlopen(url).read().decode("utf-8")
def check_device(device, html, is_booting):
""":param is_booting: require the device to be in the booting section, not
just anywhere in the page (i.e. in the not booting
@ -67,6 +74,9 @@ def check_device(device, html, is_booting):
" section already)")
return False
return True
if device in html["renamed"]:
print(f"WARNING: {device} was renamed in the wiki")
return True
print(device + ": not in the wiki yet.")
return False
@ -87,6 +97,7 @@ def main():
# Check all devices
html = get_wiki_devices_html(args.path)
html["renamed"] = get_wiki_renamed_devices_html()
error = False
for device in get_devices():
if not check_device(device, html, args.booting):