2023-01-20 17:33:33 +01:00
|
|
|
import toml
|
|
|
|
import sys
|
|
|
|
|
2023-02-09 17:29:31 +01:00
|
|
|
errors = []
|
|
|
|
|
2023-01-20 17:33:33 +01:00
|
|
|
catalog = toml.load(open('apps.toml'))
|
2023-02-09 17:29:31 +01:00
|
|
|
|
|
|
|
for app, infos in catalog.items():
|
|
|
|
if "state" not in infos:
|
|
|
|
errors.append(f"{app}: missing state info")
|
|
|
|
|
2023-01-20 17:33:33 +01:00
|
|
|
catalog = {app: infos for app, infos in catalog.items() if infos.get('state') == "working"}
|
|
|
|
categories = toml.load(open('categories.toml')).keys()
|
|
|
|
|
2023-02-09 17:29:31 +01:00
|
|
|
|
2023-01-20 17:33:33 +01:00
|
|
|
def check_apps():
|
|
|
|
|
|
|
|
for app, infos in catalog.items():
|
|
|
|
|
|
|
|
repo_name = infos.get("url", "").split("/")[-1]
|
|
|
|
if repo_name != app + "_ynh":
|
|
|
|
yield f"{app}: repo name should be {app}_ynh, not in {repo_name}"
|
|
|
|
|
|
|
|
category = infos.get("category")
|
|
|
|
if not category:
|
|
|
|
yield f"{app}: missing category"
|
|
|
|
if category not in categories:
|
|
|
|
yield f"{app}: category {category} is not defined in categories.toml"
|
|
|
|
|
2023-02-09 17:29:31 +01:00
|
|
|
|
|
|
|
errors = errors + list(check_apps())
|
2023-01-20 17:33:33 +01:00
|
|
|
|
|
|
|
for error in errors:
|
|
|
|
print(error)
|
|
|
|
|
|
|
|
if errors:
|
|
|
|
sys.exit(1)
|