| |
@@ -74,15 +74,16 @@
|
| |
"ACL_PROTECTED_NAMESPACES", ["rpms"]
|
| |
)
|
| |
|
| |
- self.pdc_url = pagure_config.get("PDC_URL")
|
| |
+ self.distgit_url = pagure_config.get("APP_URL")
|
| |
|
| |
def is_supported_branch(self, project, refname):
|
| |
"""Returns whether a specific branch is currently supported for Fedora
|
| |
|
| |
- This retrieves the information about EOL status from PDC, to prevent
|
| |
+ This retrieves the information from src.fedoraproject.org/lookaside, where
|
| |
+ json files with retired packages on active branches are listed, to prevent
|
| |
EOL branches being pushed to.
|
| |
"""
|
| |
- if not self.pdc_url:
|
| |
+ if not self.distgit_url:
|
| |
# No way to confirm this is a supported branch, not supported
|
| |
return None
|
| |
if not refname.startswith("refs/heads/"):
|
| |
@@ -90,29 +91,17 @@
|
| |
return None
|
| |
refname = refname[len("refs/heads/") :]
|
| |
|
| |
- namespace2pdctype = {
|
| |
- "rpms": "rpm",
|
| |
- "modules": "module",
|
| |
- "container": "container",
|
| |
- }
|
| |
name = urllib.parse.quote(project.name)
|
| |
- resp = requests.get(
|
| |
- f"{self.pdc_url}component-branches/?global_component={name}"
|
| |
- f"&name={refname}&type={namespace2pdctype[project.namespace]}&fields=active"
|
| |
- )
|
| |
+ # gets retired packages on branches currently supported by Fedora`
|
| |
+ resp = requests.get(f"{self.distgit_url}/lookaside/retired_in_{refname}.json")
|
| |
|
| |
- res = []
|
| |
- if resp.ok:
|
| |
- res = resp.json().get("results")
|
| |
+ # the branch is not supported
|
| |
+ if resp.status_code == 404:
|
| |
+ return False
|
| |
|
| |
- if len(res) == 0:
|
| |
- # No status
|
| |
- return None
|
| |
- if len(res) != 1:
|
| |
- # PDC couldn't make up its mind....
|
| |
- # Should never happen, but just in case...
|
| |
- raise ValueError("PDC was unable to make up its mind")
|
| |
- return res[0]["active"]
|
| |
+ # False: retired package on currently active branch
|
| |
+ # True: active package on active branch
|
| |
+ return name not in resp
|
| |
|
| |
def info(self, msg):
|
| |
"""Function to print information.
|
| |
@@ -247,7 +236,10 @@
|
| |
pdc_ref = branch_overrides[project.namespace][refname]
|
| |
is_supported = self.is_supported_branch(project, pdc_ref)
|
| |
if is_supported is False:
|
| |
- self.info("Branch %s is unsupported. Cannot push to a disabled branch (maybe eol?)." % refname)
|
| |
+ self.info(
|
| |
+ "Branch %s is unsupported. Cannot push to a disabled branch (maybe eol?)."
|
| |
+ % refname
|
| |
+ )
|
| |
return False
|
| |
elif is_supported is True:
|
| |
self.debug("Branch %s is supported" % refname)
|
| |
Signed-off-by: Lenka Segura lsegura@redhat.com