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
|
#!/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,33 +285,34 @@ 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
|
||||||
|
#rm -f $tmpfile
|
||||||
|
|
||||||
#cat $tmpfile | sort -uf > $UPDATES_DB.tmp
|
> $UPDATES_DB
|
||||||
#rm -f $tmpfile
|
unset lastpkg
|
||||||
|
while read pkg ver upsource alias; do
|
||||||
> $UPDATES_DB
|
# skip updates to unstable versions
|
||||||
unset lastpkg
|
unset found_beta
|
||||||
while read pkg ver upsource alias; do
|
for b in alpha beta rc "~"; do
|
||||||
# skip updates to unstable versions
|
[ "${ver/$b}" != "${ver}" ] && found_beta=1
|
||||||
unset found_beta
|
done
|
||||||
for b in alpha beta rc "~"; do
|
[ "$found_beta" ] && continue
|
||||||
[ "${ver/$b}" != "${ver}" ] && found_beta=1
|
if [ "$pkg" = "$lastpkg" ]; then
|
||||||
done
|
# echo "Warning: duplicate found: $pkg lastver: $lastver ver: $ver" >&2
|
||||||
[ "$found_beta" ] && continue
|
version_find_bigger $lastver $ver
|
||||||
if [ "$pkg" = "$lastpkg" ]; then
|
vercmp=$?
|
||||||
# echo "Warning: duplicate found: $pkg lastver: $lastver ver: $ver" >&2
|
if [ $vercmp -eq 2 ]; then
|
||||||
version_find_bigger $lastver $ver
|
sed -i "/^$lastpkg $lastver /d" $UPDATES_DB
|
||||||
vercmp=$?
|
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
|
||||||
if [ $vercmp -eq 2 ]; then
|
fi
|
||||||
sed -i "/^$lastpkg $lastver /d" $UPDATES_DB
|
else
|
||||||
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
|
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
|
||||||
fi
|
fi
|
||||||
else
|
lastpkg=$pkg
|
||||||
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
|
lastver=$ver
|
||||||
fi
|
done < $UPDATES_DB.tmp
|
||||||
lastpkg=$pkg
|
fi
|
||||||
lastver=$ver
|
|
||||||
done < $UPDATES_DB.tmp
|
|
||||||
rm -f $UPDATES_DB.tmp
|
rm -f $UPDATES_DB.tmp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -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":
|
||||||
|
Loading…
Reference in New Issue
Block a user