repology-openmamba.py: update to current production code
This commit is contained in:
parent
e9c5cbbdbf
commit
193a41413a
@ -4,7 +4,7 @@
|
||||
# Copyright (c) 2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
#
|
||||
|
||||
import json, urllib.request, time
|
||||
import json, urllib.request, time, sys
|
||||
|
||||
|
||||
with open("/var/ftp/pub/openmamba/devel/legacy") as f:
|
||||
@ -15,26 +15,41 @@ with open("/var/ftp/pub/openmamba/devel/ignore") as f:
|
||||
ignored_packages = data["repology"]
|
||||
|
||||
from_package = ""
|
||||
last_from_package = "NONE"
|
||||
results = []
|
||||
|
||||
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")
|
||||
if from_package == last_from_package:
|
||||
break
|
||||
requrl = "https://repology.org/api/v1/projects/"
|
||||
if from_package != "":
|
||||
requrl += from_package +"/"
|
||||
requrl += "?inrepo=openmamba&outdated=1"
|
||||
sys.stderr.write("Requesting: " + requrl + "\n")
|
||||
url = urllib.request.urlopen(requrl)
|
||||
#print(requrl)
|
||||
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:
|
||||
if k == from_package:
|
||||
continue
|
||||
package = k
|
||||
openmamba_srcname = None
|
||||
openmamba_version = None
|
||||
openmamba_altnames = []
|
||||
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 and not p["srcname"] in ignored_packages:
|
||||
openmamba_version = p["version"]
|
||||
openmamba_srcname = p["srcname"]
|
||||
if p["repo"] == "openmamba":
|
||||
if not p["srcname"] in ignored_packages and \
|
||||
not p["srcname"] in legacy_packages:
|
||||
if openmamba_srcname is None:
|
||||
openmamba_version = p["version"]
|
||||
openmamba_srcname = p["srcname"]
|
||||
else:
|
||||
openmamba_altnames.append(p["srcname"])
|
||||
elif p["status"] == "newest":
|
||||
# kaos_build provides unreleased kde package versions
|
||||
if p["repo"] != "kaos_build":
|
||||
@ -42,6 +57,14 @@ while True:
|
||||
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 + "/"
|
||||
results.append(openmamba_srcname + " " + newest_version)
|
||||
for altname in openmamba_altnames:
|
||||
results.append(altname + " " + newest_version)
|
||||
last_from_package = from_package
|
||||
from_package = package
|
||||
time.sleep(1)
|
||||
|
||||
results_sorted = sorted(set(results), key=str.casefold)
|
||||
#results_unique = set(results_sorted)
|
||||
for result in results_sorted:
|
||||
print(result)
|
||||
|
Loading…
Reference in New Issue
Block a user