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:
parent
23b6654f88
commit
f9fae7bf4e
1 changed files with 11 additions and 0 deletions
|
@ -53,6 +53,13 @@ def get_wiki_devices_html(path):
|
||||||
return {"booting": split[0], "not_booting": split[1]}
|
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):
|
def check_device(device, html, is_booting):
|
||||||
""":param is_booting: require the device to be in the booting section, not
|
""":param is_booting: require the device to be in the booting section, not
|
||||||
just anywhere in the page (i.e. in the not booting
|
just anywhere in the page (i.e. in the not booting
|
||||||
|
@ -67,6 +74,9 @@ def check_device(device, html, is_booting):
|
||||||
" section already)")
|
" section already)")
|
||||||
return False
|
return False
|
||||||
return True
|
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.")
|
print(device + ": not in the wiki yet.")
|
||||||
return False
|
return False
|
||||||
|
@ -87,6 +97,7 @@ def main():
|
||||||
|
|
||||||
# Check all devices
|
# Check all devices
|
||||||
html = get_wiki_devices_html(args.path)
|
html = get_wiki_devices_html(args.path)
|
||||||
|
html["renamed"] = get_wiki_renamed_devices_html()
|
||||||
error = False
|
error = False
|
||||||
for device in get_devices():
|
for device in get_devices():
|
||||||
if not check_device(device, html, args.booting):
|
if not check_device(device, html, args.booting):
|
||||||
|
|
Loading…
Reference in a new issue