gnome.updateScript: Fetch cache.json from download.gnome.org/sources

ftp.gnome.org/pub/GNOME/sources already redirects to download.gnome.org/sources. For some reason sometimes
I get "Application is not available" when using the former link but this does not happen with the latter.
This commit is contained in:
Bobby Rong 2024-11-30 22:08:52 +08:00
parent fa42b5a5f4
commit 3bc8b401c1
No known key found for this signature in database

View File

@ -102,7 +102,7 @@ def make_version_policy(
def find_versions(package_name: str, version_policy: VersionPolicy) -> List[Version]:
# The structure of cache.json: https://gitlab.gnome.org/Infrastructure/sysadmin-bin/blob/master/ftpadmin#L762
cache = json.loads(requests.get(f"https://ftp.gnome.org/pub/GNOME/sources/{package_name}/cache.json").text)
cache = json.loads(requests.get(f"https://download.gnome.org/sources/{package_name}/cache.json").text)
if type(cache) != list or cache[0] != 4:
raise Exception("Unknown format of cache.json file.")
@ -117,7 +117,7 @@ parser = argparse.ArgumentParser(
)
parser.add_argument(
"package-name",
help="Name of the directory in https://ftp.gnome.org/pub/GNOME/sources/ containing the package.",
help="Name of the directory in https://download.gnome.org/sources/ containing the package.",
)
parser.add_argument(
"version-policy",