2021-03-14 11:55:11 +01:00
|
|
|
#!/usr/bin/python3
|
2021-05-15 13:41:26 +02:00
|
|
|
#
|
|
|
|
# repology-openmamba.py - find upstream packages updates from repology.org
|
|
|
|
# Copyright (c) 2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
|
|
#
|
2021-03-14 11:55:11 +01:00
|
|
|
|
|
|
|
import json, urllib.request, time
|
|
|
|
|
|
|
|
|
|
|
|
with open("/var/ftp/pub/openmamba/devel/legacy") as f:
|
|
|
|
legacy_packages = f.read().splitlines()
|
|
|
|
|
2021-05-15 13:41:26 +02:00
|
|
|
with open("/var/ftp/pub/openmamba/devel/ignore") as f:
|
|
|
|
data = json.loads(f.read())
|
|
|
|
ignored_packages = data["repology"]
|
|
|
|
|
2021-03-14 11:55:11 +01:00
|
|
|
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:
|
2021-05-15 13:41:26 +02:00
|
|
|
if not p["srcname"] in legacy_packages and not p["srcname"] in ignored_packages:
|
2021-03-14 11:55:11 +01:00
|
|
|
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)
|