From 8e8b9a159479516c72d323fafd89e8e716313e09 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 3 Jan 2023 18:59:48 +0100 Subject: [PATCH] Fix check_id_unicity, uniformize URL syntax (lowercase) so that app id are consistent with the URL --- apps.json | 16 ++++++++-------- check_id_unicity.py | 16 +++++++--------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/apps.json b/apps.json index 501f00ec..24f92345 100644 --- a/apps.json +++ b/apps.json @@ -23,7 +23,7 @@ "category": "system_tools", "level": 7, "state": "working", - "url": "https://github.com/YunoHost-Apps/2FAuth_ynh" + "url": "https://github.com/YunoHost-Apps/2fauth_ynh" }, "abantecart": { "category": "publishing", @@ -662,7 +662,7 @@ "category": "games", "level": 8, "state": "working", - "url": "https://github.com/YunoHost-Apps/Cubiks-2048_ynh" + "url": "https://github.com/YunoHost-Apps/cubiks-2048_ynh" }, "cypht": { "category": "communication", @@ -2134,7 +2134,7 @@ "level": 0, "revision": "a38a83fea289f77910fd98b34ea58eea5f5909db", "state": "notworking", - "url": "https://github.com/YunoHost-Apps/LBCAlerte_ynh" + "url": "https://github.com/YunoHost-Apps/lbcalerte_ynh" }, "leed": { "category": "reading", @@ -3723,7 +3723,7 @@ "remotestorage": { "category": "small_utilities", "state": "notworking", - "url": "https://github.com/YunoHost-Apps/RemoteStorage_ynh" + "url": "https://github.com/YunoHost-Apps/remotestorage_ynh" }, "restic": { "category": "system_tools", @@ -3990,7 +3990,7 @@ "category": "small_utilities", "level": 7, "state": "working", - "url": "https://github.com/YunoHost-Apps/Signaturepdf_ynh" + "url": "https://github.com/YunoHost-Apps/signaturepdf_ynh" }, "simple-hash-generator": { "category": "small_utilities", @@ -4014,7 +4014,7 @@ "subtags": [ "websites" ], - "url": "https://github.com/YunoHost-Apps/SitemagicCMS_ynh" + "url": "https://github.com/YunoHost-Apps/sitemagiccms_ynh" }, "slingcode": { "category": "dev", @@ -4583,7 +4583,7 @@ "category": "multimedia", "level": 6, "state": "working", - "url": "https://github.com/YunoHost-Apps/UMS_ynh" + "url": "https://github.com/YunoHost-Apps/ums_ynh" }, "unattended_upgrades": { "category": "system_tools", @@ -4999,4 +4999,4 @@ "state": "working", "url": "https://github.com/YunoHost-Apps/zwave-js-ui_ynh" } -} +} \ No newline at end of file diff --git a/check_id_unicity.py b/check_id_unicity.py index 53ab7605..faee5a1c 100644 --- a/check_id_unicity.py +++ b/check_id_unicity.py @@ -24,15 +24,17 @@ def get_json(url, verify=True, token=None): def main(apps): for app_id, app_data in apps.items(): url = app_data["url"] + if app_data.get("state") != "working": + continue github_repo_name = url.split("/")[-1].replace("_ynh", "") 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:] 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) @@ -42,15 +44,11 @@ def main(apps): manifest_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: - 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 not sys.argv[1:]: - print "Usage: python check_id_unicity.py list.json" - sys.exit(1) - - main(json.load(open(sys.argv[1]))) + main(json.load(open("apps.json")))