repology-openmamba.py: support for ignore json list; autodist-upstream-updates: replace usage of obsolete tempfile with mktemp

This commit is contained in:
Silvan Calarco 2021-05-15 13:41:26 +02:00
parent b6d3b83d1e
commit b451ee800b
2 changed files with 36 additions and 27 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# autodist upstream updates - find upstream packages updates from different internet resources # autodist upstream updates - find upstream packages updates from different internet resources
# Copyright (c) 2004-2016 by Silvan Calarco <silvan.calarco@mambasoft.it> # Copyright (c) 2004-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
# #
#[ -r /etc/sysconfig/openmamba-central ] || { #[ -r /etc/sysconfig/openmamba-central ] || {
@ -46,7 +46,7 @@ get_job_vector() {
local JNAME_ESCAPED=`echo $JNAME | tr - _ | tr . _ | tr @ _` local JNAME_ESCAPED=`echo $JNAME | tr - _ | tr . _ | tr @ _`
# resolve JOB_NAME from distdb # resolve JOB_NAME from distdb
local jobtmpfile=`tempfile` local jobtmpfile=`mktemp`
# hack to get an array variable named as $j assigned to the JOB array # hack to get an array variable named as $j assigned to the JOB array
echo "echo \${$JNAME_ESCAPED[*]}" > $jobtmpfile echo "echo \${$JNAME_ESCAPED[*]}" > $jobtmpfile
JOB=(`. $jobtmpfile`) JOB=(`. $jobtmpfile`)
@ -285,7 +285,7 @@ if [ ! "$skip_parsing" ]; then
#parse_gnome #parse_gnome
#parse_distromatic #parse_distromatic
/usr/share/autodist/repology-openmamba.py > $UPDATES_DB.tmp /usr/share/autodist/repology-openmamba.py > $UPDATES_DB.tmp
if [ $? -eq 0 ]; then
#cat $tmpfile | sort -uf > $UPDATES_DB.tmp #cat $tmpfile | sort -uf > $UPDATES_DB.tmp
#rm -f $tmpfile #rm -f $tmpfile
@ -312,6 +312,7 @@ if [ ! "$skip_parsing" ]; then
lastpkg=$pkg lastpkg=$pkg
lastver=$ver lastver=$ver
done < $UPDATES_DB.tmp done < $UPDATES_DB.tmp
fi
rm -f $UPDATES_DB.tmp rm -f $UPDATES_DB.tmp
fi fi

View File

@ -1,4 +1,8 @@
#!/usr/bin/python3 #!/usr/bin/python3
#
# repology-openmamba.py - find upstream packages updates from repology.org
# Copyright (c) 2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
import json, urllib.request, time import json, urllib.request, time
@ -6,6 +10,10 @@ import json, urllib.request, time
with open("/var/ftp/pub/openmamba/devel/legacy") as f: with open("/var/ftp/pub/openmamba/devel/legacy") as f:
legacy_packages = f.read().splitlines() legacy_packages = f.read().splitlines()
with open("/var/ftp/pub/openmamba/devel/ignore") as f:
data = json.loads(f.read())
ignored_packages = data["repology"]
from_package = "" from_package = ""
while True: while True:
#print("fetching https://repology.org/api/v1/projects/" + from_package + "?inrepo=openmamba&outdated=1") #print("fetching https://repology.org/api/v1/projects/" + from_package + "?inrepo=openmamba&outdated=1")
@ -24,7 +32,7 @@ while True:
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" and openmamba_srcname is None:
if not p["srcname"] in legacy_packages: if not p["srcname"] in legacy_packages and not p["srcname"] in ignored_packages:
openmamba_version = p["version"] openmamba_version = p["version"]
openmamba_srcname = p["srcname"] openmamba_srcname = p["srcname"]
elif p["status"] == "newest": elif p["status"] == "newest":