#!/usr/bin/python3 import json, urllib.request, time with open("/var/ftp/pub/openmamba/devel/legacy") as f: legacy_packages = f.read().splitlines() from_package = "" while True: #print("fetching https://repology.org/api/v1/projects/" + from_package + "?inrepo=openmamba&outdated=1") url = urllib.request.urlopen("https://repology.org/api/v1/projects/" + from_package + "?inrepo=openmamba&outdated=1") data = json.loads(url.read().decode()) if from_package != "" and len(data.keys()) <= 1: break for k in data.keys(): package = k if package == from_package: continue openmamba_srcname = None openmamba_version = None newest_version = None newest_repos = [] for p in data[k]: if p["repo"] == "openmamba" and openmamba_srcname is None: if not p["srcname"] in legacy_packages: openmamba_version = p["version"] openmamba_srcname = p["srcname"] elif p["status"] == "newest": # kaos_build provides unreleased kde package versions if p["repo"] != "kaos_build": newest_version = p["version"] newest_repos.append(p["repo"]) newest_repos = list(dict.fromkeys(newest_repos)) if openmamba_srcname and newest_version is not None and len(newest_repos) > 0: print(openmamba_srcname + " " + newest_version + " " + ",".join(newest_repos)) from_package = package + "/" time.sleep(1)