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>
|
# 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:
|
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"]
|
ignored_packages = data["repology"]
|
||||||
|
|
||||||
from_package = ""
|
from_package = ""
|
||||||
|
last_from_package = "NONE"
|
||||||
|
results = []
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
#print("fetching https://repology.org/api/v1/projects/" + from_package + "?inrepo=openmamba&outdated=1")
|
if from_package == last_from_package:
|
||||||
url = urllib.request.urlopen("https://repology.org/api/v1/projects/" + from_package + "?inrepo=openmamba&outdated=1")
|
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())
|
data = json.loads(url.read().decode())
|
||||||
|
|
||||||
if from_package != "" and len(data.keys()) <= 1:
|
if from_package != "" and len(data.keys()) <= 1:
|
||||||
break
|
break
|
||||||
for k in data.keys():
|
for k in data.keys():
|
||||||
package = k
|
if k == from_package:
|
||||||
if package == from_package:
|
|
||||||
continue
|
continue
|
||||||
|
package = k
|
||||||
openmamba_srcname = None
|
openmamba_srcname = None
|
||||||
openmamba_version = None
|
openmamba_version = None
|
||||||
|
openmamba_altnames = []
|
||||||
newest_version = None
|
newest_version = None
|
||||||
newest_repos = []
|
newest_repos = []
|
||||||
for p in data[k]:
|
for p in data[k]:
|
||||||
if p["repo"] == "openmamba" and openmamba_srcname is None:
|
if p["repo"] == "openmamba":
|
||||||
if not p["srcname"] in legacy_packages and not p["srcname"] in ignored_packages:
|
if not p["srcname"] in ignored_packages and \
|
||||||
openmamba_version = p["version"]
|
not p["srcname"] in legacy_packages:
|
||||||
openmamba_srcname = p["srcname"]
|
if openmamba_srcname is None:
|
||||||
|
openmamba_version = p["version"]
|
||||||
|
openmamba_srcname = p["srcname"]
|
||||||
|
else:
|
||||||
|
openmamba_altnames.append(p["srcname"])
|
||||||
elif p["status"] == "newest":
|
elif p["status"] == "newest":
|
||||||
# kaos_build provides unreleased kde package versions
|
# kaos_build provides unreleased kde package versions
|
||||||
if p["repo"] != "kaos_build":
|
if p["repo"] != "kaos_build":
|
||||||
@ -42,6 +57,14 @@ while True:
|
|||||||
newest_repos.append(p["repo"])
|
newest_repos.append(p["repo"])
|
||||||
newest_repos = list(dict.fromkeys(newest_repos))
|
newest_repos = list(dict.fromkeys(newest_repos))
|
||||||
if openmamba_srcname and newest_version is not None and len(newest_repos) > 0:
|
if openmamba_srcname and newest_version is not None and len(newest_repos) > 0:
|
||||||
print(openmamba_srcname + " " + newest_version + " " + ",".join(newest_repos))
|
results.append(openmamba_srcname + " " + newest_version)
|
||||||
from_package = package + "/"
|
for altname in openmamba_altnames:
|
||||||
|
results.append(altname + " " + newest_version)
|
||||||
|
last_from_package = from_package
|
||||||
|
from_package = package
|
||||||
time.sleep(1)
|
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