openmamba-dw-checklist: update cron file and script and rename to openmamba-upstream-updates

This commit is contained in:
Silvan Calarco 2012-03-12 15:45:30 +01:00
parent d88b12c6e3
commit ca0db5289e
3 changed files with 118 additions and 48 deletions

View File

@ -1,14 +1,20 @@
#!/bin/bash
#
# Distrowatch packages update checker
# Copyright (c) 2004-2009 by Silvan Calarco <silvan.calarco@mambasoft.it>
# openmamba upstream updates - find upstream packages updates from different internet resources
# Based on distrowatch packages update checker
# Copyright (c) 2004-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
[ -r /etc/sysconfig/openmamba-central ] || {
echo "Error: this program must be run as root; aborting." >&2
exit 1
}
. /etc/sysconfig/openmamba-central
DISTROMATIC_PREFIX=/distribution/distromatic.html?
DISTROMATIC_REPOSITORY=devel
DISTDB=/etc/autodist/distdb
DISTDBDIR=/etc/autodist/distdb.d
XORG_RELEASE=X11R7.6
[ -r $DISTDB ] && {
. $DISTDB
@ -30,15 +36,18 @@ DISTDBDIR=/etc/autodist/distdb.d
function usage()
{
echo "openmamba-dw-checklist [-h|-m][-r repository]"
echo "openmamba-upstream-updates - finds upstream packages updates from different internet resources"
echo
echo "Usage:"
echo "openmamba-upstream-updates [-h|-m][-r repository]"
echo
echo " -h: generate distromatic HTML output"
echo " -m: show missing packages only"
echo " -q: produces quite output"
echo " -r repository: specify the repository (default: devel)"
echo " -o repository: specify the repository for output data (default: devel-autodist)"
echo
}
echo "openmamba-dw-checklist - distrowatch packages update status file creator" >&2
get_job_vector() {
local JNAME=$1
@ -72,17 +81,17 @@ function version_compare()
A=$1
B=$2
if [ ${A/[a-zA-Z_]*} -gt ${B/[a-zA-Z_]*} ]; then
return 1
elif [ ${A/[a-zA-Z_]*} -lt ${B/[a-zA-Z_]*} ]; then
return 2
else
# if [ ${A/[a-zA-Z_]*} -gt ${B/[a-zA-Z_]*} ]; then
# return 1
# elif [[ "$A" < "$B" ]]; then
# return 2
# else
if [[ "$A" > "$B" ]]; then
return 1
elif [[ "$A" < "$B" ]]; then
return 2
fi
fi
# fi
return 0
}
@ -133,23 +142,57 @@ while [ "$1" ]; do
DISTROMATIC_REPOSITORY=$2
shift
;;
-q) quiet=1 ;;
*) echo "Error: invalid option $1."; usage; exit 1 ;;
esac
shift
done
CACHE_DIR=${local_ftp}/$DISTROMATIC_REPOSITORY/autoupdate/
PKGLIST_FILE=${local_ftp}/$DISTROMATIC_REPOSITORY/srcpkglist
BUILDLIST_FILE=$CACHE_DIR/distrowatch.in
BUILDLIST_FILE=$CACHE_DIR/upstream-updates.in
CONFIG_DIR=$CACHE_DIR
DISTROWATCH_DB=$CACHE_DIR/distrowatch.db
UPDATES_DB=$CACHE_DIR/upstream-updates
ALIASES_DB=$CACHE_DIR/aliases
MANUALVER_DB=$CACHE_DIR/manualver
> $DISTROWATCH_DB
> $DISTROWATCH_DB.missing
> $BUILDLIST_FILE
tmpfile=`tempfile`
# parse X.org stable packages list
[ "$quiet" ] || echo "Parsing X.org release ftp directory..." >&2
curl -s ftp://ftp.x.org/pub/$XORG_RELEASE/src/everything/ -l | sed "s|\.tar\..*||" | sort -u |
while read line; do
if [ "$line" ]; then
ver=`echo $line | sed "s|.*-||"`
pkg="${line/-$ver}"
alias=`grep "^$pkg " $ALIASES_DB`
if [ ! "$alias" -a "${pkg:0:5}" == "xf86-" ]; then
alias="$pkg xorg-drv-${pkg/xf86-}"
else
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
fi
[ "$pkg" -a "$ver" ] && echo "$pkg $ver ${alias/* /}" >> $tmpfile
fi
done
# parse Gnome stable packages list
[ "$quiet" ] || echo "Parsing GNOME stable versions file..." >&2
curl -s http://people.gnome.org/~vuntz/tmp/versions/versions-stable | grep -v "^#" |
while read line; do
if [ "$line" ]; then
IFS=":"
set -- $line
pkg="$2"
ver="$3"
alias=`grep "^$pkg " $ALIASES_DB`
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
[ "$pkg" -a "$ver" ] && echo "$pkg $ver ${alias/* /}" >> $tmpfile
fi
done
# parse distrowatch.com packages list
[ "$quiet" ] || echo "Parsing Distrowatch packages list..." >&2
lynx -width 300 -dump http://distrowatch.com/packages.php |
while read line; do
[ "`echo $line | grep "Package Version Note"`" ] && start_print=1
@ -159,10 +202,24 @@ while read line; do
pkg="${1/\[*\]/}"
ver="${2/\[*\]/}"
alias=`grep "^$pkg " $ALIASES_DB`
echo "$pkg $ver ${alias/* /}" >> $DISTROWATCH_DB
echo "$pkg $ver ${alias/* /}" >> $tmpfile
}
done
cat $tmpfile | sort -uf > $UPDATES_DB
rm -f $tmpfile
unset lastpkg
while read pkg ver alias; do
if [ "$pkg" = "$lastpkg" ]; then
echo "Warning: duplicate found: $pkg lastver: $lastver ver: $ver" >&2
fi
lastpkg=$pkg
lastver=$ver
done < $UPDATES_DB
> $UPDATES_DB.missing
> $BUILDLIST_FILE
while read pkg ver alias; do
unset pkgline
unset found_manual
@ -177,6 +234,14 @@ while read pkg ver alias; do
get_job_vector $pkg
lastjob=${#JOB_PKGS[*]}
pkgline=`grep "^${JOB_PKGS[$lastjob-1]} " $PKGLIST_FILE`
[ "$pkgline" ] || {
get_job_vector lib${pkg}
lastjob=${#JOB_PKGS[*]}
pkgline=`grep "^${JOB_PKGS[$lastjob-1]} " $PKGLIST_FILE` && {
found_alias=1
alias=lib${pkg}
}
}
fi
fi
if [ "$pkgline" ]; then
@ -187,7 +252,6 @@ while read pkg ver alias; do
vercmp=$?
[ "$found_manual" ] && pkgname=$3
if [ ! "$missing_only" ]; then
if [ "$distromatic_html" = "1" ]; then
[ "$found_alias" -o "$found_manual" ] && nameadd="$pkg" || unset nameadd
unset veradd
[ ${vercmp} = 2 ] && veradd="<font color=red>$ver</font>"
@ -198,7 +262,11 @@ while read pkg ver alias; do
verappend="($nameadd;$veradd)" ||
verappend="(${nameadd}${veradd})"
} || unset verappend
if [ "$distromatic_html" = "1" ]; then
echo "<a href=\"${DISTROMATIC_PREFIX}tag=${DISTROMATIC_REPOSITORY}&pkg=${JOB_PKGS[0]}.source\">${JOB_PKGS[0]} $pkgver</a> $verappend<br>"
else
echo "$pkg $pkgver ($ver)"
fi
[ $vercmp = 2 ] && {
if [ "$found_alias" ]; then
echo "$alias +$ver 0" >> $BUILDLIST_FILE
@ -206,11 +274,8 @@ while read pkg ver alias; do
echo "$pkg +$ver 0" >> $BUILDLIST_FILE
fi
}
else
echo "$pkg $pkgver ($ver)"
fi
fi
else
echo "$pkg ($ver)" >> $DISTROWATCH_DB.missing
echo "$pkg ($ver)" >> $UPDATES_DB.missing
fi
done < $DISTROWATCH_DB
done < $UPDATES_DB

View File

@ -1,11 +0,0 @@
#!/bin/bash
#
# openmamba-dw-checklist daily cron script
# (c) 2008-2009 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/sysconfig/openmamba-central
REPOSITORY=devel-kde4
openmamba-dw-checklist -h -r $REPOSITORY > $local_ftp/distromatic/$REPOSITORY/_popular.html
REPOSITORY=milestone1-1.1
openmamba-dw-checklist -h -r $REPOSITORY > $local_ftp/distromatic/$REPOSITORY/_popular.html

View File

@ -0,0 +1,16 @@
#!/bin/bash
#
# openmamba-upstream-updates daily cron script
# (c) 2008-2010 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/sysconfig/openmamba-central
REPOSITORY=devel
/usr/sbin/openmamba-upstream-updates -h -r $REPOSITORY > $local_ftp/distromatic/$REPOSITORY/_popular.html
REPOSITORY=milestone1-1.1
/usr/sbin/openmamba-upstream-updates -h -r $REPOSITORY > $local_ftp/distromatic/$REPOSITORY/_popular.html
REPOSITORY=milestone2
/usr/sbin/openmamba-upstream-updates -h -r $REPOSITORY > $local_ftp/distromatic/$REPOSITORY/_popular.html
exit 0