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
#
# 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 ] || {
@ -44,7 +44,7 @@ function usage()
echo " -m: report missing packages only"
echo " -u: output not up-to-date packages only"
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
}
@ -174,30 +174,38 @@ buildstmp=`mktemp -q -t autodist-upstream-updates.XXXXXXXX`
tail -n+2 $BUILDS_FILE > $buildstmp
# parse Arch Linux package list
[ "$quiet" ] || echo "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" | \
grep "View package details" | \
while read line; do
line=`echo $line | html2text -nobs`
set -- $line
pkg=$3
ver=${4/-*}
ver=${ver/*:}
alias=`grep "^$pkg" $ALIASES_DB`
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
[ "$alias" ] && pkg=$alias
line=`grep -i "^$pkg:" $buildstmp || grep -i "^lib$pkg:" $buildstmp`
# grep -i " $pkg[^-_A-Za-z0-9]" $buildstmp
if [ "$line" ]; then
pkg=${line/:*}
[ "$pkg" -a "$ver" ] && echo "$pkg $ver ${alias/* /}" >> $tmpfile
fi
[ "$quiet" ] || echo -n "Parsing Arch Linux packages list..." >&2
for page in `seq 1 45`; do
SOURCEURL="https://www.archlinux.org/packages/?page=$page&sort=-last_update&q=&arch=i686&maintainer=&flagged="
curl -s "$SOURCEURL" | \
grep "View package details" | \
while read line; do
line=`echo $line | html2text -nobs`
echo $line
set -- $line
pkg=$3
ver=${4/-*}
ver=${ver/*:}
alias=`grep "^$pkg" $ALIASES_DB`
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
[ "$alias" ] && pkg=$alias
line=`grep -i "^$pkg:" $buildstmp || grep -i "^lib$pkg:" $buildstmp || grep -i " $pkg[^-_A-Za-z0-9]" $buildstmp`
if [ "$line" ]; then
pkg=${line/:*}
echo "$pkg"
[ "$pkg" -a "$ver" ] && {
echo "$pkg $ver $SOURCEURL ${alias/* /}"
echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
}
fi
done
done
rm -f $buildstmp
# 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 |
SOURCEURL="ftp://ftp.x.org/pub/$XORG_RELEASE/src/everything/"
curl -s $SOURCEURL -l | sed "s|\.tar\..*||" | sort -u |
while read line; do
if [ "$line" ]; then
ver=`echo $line | sed "s|.*-||"`
@ -208,14 +216,15 @@ while read line; do
else
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
fi
[ "$pkg" -a "$ver" ] && echo "$pkg $ver ${alias/* /}" >> $tmpfile
[ "$pkg" -a "$ver" ] && echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
fi
done
# parse Gnome stable packages list
[ "$quiet" ] || echo "Parsing GNOME stable versions file..." >&2
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
if [ "$line" ]; then
IFS=":"
@ -224,14 +233,15 @@ for f in versions-stable versions-stable-extras; do
ver="$3"
alias=`grep "^$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
done
done
# parse distrowatch.com packages list
[ "$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
[ "`echo $line | grep "Package Version Note"`" ] && start_print=1
[ "`echo $line | grep "____________________"`" ] && unset start_print
@ -241,7 +251,7 @@ while read line; do
ver="${2/\[*\]/}"
alias=`grep "^$pkg " $ALIASES_DB`
[ "$pkg" != "chromium" ] && \
echo "$pkg $ver ${alias/* /}" >> $tmpfile
echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
}
done
@ -250,7 +260,7 @@ rm -f $tmpfile
> $UPDATES_DB
unset lastpkg
while read pkg ver alias; do
while read pkg ver upsource alias; do
# skip updates to unstable versions
unset found_beta
for b in alpha beta rc "~"; do
@ -263,10 +273,10 @@ while read pkg ver alias; do
vercmp=$?
if [ $vercmp -eq 2 ]; then
sed -i "/^$lastpkg $lastver /d" $UPDATES_DB
echo "$pkg $ver $alias" >> $UPDATES_DB
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
fi
else
echo "$pkg $ver $alias" >> $UPDATES_DB
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
fi
lastpkg=$pkg
lastver=$ver
@ -275,7 +285,7 @@ rm -f $UPDATES_DB.tmp
> $UPDATES_DB.missing
> $BUILDLIST_FILE
while read pkg ver alias; do
while read pkg ver upsource alias; do
unset pkgline
unset found_manual
unset found_alias
@ -310,7 +320,7 @@ while read pkg ver alias; do
[ "$found_manual" ] && pkgname=$3
[ "$found_alias" -o "$found_manual" ] && nameadd="$pkg" || unset nameadd
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"
[ "$veradd" -o "$nameadd" ] && {
[ "$veradd" -a "$nameadd" ] && \
@ -324,12 +334,12 @@ while read pkg ver alias; do
fi
[ $vercmp = 2 ] && {
if [ "$found_alias" ]; then
echo "$alias +$ver 0" >> $BUILDLIST_FILE
echo "$alias +$ver 0 $upsource" >> $BUILDLIST_FILE
else
echo "$pkg +$ver 0" >> $BUILDLIST_FILE
echo "$pkg +$ver 0 $upsource" >> $BUILDLIST_FILE
fi
}
elif [ ! "$pkgline" ]; then
echo "$pkg ($ver)" >> $UPDATES_DB.missing
echo "$pkg ($ver) $upsource" >> $UPDATES_DB.missing
fi
done < $UPDATES_DB