autodist-upstream-updates: added support for blacklisting

This commit is contained in:
Silvan Calarco 2017-06-19 14:48:01 +02:00
parent 681b2e5ec7
commit 68bacbc599

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-2014 by Silvan Calarco <silvan.calarco@mambasoft.it> # Copyright (c) 2004-2016 by Silvan Calarco <silvan.calarco@mambasoft.it>
# #
#[ -r /etc/sysconfig/openmamba-central ] || { #[ -r /etc/sysconfig/openmamba-central ] || {
@ -88,7 +88,7 @@ function version_compare()
function version_find_bigger() function version_find_bigger()
{ {
local VER1 VER2 FPOS CUTVER1 CUTVER2 local VER1 VER2 FPOS CUTVER1 CUTVER2
VER1=$1 VER1=$1
VER2=$2 VER2=$2
FPOS=1 FPOS=1
@ -157,6 +157,7 @@ CONFIG_DIR=$CACHE_DIR
UPDATES_DB=$CACHE_DIR/upstream-updates UPDATES_DB=$CACHE_DIR/upstream-updates
ALIASES_DB=$CACHE_DIR/aliases ALIASES_DB=$CACHE_DIR/aliases
MANUALVER_DB=$CACHE_DIR/manualver MANUALVER_DB=$CACHE_DIR/manualver
BLACKLIST_DB_PREFIX=$CACHE_DIR/blacklist.
[ -s $PKGLIST_FILE ] || { [ -s $PKGLIST_FILE ] || {
echo "Error: file $PKGLIST_FILE is missing or empty; aborting." >&2 echo "Error: file $PKGLIST_FILE is missing or empty; aborting." >&2
@ -180,9 +181,12 @@ parse_arch_linux() {
while read line; do while read line; do
line=`echo $line | sed "s|.*href=\"\([^\"]*\)\">.*|\1|"` line=`echo $line | sed "s|.*href=\"\([^\"]*\)\">.*|\1|"`
pkg=`echo $line | sed "s|\(.*\)-[^-]*-[^-]*-[^-]*|\1|"` pkg=`echo $line | sed "s|\(.*\)-[^-]*-[^-]*-[^-]*|\1|"`
ver=`echo $line | sed "s|.*-\([^-]*\)-[^-]*-[^-]*|\1|;s|.*%3a||"` ver=`echo $line | sed "s|.*-\([^-]*\)-[^-]*-[^-]*|\1|;s|.*%3a||i;s|%2b.*||i"`
alias=`grep "^$pkg " $ALIASES_DB` alias=`grep "^$pkg " $ALIASES_DB`
# Skip blackisted
if [ -e ${BLACKLIST_DB_PREFIX}arch ]; then
grep -q "^$pkg$" ${BLACKLIST_DB_PREFIX}arch && continue
fi
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB` [ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
[ "$alias" ] && pkgalias=${alias/* /} || pkgalias=$pkg [ "$alias" ] && pkgalias=${alias/* /} || pkgalias=$pkg
line=`grep -i "^$pkgalias:" $buildstmp || grep -i "^lib$pkgalias:" $buildstmp || grep -i " $pkgalias[^-_A-Za-z0-9]" $buildstmp` line=`grep -i "^$pkgalias:" $buildstmp || grep -i "^lib$pkgalias:" $buildstmp || grep -i " $pkgalias[^-_A-Za-z0-9]" $buildstmp`
@ -206,6 +210,9 @@ parse_xorg() {
if [ "$line" ]; then if [ "$line" ]; then
ver=`echo $line | sed "s|.*-||"` ver=`echo $line | sed "s|.*-||"`
pkg="${line/-$ver}" pkg="${line/-$ver}"
if [ -e ${BLACKLIST_DB_PREFIX}xorg ]; then
grep -q "^$pkg$" ${BLACKLIST_DB_PREFIX}xorg && continue
fi
alias=`grep "^$pkg " $ALIASES_DB` alias=`grep "^$pkg " $ALIASES_DB`
if [ ! "$alias" -a "${pkg:0:5}" == "xf86-" ]; then if [ ! "$alias" -a "${pkg:0:5}" == "xf86-" ]; then
alias="$pkg xorg-drv-${pkg/xf86-}" alias="$pkg xorg-drv-${pkg/xf86-}"
@ -228,6 +235,9 @@ parse_gnome() {
IFS=":" IFS=":"
set -- $line set -- $line
pkg="$2" pkg="$2"
if [ -e ${BLACKLIST_DB_PREFIX}gnome ]; then
grep -q "^$pkg$" ${BLACKLIST_DB_PREFIX}gnome && continue
fi
ver="$3" ver="$3"
alias=`grep "^$pkg " $ALIASES_DB` alias=`grep "^$pkg " $ALIASES_DB`
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB` [ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
@ -249,7 +259,7 @@ parse_gnome() {
parse_distromatic() { parse_distromatic() {
# parse distrowatch.com packages list # parse distrowatch.com packages list
[ "$quiet" ] || echo "Parsing Distrowatch packages list..." >&2 [ "$quiet" ] || echo "Parsing Distrowatch packages list..." >&2
SOURCEURL="http://distrowatch.com/packages.php" SOURCEURL="http://distrowatch.gds.tuwien.ac.at/packages.php"
lynx -width 300 -dump $SOURCEURL | lynx -width 300 -dump $SOURCEURL |
while read line; do while read line; do
[ "`echo $line | grep "Package Version Note"`" ] && start_print=1 [ "`echo $line | grep "Package Version Note"`" ] && start_print=1