| |
@@ -122,7 +122,7 @@
|
| |
500,
|
| |
error_code=APIERROR.ENOCODE,
|
| |
error="This pagure instance has no PDC_URL configured, please inform"
|
| |
- " your pagure administrators"
|
| |
+ " your pagure administrators",
|
| |
)
|
| |
else:
|
| |
pdc_url = "%s/component-branches/" % pdc_url.rstrip("/")
|
| |
@@ -134,8 +134,9 @@
|
| |
"modules": "module",
|
| |
"container": "container",
|
| |
}
|
| |
- to_pdc_namespace = flask.current_app.config.get("PDC_NAMESPACES") \
|
| |
- or to_pdc_namespace
|
| |
+ to_pdc_namespace = (
|
| |
+ flask.current_app.config.get("PDC_NAMESPACES") or to_pdc_namespace
|
| |
+ )
|
| |
|
| |
try:
|
| |
pdc_namespace = to_pdc_namespace[namespace]
|
| |
@@ -143,12 +144,15 @@
|
| |
raise pagure.exceptions.APIError(
|
| |
500,
|
| |
error_code=APIERROR.ENOCODE,
|
| |
- error="Namespace: %s could not be converted to a PDC namespace" %
|
| |
- namespace
|
| |
+ error="Namespace: %s could not be converted to a PDC namespace"
|
| |
+ % namespace,
|
| |
)
|
| |
|
| |
url = "%s?global_component=%s&name=master&type=%s" % (
|
| |
- pdc_url, name, pdc_namespace)
|
| |
+ pdc_url,
|
| |
+ name,
|
| |
+ pdc_namespace,
|
| |
+ )
|
| |
|
| |
_log.info("Querying PDC at: %s", url)
|
| |
try:
|
| |
@@ -157,7 +161,7 @@
|
| |
raise pagure.exceptions.APIError(
|
| |
500,
|
| |
error_code=APIERROR.ENOCODE,
|
| |
- error="An error occured while querying pdc: %s" % err
|
| |
+ error="An error occured while querying pdc: %s" % err,
|
| |
)
|
| |
|
| |
try:
|
| |
@@ -166,10 +170,12 @@
|
| |
raise pagure.exceptions.APIError(
|
| |
500,
|
| |
error_code=APIERROR.ENOCODE,
|
| |
- error="The output of %s could not be converted to JSON" % req.url
|
| |
+ error="The output of %s could not be converted to JSON" % req.url,
|
| |
)
|
| |
|
| |
- _log.info("%s/%s is active: %s", namespace, name, data["results"][0]["active"])
|
| |
+ _log.info(
|
| |
+ "%s/%s is active: %s", namespace, name, data["results"][0]["active"]
|
| |
+ )
|
| |
return data["results"][0]["active"] == True
|
| |
|
| |
|
| |
@@ -196,7 +202,7 @@
|
| |
)
|
| |
|
| |
user_grps = set(user_obj.groups)
|
| |
- req_grps = set(['packager'])
|
| |
+ req_grps = set(["packager"])
|
| |
if not user_grps.intersection(req_grps):
|
| |
raise pagure.exceptions.APIError(
|
| |
403,
|
| |
@@ -210,7 +216,7 @@
|
| |
400,
|
| |
error_code=APIERROR.EINVALIDREQ,
|
| |
errors="This project has been retired and cannot be unorphaned "
|
| |
- "here, please open a releng ticket for it.",
|
| |
+ "here, please open a releng ticket for it.",
|
| |
)
|
| |
|
| |
try:
|
| |
@@ -225,9 +231,7 @@
|
| |
pagure.lib.notify.log(
|
| |
repo,
|
| |
topic="project.adopt",
|
| |
- msg=dict(
|
| |
- project=repo.to_json(public=True), agent=user_obj.username
|
| |
- ),
|
| |
+ msg=dict(project=repo.to_json(public=True), agent=user_obj.username),
|
| |
)
|
| |
|
| |
output = {"point_of_contact": repo.user.user}
|
| |
@@ -242,9 +246,14 @@
|
| |
"""
|
| |
if namespace not in ["rpms"]:
|
| |
raise pagure.exceptions.APIError(
|
| |
- 400, error_code=APIERROR.EINVALIDREQ, errors=["Namespace not supported"])
|
| |
+ 400,
|
| |
+ error_code=APIERROR.EINVALIDREQ,
|
| |
+ errors=["Namespace not supported"],
|
| |
+ )
|
| |
|
| |
- _log.info("Received request for the bodhi updates of: %s/%s", namespace, repo)
|
| |
+ _log.info(
|
| |
+ "Received request for the bodhi updates of: %s/%s", namespace, repo
|
| |
+ )
|
| |
|
| |
repo = _get_repo(repo, namespace=namespace)
|
| |
html = pagure.utils.is_true(flask.request.args.get("html", False))
|
| |
@@ -262,11 +271,17 @@
|
| |
req = requests.get(url)
|
| |
if not req.ok:
|
| |
raise pagure.exceptions.APIError(
|
| |
- 400, error_code=APIERROR.EINVALIDREQ, errors=["Could not call bodhi"])
|
| |
+ 400,
|
| |
+ error_code=APIERROR.EINVALIDREQ,
|
| |
+ errors=["Could not call bodhi"],
|
| |
+ )
|
| |
|
| |
data = req.json()
|
| |
for release in data.get("releases", []):
|
| |
- if any(word in release["long_name"] for word in ["Flatpaks", "Containers", "Modular"]):
|
| |
+ if any(
|
| |
+ word in release["long_name"]
|
| |
+ for word in ["Flatpaks", "Containers", "Modular"]
|
| |
+ ):
|
| |
continue
|
| |
if release["state"] in ["pending", "current"]:
|
| |
releases[release["name"]] = release["long_name"]
|
| |
@@ -278,14 +293,20 @@
|
| |
page += 1
|
| |
|
| |
# Retrieves the updates of that package in bodhi
|
| |
- update_url = "%s/updates?packages=%s" % (bodhi_base_url.rstrip("/"), repo.name)
|
| |
+ update_url = "%s/updates?packages=%s" % (
|
| |
+ bodhi_base_url.rstrip("/"),
|
| |
+ repo.name,
|
| |
+ )
|
| |
updates = collections.defaultdict(dict)
|
| |
|
| |
_log.info("Calling bodhi at: %s", update_url)
|
| |
req = requests.get(update_url)
|
| |
if not req.ok:
|
| |
raise pagure.exceptions.APIError(
|
| |
- 400, error_code=APIERROR.EINVALIDREQ, errors=["Could not call bodhi"])
|
| |
+ 400,
|
| |
+ error_code=APIERROR.EINVALIDREQ,
|
| |
+ errors=["Could not call bodhi"],
|
| |
+ )
|
| |
|
| |
data = req.json()
|
| |
for update in data["updates"]:
|
| |
@@ -308,30 +329,45 @@
|
| |
row = "<tr><td scope='row' class='text-align-left'>{release}</td><td>{stable}</td><td>{testing}</td></tr>"
|
| |
stable = ""
|
| |
if updates.get(release, {}).get("stable"):
|
| |
- stable = "<a href='https://koji.fedoraproject.org/koji/search?" \
|
| |
- "terms={0}&type=build&match=glob'>{0}</a>".format(
|
| |
- updates[release].get("stable"))
|
| |
+ stable = (
|
| |
+ "<a href='https://koji.fedoraproject.org/koji/search?"
|
| |
+ "terms={0}&type=build&match=glob'>{0}</a>".format(
|
| |
+ updates[release].get("stable")
|
| |
+ )
|
| |
+ )
|
| |
else:
|
| |
# This makes things a little slower and is only needed up until all releases will have gone
|
| |
# through bodhi all the time (ie: up until about F31 is eol).
|
| |
- mdapi_url = "https://mdapi.fedoraproject.org/%s/srcpkg/%s" % (release.lower(), repo.name)
|
| |
+ mdapi_url = "https://mdapi.fedoraproject.org/%s/srcpkg/%s" % (
|
| |
+ release.lower(),
|
| |
+ repo.name,
|
| |
+ )
|
| |
_log.info("Calling mdapi at: %s", mdapi_url)
|
| |
req = requests.get(mdapi_url)
|
| |
if req.ok:
|
| |
_log.info("mdapi returned ok")
|
| |
data = req.json()
|
| |
- build = "%s-%s-%s" % (data["basename"], data["version"], data["release"])
|
| |
- stable = "<a href='https://koji.fedoraproject.org/koji/search?" \
|
| |
- "terms={0}&type=build&match=glob'>{0}</a>".format(build)
|
| |
+ build = "%s-%s-%s" % (
|
| |
+ data["basename"],
|
| |
+ data["version"],
|
| |
+ data["release"],
|
| |
+ )
|
| |
+ stable = (
|
| |
+ "<a href='https://koji.fedoraproject.org/koji/search?"
|
| |
+ "terms={0}&type=build&match=glob'>{0}</a>".format(
|
| |
+ build
|
| |
+ )
|
| |
+ )
|
| |
testing = ""
|
| |
if updates.get(release, {}).get("testing"):
|
| |
- testing = "<a href='https://koji.fedoraproject.org/koji/search?" \
|
| |
- "terms={0}&type=build&match=glob'>{0}</a>".format(
|
| |
- updates[release].get("testing"))
|
| |
+ testing = (
|
| |
+ "<a href='https://koji.fedoraproject.org/koji/search?"
|
| |
+ "terms={0}&type=build&match=glob'>{0}</a>".format(
|
| |
+ updates[release].get("testing")
|
| |
+ )
|
| |
+ )
|
| |
row = row.format(
|
| |
- release=releases[release],
|
| |
- stable=stable,
|
| |
- testing=testing,
|
| |
+ release=releases[release], stable=stable, testing=testing
|
| |
)
|
| |
html_output += row
|
| |
html_output += "</table>"
|
| |
Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr