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

merge manifest retrieval

This commit is contained in:
Kay0u 2020-01-14 23:58:54 +07:00
parent 2f3e8444ab
commit 71a64b4bbf
No known key found for this signature in database
GPG key ID: 7FF262C033518333

View file

@ -242,18 +242,15 @@ for app, info in apps_list.items():
print("Revision changed ! Updating...") print("Revision changed ! Updating...")
# Hosted on GitHub raw_url = '%s/raw/%s/manifest.json' % (app_url, app_rev)
if forge_type == "github":
raw_url = 'https://raw.githubusercontent.com/%s/%s/%s/manifest.json' % ( manifest = get_json(raw_url, verify=True)
owner, repo, app_rev
)
manifest = get_json(raw_url)
if manifest is None: if manifest is None:
error("Manifest is empty for app %s ?" % app) error("Manifest is empty for app %s ?" % app)
continue continue
# Hosted on GitHub
if forge_type == "github":
api_url = 'https://api.github.com/repos/%s/%s/commits/%s' % ( api_url = 'https://api.github.com/repos/%s/%s/commits/%s' % (
owner, repo, app_rev owner, repo, app_rev
) )
@ -268,13 +265,6 @@ for app, info in apps_list.items():
# Gitlab-type forge # Gitlab-type forge
elif forge_type == "gitlab": elif forge_type == "gitlab":
raw_url = '%s/raw/%s/manifest.json' % (app_url, app_rev)
manifest = get_json(raw_url, verify=True)
if manifest is None:
error("Manifest is empty for app %s ?" % app)
continue
api_url = 'https://%s/api/v4/projects/%s%%2F%s/repository/commits/%s' % (forge_site, owner, repo, app_rev) api_url = 'https://%s/api/v4/projects/%s%%2F%s/repository/commits/%s' % (forge_site, owner, repo, app_rev)
commit = get_json(api_url) commit = get_json(api_url)
if commit is None: if commit is None:
@ -285,13 +275,6 @@ for app, info in apps_list.items():
timestamp = int(time.mktime(commit_date.timetuple())) timestamp = int(time.mktime(commit_date.timetuple()))
elif forge_type == "gitea": elif forge_type == "gitea":
raw_url = 'https://%s/%s/%s/raw/commit/%s/manifest.json' % (forge_site, owner, repo, app_rev)
manifest = get_json(raw_url, verify=True)
if manifest is None:
error("Manifest is empty for app %s ?" % app)
continue
api_url = 'https://%s/api/v1/repos/%s/%s/git/commits/%s' % (forge_site, owner, repo, app_rev) api_url = 'https://%s/api/v1/repos/%s/%s/git/commits/%s' % (forge_site, owner, repo, app_rev)
info2 = get_json(api_url) info2 = get_json(api_url)
if info2 is None: if info2 is None:
@ -306,12 +289,6 @@ for app, info in apps_list.items():
if not app_url.endswith('.git'): if not app_url.endswith('.git'):
app_url += ".git" app_url += ".git"
raw_url = '%s/raw/%s/manifest.json' % (app_url[:-4], app_rev)
manifest = get_json(raw_url, verify=False)
if manifest is None:
error("Manifest is empty for app %s ?" % app)
continue
obj_url = '%s/objects/%s/%s' % ( obj_url = '%s/objects/%s/%s' % (
app_url, app_rev[0:2], app_rev[2:] app_url, app_rev[0:2], app_rev[2:]
) )