repology-openmamba.py: support for ignore json list; autodist-upstream-updates: replace usage of obsolete tempfile with mktemp
This commit is contained in:
parent
b6d3b83d1e
commit
b451ee800b
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# 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 ] || {
|
||||
@ -46,7 +46,7 @@ get_job_vector() {
|
||||
local JNAME_ESCAPED=`echo $JNAME | tr - _ | tr . _ | tr @ _`
|
||||
|
||||
# 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
|
||||
echo "echo \${$JNAME_ESCAPED[*]}" > $jobtmpfile
|
||||
JOB=(`. $jobtmpfile`)
|
||||
@ -285,33 +285,34 @@ if [ ! "$skip_parsing" ]; then
|
||||
#parse_gnome
|
||||
#parse_distromatic
|
||||
/usr/share/autodist/repology-openmamba.py > $UPDATES_DB.tmp
|
||||
if [ $? -eq 0 ]; then
|
||||
#cat $tmpfile | sort -uf > $UPDATES_DB.tmp
|
||||
#rm -f $tmpfile
|
||||
|
||||
#cat $tmpfile | sort -uf > $UPDATES_DB.tmp
|
||||
#rm -f $tmpfile
|
||||
|
||||
> $UPDATES_DB
|
||||
unset lastpkg
|
||||
while read pkg ver upsource alias; do
|
||||
# skip updates to unstable versions
|
||||
unset found_beta
|
||||
for b in alpha beta rc "~"; do
|
||||
[ "${ver/$b}" != "${ver}" ] && found_beta=1
|
||||
done
|
||||
[ "$found_beta" ] && continue
|
||||
if [ "$pkg" = "$lastpkg" ]; then
|
||||
# echo "Warning: duplicate found: $pkg lastver: $lastver ver: $ver" >&2
|
||||
version_find_bigger $lastver $ver
|
||||
vercmp=$?
|
||||
if [ $vercmp -eq 2 ]; then
|
||||
sed -i "/^$lastpkg $lastver /d" $UPDATES_DB
|
||||
> $UPDATES_DB
|
||||
unset lastpkg
|
||||
while read pkg ver upsource alias; do
|
||||
# skip updates to unstable versions
|
||||
unset found_beta
|
||||
for b in alpha beta rc "~"; do
|
||||
[ "${ver/$b}" != "${ver}" ] && found_beta=1
|
||||
done
|
||||
[ "$found_beta" ] && continue
|
||||
if [ "$pkg" = "$lastpkg" ]; then
|
||||
# echo "Warning: duplicate found: $pkg lastver: $lastver ver: $ver" >&2
|
||||
version_find_bigger $lastver $ver
|
||||
vercmp=$?
|
||||
if [ $vercmp -eq 2 ]; then
|
||||
sed -i "/^$lastpkg $lastver /d" $UPDATES_DB
|
||||
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
|
||||
fi
|
||||
else
|
||||
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
|
||||
fi
|
||||
else
|
||||
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
|
||||
fi
|
||||
lastpkg=$pkg
|
||||
lastver=$ver
|
||||
done < $UPDATES_DB.tmp
|
||||
lastpkg=$pkg
|
||||
lastver=$ver
|
||||
done < $UPDATES_DB.tmp
|
||||
fi
|
||||
rm -f $UPDATES_DB.tmp
|
||||
fi
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
#!/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
|
||||
|
||||
@ -6,6 +10,10 @@ import json, urllib.request, time
|
||||
with open("/var/ftp/pub/openmamba/devel/legacy") as f:
|
||||
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 = ""
|
||||
while True:
|
||||
#print("fetching https://repology.org/api/v1/projects/" + from_package + "?inrepo=openmamba&outdated=1")
|
||||
@ -24,7 +32,7 @@ while True:
|
||||
newest_repos = []
|
||||
for p in data[k]:
|
||||
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_srcname = p["srcname"]
|
||||
elif p["status"] == "newest":
|
||||
|
Loading…
Reference in New Issue
Block a user