mirror of
https://github.com/YunoHost/apps.git
synced 2024-09-03 20:06:07 +02:00
Merge pull request #857 from YunoHost/fix-commit-info-empty
[Fix] Commit is empty
This commit is contained in:
commit
b55d21a640
1 changed files with 29 additions and 29 deletions
|
@ -164,7 +164,7 @@ for app, info in apps_list.items():
|
||||||
elif forge_site == "framagit.org":
|
elif forge_site == "framagit.org":
|
||||||
forge_type = "gitlab"
|
forge_type = "gitlab"
|
||||||
elif forge_site == "code.ffdn.org":
|
elif forge_site == "code.ffdn.org":
|
||||||
forge_type = "gogs"
|
forge_type = "gitlab"
|
||||||
elif forge_site == "code.antopie.org":
|
elif forge_site == "code.antopie.org":
|
||||||
forge_type = "gitea"
|
forge_type = "gitea"
|
||||||
else:
|
else:
|
||||||
|
@ -242,21 +242,20 @@ for app, info in apps_list.items():
|
||||||
|
|
||||||
print("Revision changed ! Updating...")
|
print("Revision changed ! Updating...")
|
||||||
|
|
||||||
# Hosted on GitHub
|
raw_url = 'https://%(forge_site)s/%(owner)s/%(repo)s/raw/%(app_rev)s/manifest.json' % {
|
||||||
if forge_type == "github":
|
"forge_site": forge_site, "owner": owner, "repo": repo, "app_rev": app_rev
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
api_url = 'https://api.github.com/repos/%s/%s/commits/%s' % (
|
# Hosted on GitHub
|
||||||
owner, repo, app_rev
|
if forge_type == "github":
|
||||||
)
|
api_url = 'https://api.github.com/repos/%(owner)s/%(repo)s/commits/%(app_rev)s' % {
|
||||||
|
"owner": owner, "repo": repo, "app_rev": app_rev
|
||||||
|
}
|
||||||
|
|
||||||
info2 = get_json(api_url)
|
info2 = get_json(api_url)
|
||||||
if info2 is None:
|
if info2 is None:
|
||||||
|
@ -268,14 +267,9 @@ for app, info in apps_list.items():
|
||||||
|
|
||||||
# Gitlab-type forge
|
# Gitlab-type forge
|
||||||
elif forge_type == "gitlab":
|
elif forge_type == "gitlab":
|
||||||
|
api_url = 'https://%(forge_site)s/api/v4/projects/%(owner)s%%2F%(repo)s/repository/commits/%(app_rev)s' % {
|
||||||
raw_url = '%s/raw/%s/manifest.json' % (app_url, app_rev)
|
"forge_site": forge_site, "owner": owner, "repo": repo, "app_rev": 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)
|
|
||||||
commit = get_json(api_url)
|
commit = get_json(api_url)
|
||||||
if commit is None:
|
if commit is None:
|
||||||
error("Commit info is empty for app %s ?" % app)
|
error("Commit info is empty for app %s ?" % app)
|
||||||
|
@ -284,17 +278,23 @@ for app, info in apps_list.items():
|
||||||
commit_date = parse(commit["authored_date"])
|
commit_date = parse(commit["authored_date"])
|
||||||
timestamp = int(time.mktime(commit_date.timetuple()))
|
timestamp = int(time.mktime(commit_date.timetuple()))
|
||||||
|
|
||||||
|
elif forge_type == "gitea":
|
||||||
|
api_url = 'https://%(forge_site)s/api/v1/repos/%(owner)s/%(repo)s/git/commits/%(app_rev)s' % {
|
||||||
|
"forge_site": forge_site, "owner": owner, "repo": repo, "app_rev": app_rev
|
||||||
|
}
|
||||||
|
info2 = get_json(api_url)
|
||||||
|
if info2 is None:
|
||||||
|
error("Commit info is empty for app %s ?" % app)
|
||||||
|
continue
|
||||||
|
|
||||||
|
commit_date = parse(info2['commit']['author']['date'])
|
||||||
|
timestamp = int(time.mktime(commit_date.timetuple()))
|
||||||
|
|
||||||
# Gogs-type forge
|
# Gogs-type forge
|
||||||
elif forge_type in ["gogs", "gitea"]:
|
elif forge_type == "gogs":
|
||||||
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:]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue