autodist-upstream-updates: support for archlinux

This commit is contained in:
Silvan Calarco 2013-04-22 11:57:31 +02:00
parent 2036752464
commit 9778194a65

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-2012 by Silvan Calarco <silvan.calarco@mambasoft.it> # Copyright (c) 2004-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
# #
#[ -r /etc/sysconfig/openmamba-central ] || { #[ -r /etc/sysconfig/openmamba-central ] || {
@ -44,7 +44,7 @@ function usage()
echo " -m: report missing packages only" echo " -m: report missing packages only"
echo " -u: output not up-to-date packages only" echo " -u: output not up-to-date packages only"
echo " -q: produces quite output" echo " -q: produces quite output"
echo " -r repository: specify the repository (default: devel)" echo " -r repository: specify the distromatic base (default: devel)"
echo " -o repository: specify the repository for output data (default: same as base repository)" echo " -o repository: specify the repository for output data (default: same as base repository)"
echo echo
} }
@ -174,11 +174,14 @@ buildstmp=`mktemp -q -t autodist-upstream-updates.XXXXXXXX`
tail -n+2 $BUILDS_FILE > $buildstmp tail -n+2 $BUILDS_FILE > $buildstmp
# parse Arch Linux package list # parse Arch Linux package list
[ "$quiet" ] || echo "Parsing Arch Linux packages list..." >&2 [ "$quiet" ] || echo -n "Parsing Arch Linux packages list..." >&2
curl -s "https://www.archlinux.org/packages/?sort=-last_update&arch=i686&q=&maintainer=&last_update=&flagged=&limit=all" | \ for page in `seq 1 45`; do
grep "View package details" | \ SOURCEURL="https://www.archlinux.org/packages/?page=$page&sort=-last_update&q=&arch=i686&maintainer=&flagged="
while read line; do curl -s "$SOURCEURL" | \
grep "View package details" | \
while read line; do
line=`echo $line | html2text -nobs` line=`echo $line | html2text -nobs`
echo $line
set -- $line set -- $line
pkg=$3 pkg=$3
ver=${4/-*} ver=${4/-*}
@ -186,18 +189,23 @@ while read line; do
alias=`grep "^$pkg" $ALIASES_DB` alias=`grep "^$pkg" $ALIASES_DB`
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB` [ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
[ "$alias" ] && pkg=$alias [ "$alias" ] && pkg=$alias
line=`grep -i "^$pkg:" $buildstmp || grep -i "^lib$pkg:" $buildstmp` line=`grep -i "^$pkg:" $buildstmp || grep -i "^lib$pkg:" $buildstmp || grep -i " $pkg[^-_A-Za-z0-9]" $buildstmp`
# grep -i " $pkg[^-_A-Za-z0-9]" $buildstmp
if [ "$line" ]; then if [ "$line" ]; then
pkg=${line/:*} pkg=${line/:*}
[ "$pkg" -a "$ver" ] && echo "$pkg $ver ${alias/* /}" >> $tmpfile echo "$pkg"
[ "$pkg" -a "$ver" ] && {
echo "$pkg $ver $SOURCEURL ${alias/* /}"
echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
}
fi fi
done
done done
rm -f $buildstmp rm -f $buildstmp
# parse X.org stable packages list # parse X.org stable packages list
[ "$quiet" ] || echo "Parsing X.org release ftp directory..." >&2 [ "$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 | SOURCEURL="ftp://ftp.x.org/pub/$XORG_RELEASE/src/everything/"
curl -s $SOURCEURL -l | sed "s|\.tar\..*||" | sort -u |
while read line; do while read line; do
if [ "$line" ]; then if [ "$line" ]; then
ver=`echo $line | sed "s|.*-||"` ver=`echo $line | sed "s|.*-||"`
@ -208,14 +216,15 @@ while read line; do
else else
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB` [ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
fi fi
[ "$pkg" -a "$ver" ] && echo "$pkg $ver ${alias/* /}" >> $tmpfile [ "$pkg" -a "$ver" ] && echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
fi fi
done done
# parse Gnome stable packages list # parse Gnome stable packages list
[ "$quiet" ] || echo "Parsing GNOME stable versions file..." >&2 [ "$quiet" ] || echo "Parsing GNOME stable versions file..." >&2
for f in versions-stable versions-stable-extras; do for f in versions-stable versions-stable-extras; do
curl -s http://people.gnome.org/~vuntz/tmp/versions/$f | grep -v "^#" | SOURCEURL="http://people.gnome.org/~vuntz/tmp/versions/$f"
curl -s $SOURCEURL | grep -v "^#" |
while read line; do while read line; do
if [ "$line" ]; then if [ "$line" ]; then
IFS=":" IFS=":"
@ -224,14 +233,15 @@ for f in versions-stable versions-stable-extras; do
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`
[ "$pkg" -a "$ver" ] && echo "$pkg $ver ${alias/* /}" >> $tmpfile [ "$pkg" -a "$ver" ] && echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
fi fi
done done
done done
# parse distrowatch.com packages list # parse distrowatch.com packages list
[ "$quiet" ] || echo "Parsing Distrowatch packages list..." >&2 [ "$quiet" ] || echo "Parsing Distrowatch packages list..." >&2
lynx -width 300 -dump http://distrowatch.com/packages.php | SOURCEURL="http://distrowatch.com/packages.php"
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
[ "`echo $line | grep "____________________"`" ] && unset start_print [ "`echo $line | grep "____________________"`" ] && unset start_print
@ -241,7 +251,7 @@ while read line; do
ver="${2/\[*\]/}" ver="${2/\[*\]/}"
alias=`grep "^$pkg " $ALIASES_DB` alias=`grep "^$pkg " $ALIASES_DB`
[ "$pkg" != "chromium" ] && \ [ "$pkg" != "chromium" ] && \
echo "$pkg $ver ${alias/* /}" >> $tmpfile echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
} }
done done
@ -250,7 +260,7 @@ rm -f $tmpfile
> $UPDATES_DB > $UPDATES_DB
unset lastpkg unset lastpkg
while read pkg ver alias; do while read pkg ver upsource alias; do
# skip updates to unstable versions # skip updates to unstable versions
unset found_beta unset found_beta
for b in alpha beta rc "~"; do for b in alpha beta rc "~"; do
@ -263,10 +273,10 @@ while read pkg ver alias; do
vercmp=$? vercmp=$?
if [ $vercmp -eq 2 ]; then if [ $vercmp -eq 2 ]; then
sed -i "/^$lastpkg $lastver /d" $UPDATES_DB sed -i "/^$lastpkg $lastver /d" $UPDATES_DB
echo "$pkg $ver $alias" >> $UPDATES_DB echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
fi fi
else else
echo "$pkg $ver $alias" >> $UPDATES_DB echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
fi fi
lastpkg=$pkg lastpkg=$pkg
lastver=$ver lastver=$ver
@ -275,7 +285,7 @@ rm -f $UPDATES_DB.tmp
> $UPDATES_DB.missing > $UPDATES_DB.missing
> $BUILDLIST_FILE > $BUILDLIST_FILE
while read pkg ver alias; do while read pkg ver upsource alias; do
unset pkgline unset pkgline
unset found_manual unset found_manual
unset found_alias unset found_alias
@ -310,7 +320,7 @@ while read pkg ver alias; do
[ "$found_manual" ] && pkgname=$3 [ "$found_manual" ] && pkgname=$3
[ "$found_alias" -o "$found_manual" ] && nameadd="$pkg" || unset nameadd [ "$found_alias" -o "$found_manual" ] && nameadd="$pkg" || unset nameadd
unset veradd unset veradd
[ ${vercmp} = 2 ] && veradd="<font color=red>$ver</font>" [ ${vercmp} = 2 ] && veradd="<a href=\"$upsource\"><font color=red>$ver</font></a>"
[ ${vercmp} = 1 ] && veradd="$ver" [ ${vercmp} = 1 ] && veradd="$ver"
[ "$veradd" -o "$nameadd" ] && { [ "$veradd" -o "$nameadd" ] && {
[ "$veradd" -a "$nameadd" ] && \ [ "$veradd" -a "$nameadd" ] && \
@ -324,12 +334,12 @@ while read pkg ver alias; do
fi fi
[ $vercmp = 2 ] && { [ $vercmp = 2 ] && {
if [ "$found_alias" ]; then if [ "$found_alias" ]; then
echo "$alias +$ver 0" >> $BUILDLIST_FILE echo "$alias +$ver 0 $upsource" >> $BUILDLIST_FILE
else else
echo "$pkg +$ver 0" >> $BUILDLIST_FILE echo "$pkg +$ver 0 $upsource" >> $BUILDLIST_FILE
fi fi
} }
elif [ ! "$pkgline" ]; then elif [ ! "$pkgline" ]; then
echo "$pkg ($ver)" >> $UPDATES_DB.missing echo "$pkg ($ver) $upsource" >> $UPDATES_DB.missing
fi fi
done < $UPDATES_DB done < $UPDATES_DB