1
0
Fork 0
mirror of https://github.com/YunoHost/apps.git synced 2024-09-03 20:06:07 +02:00

Fix check_id_unicity, uniformize URL syntax (lowercase) so that app id are consistent with the URL

This commit is contained in:
Alexandre Aubin 2023-01-03 18:59:48 +01:00
parent 6e0a5a9bb6
commit 8e8b9a1594
2 changed files with 15 additions and 17 deletions

View file

@ -23,7 +23,7 @@
"category": "system_tools", "category": "system_tools",
"level": 7, "level": 7,
"state": "working", "state": "working",
"url": "https://github.com/YunoHost-Apps/2FAuth_ynh" "url": "https://github.com/YunoHost-Apps/2fauth_ynh"
}, },
"abantecart": { "abantecart": {
"category": "publishing", "category": "publishing",
@ -662,7 +662,7 @@
"category": "games", "category": "games",
"level": 8, "level": 8,
"state": "working", "state": "working",
"url": "https://github.com/YunoHost-Apps/Cubiks-2048_ynh" "url": "https://github.com/YunoHost-Apps/cubiks-2048_ynh"
}, },
"cypht": { "cypht": {
"category": "communication", "category": "communication",
@ -2134,7 +2134,7 @@
"level": 0, "level": 0,
"revision": "a38a83fea289f77910fd98b34ea58eea5f5909db", "revision": "a38a83fea289f77910fd98b34ea58eea5f5909db",
"state": "notworking", "state": "notworking",
"url": "https://github.com/YunoHost-Apps/LBCAlerte_ynh" "url": "https://github.com/YunoHost-Apps/lbcalerte_ynh"
}, },
"leed": { "leed": {
"category": "reading", "category": "reading",
@ -3723,7 +3723,7 @@
"remotestorage": { "remotestorage": {
"category": "small_utilities", "category": "small_utilities",
"state": "notworking", "state": "notworking",
"url": "https://github.com/YunoHost-Apps/RemoteStorage_ynh" "url": "https://github.com/YunoHost-Apps/remotestorage_ynh"
}, },
"restic": { "restic": {
"category": "system_tools", "category": "system_tools",
@ -3990,7 +3990,7 @@
"category": "small_utilities", "category": "small_utilities",
"level": 7, "level": 7,
"state": "working", "state": "working",
"url": "https://github.com/YunoHost-Apps/Signaturepdf_ynh" "url": "https://github.com/YunoHost-Apps/signaturepdf_ynh"
}, },
"simple-hash-generator": { "simple-hash-generator": {
"category": "small_utilities", "category": "small_utilities",
@ -4014,7 +4014,7 @@
"subtags": [ "subtags": [
"websites" "websites"
], ],
"url": "https://github.com/YunoHost-Apps/SitemagicCMS_ynh" "url": "https://github.com/YunoHost-Apps/sitemagiccms_ynh"
}, },
"slingcode": { "slingcode": {
"category": "dev", "category": "dev",
@ -4583,7 +4583,7 @@
"category": "multimedia", "category": "multimedia",
"level": 6, "level": 6,
"state": "working", "state": "working",
"url": "https://github.com/YunoHost-Apps/UMS_ynh" "url": "https://github.com/YunoHost-Apps/ums_ynh"
}, },
"unattended_upgrades": { "unattended_upgrades": {
"category": "system_tools", "category": "system_tools",
@ -4999,4 +4999,4 @@
"state": "working", "state": "working",
"url": "https://github.com/YunoHost-Apps/zwave-js-ui_ynh" "url": "https://github.com/YunoHost-Apps/zwave-js-ui_ynh"
} }
} }

View file

@ -24,15 +24,17 @@ def get_json(url, verify=True, token=None):
def main(apps): def main(apps):
for app_id, app_data in apps.items(): for app_id, app_data in apps.items():
url = app_data["url"] url = app_data["url"]
if app_data.get("state") != "working":
continue
github_repo_name = url.split("/")[-1].replace("_ynh", "") github_repo_name = url.split("/")[-1].replace("_ynh", "")
if app_id != github_repo_name: if app_id != github_repo_name:
print "[%s] GitHub repo name is not coherent with app id: '%s' vs '%s' (%s)" % (app_id, app_id, url.split("/")[-1], url) print("[%s] GitHub repo name is not coherent with app id: '%s' vs '%s' (%s)" % (app_id, app_id, url.split("/")[-1], url))
owner, repo_name = url.split("/")[-2:] owner, repo_name = url.split("/")[-2:]
raw_url = "https://raw.githubusercontent.com/%s/%s/%s/manifest.json" % ( raw_url = "https://raw.githubusercontent.com/%s/%s/%s/manifest.json" % (
owner, repo_name, app_data["revision"] owner, repo_name, app_data.get("branch", "master")
) )
manifest = get_json(raw_url) manifest = get_json(raw_url)
@ -42,15 +44,11 @@ def main(apps):
manifest_id = manifest["id"] manifest_id = manifest["id"]
if app_id != manifest_id: if app_id != manifest_id:
print "[%s] manifest id is different from app id: '%s' vs '%s' (manifest_id" % (app_id, app_id, manifest_id) print("[%s] manifest id is different from app id: '%s' vs '%s' (manifest_id" % (app_id, app_id, manifest_id))
if manifest_id != github_repo_name: if manifest_id != github_repo_name:
print "[%s] manifest id is different from GitHub repo name: '%s' vs '%s' (%s)" % (app_id, manifest_id, url.split("/")[-1], url) print("[%s] manifest id is different from GitHub repo name: '%s' vs '%s' (%s)" % (app_id, manifest_id, url.split("/")[-1], url))
if __name__ == '__main__': if __name__ == '__main__':
if not sys.argv[1:]: main(json.load(open("apps.json")))
print "Usage: python check_id_unicity.py list.json"
sys.exit(1)
main(json.load(open(sys.argv[1])))