autodist-upstream-updates: fixes and some code rework
This commit is contained in:
parent
094174a2b6
commit
dd9fb71c1b
@ -43,6 +43,7 @@ function usage()
|
||||
echo
|
||||
echo " -h: generate distromatic HTML output"
|
||||
echo " -m: report missing packages only"
|
||||
echo " -s: skip fetching and parsing upstream updates"
|
||||
echo " -u: output not up-to-date packages only"
|
||||
echo " -q: produces quite output"
|
||||
echo " -r repository: specify the distromatic base (default: devel)"
|
||||
@ -78,10 +79,10 @@ function version_compare()
|
||||
A=$1
|
||||
B=$2
|
||||
|
||||
if [[ ${1} =~ "^[0-9]+$" && ${2} =~ "^[0-9]+$" ]]; then
|
||||
if [ ${A/[a-zA-Z_]*} -gt ${B/[a-zA-Z_]*} ]; then
|
||||
if [[ ${1} =~ ^[0-9]+$ && ${2} =~ ^[0-9]+$ ]]; then
|
||||
if [ $((10#${A/[a-zA-Z_]*})) -gt $((10#${B/[a-zA-Z_]*})) ]; then
|
||||
return 1
|
||||
elif [ ${A/[a-zA-Z_]*} -lt ${B/[a-zA-Z_]*} ]; then
|
||||
elif [ $((10#${A/[a-zA-Z_]*})) -lt $((10#${B/[a-zA-Z_]*})) ]; then
|
||||
return 2
|
||||
fi
|
||||
else
|
||||
@ -132,6 +133,7 @@ while [ "$1" ]; do
|
||||
else
|
||||
missing_only=1
|
||||
fi ;;
|
||||
-s) skip_parsing=1 ;;
|
||||
-u) needupdate_only=1 ;;
|
||||
-r) [ "$2" ] || {
|
||||
echo "Error: option -r requires repository name as parameter"
|
||||
@ -166,17 +168,15 @@ UPDATES_DB=$CACHE_DIR/upstream-updates
|
||||
ALIASES_DB=$CACHE_DIR/aliases
|
||||
MANUALVER_DB=$CACHE_DIR/manualver
|
||||
|
||||
tmpfile=`mktemp -q -t autodist-upstream-updates.XXXXXXXX`
|
||||
buildstmp=`mktemp -q -t autodist-upstream-updates.XXXXXXXX`
|
||||
tail -n+2 $BUILDS_FILE > $buildstmp
|
||||
|
||||
# parse Arch Linux package list
|
||||
[ "$quiet" ] || echo -n "Parsing Arch Linux packages list..." >&2
|
||||
#for page in `seq 1 45`; do
|
||||
for rep in core community extra; do
|
||||
# SOURCEURL="https://www.archlinux.org/packages/?page=$page&sort=-last_update&q=&arch=i686&maintainer=&flagged="
|
||||
parse_arch_linux() {
|
||||
# parse Arch Linux package list
|
||||
[ "$quiet" ] || echo -n "Parsing Arch Linux packages list..." >&2
|
||||
#for page in `seq 1 45`; do
|
||||
for rep in core community extra; do
|
||||
# SOURCEURL="https://www.archlinux.org/packages/?page=$page&sort=-last_update&q=&arch=i686&maintainer=&flagged="
|
||||
SOURCEURL="http://lug.mtu.edu/archlinux/$rep/os/i686/"
|
||||
curl -s "$SOURCEURL" | \
|
||||
curl -L -s "$SOURCEURL" | \
|
||||
grep ".pkg." | grep -v ".sig\"" | \
|
||||
while read line; do
|
||||
line=`echo $line | sed "s|.*href=\"\([^\"]*\)\">.*|\1|"`
|
||||
@ -193,14 +193,16 @@ for rep in core community extra; do
|
||||
}
|
||||
fi
|
||||
done
|
||||
done
|
||||
rm -f $buildstmp
|
||||
done
|
||||
rm -f $buildstmp
|
||||
}
|
||||
|
||||
# parse X.org stable packages list
|
||||
[ "$quiet" ] || echo "Parsing X.org release ftp directory..." >&2
|
||||
SOURCEURL="ftp://ftp.x.org/pub/$XORG_RELEASE/src/everything/"
|
||||
curl -s $SOURCEURL -l | sed "s|\.tar\..*||" | sort -u |
|
||||
while read line; do
|
||||
parse_xorg() {
|
||||
# parse X.org stable packages list
|
||||
[ "$quiet" ] || echo "Parsing X.org release ftp directory..." >&2
|
||||
SOURCEURL="ftp://ftp.x.org/pub/$XORG_RELEASE/src/everything/"
|
||||
curl -L -s $SOURCEURL -l | sed "s|\.tar\..*||" | sort -u |
|
||||
while read line; do
|
||||
if [ "$line" ]; then
|
||||
ver=`echo $line | sed "s|.*-||"`
|
||||
pkg="${line/-$ver}"
|
||||
@ -212,13 +214,15 @@ while read line; do
|
||||
fi
|
||||
[ "$pkg" -a "$ver" ] && echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# parse Gnome stable packages list
|
||||
[ "$quiet" ] || echo "Parsing GNOME stable versions file..." >&2
|
||||
for f in versions-stable versions-stable-extras; do
|
||||
SOURCEURL="http://people.gnome.org/~vuntz/tmp/versions/$f"
|
||||
curl -s $SOURCEURL | grep -v "^#" |
|
||||
parse_gnome() {
|
||||
# parse Gnome stable packages list
|
||||
[ "$quiet" ] || echo "Parsing GNOME stable versions file..." >&2
|
||||
for f in versions-stable versions-stable-extras; do
|
||||
SOURCEURL="https://people.gnome.org/~vuntz/tmp/versions/$f"
|
||||
curl -s -L $SOURCEURL | grep -v "^#" |
|
||||
while read line; do
|
||||
if [ "$line" ]; then
|
||||
IFS=":"
|
||||
@ -230,13 +234,15 @@ for f in versions-stable versions-stable-extras; do
|
||||
[ "$pkg" -a "$ver" ] && echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# parse distrowatch.com packages list
|
||||
[ "$quiet" ] || echo "Parsing Distrowatch packages list..." >&2
|
||||
SOURCEURL="http://distrowatch.com/packages.php"
|
||||
lynx -width 300 -dump $SOURCEURL |
|
||||
while read line; do
|
||||
parse_distromatic() {
|
||||
# parse distrowatch.com packages list
|
||||
[ "$quiet" ] || echo "Parsing Distrowatch packages list..." >&2
|
||||
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
|
||||
[ "$start_print" ] && {
|
||||
@ -247,14 +253,25 @@ while read line; do
|
||||
[ "$pkg" != "chromium" ] && \
|
||||
echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
|
||||
}
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
cat $tmpfile | sort -uf > $UPDATES_DB.tmp
|
||||
rm -f $tmpfile
|
||||
if [ ! "$skip_parsing" ]; then
|
||||
tmpfile=`mktemp -q -t autodist-upstream-updates.XXXXXXXX`
|
||||
buildstmp=`mktemp -q -t autodist-upstream-updates.XXXXXXXX`
|
||||
tail -n+2 $BUILDS_FILE > $buildstmp
|
||||
|
||||
> $UPDATES_DB
|
||||
unset lastpkg
|
||||
while read pkg ver upsource alias; do
|
||||
parse_arch_linux
|
||||
parse_xorg
|
||||
parse_gnome
|
||||
parse_distromatic
|
||||
|
||||
cat $tmpfile | sort -uf > $UPDATES_DB.tmp
|
||||
rm -f $tmpfile
|
||||
|
||||
> $UPDATES_DB
|
||||
unset lastpkg
|
||||
while read pkg ver upsource alias; do
|
||||
# skip updates to unstable versions
|
||||
unset found_beta
|
||||
for b in alpha beta rc "~"; do
|
||||
@ -274,8 +291,9 @@ while read pkg ver upsource alias; do
|
||||
fi
|
||||
lastpkg=$pkg
|
||||
lastver=$ver
|
||||
done < $UPDATES_DB.tmp
|
||||
rm -f $UPDATES_DB.tmp
|
||||
done < $UPDATES_DB.tmp
|
||||
rm -f $UPDATES_DB.tmp
|
||||
fi
|
||||
|
||||
> $UPDATES_DB.missing
|
||||
> $BUILDLIST_FILE
|
||||
@ -311,6 +329,7 @@ while read pkg ver upsource alias; do
|
||||
pkgrep=$4
|
||||
version_find_bigger $pkgver ${ver/-/.}
|
||||
vercmp=$?
|
||||
#echo "$pkgname - version_find_bigger $pkgver ${ver/-/.} result=$vercmp"
|
||||
[ "${vercmp}" != "2" -a "$needupdate_only" ] && continue
|
||||
[ "$found_manual" ] && pkgname=$3
|
||||
[ "$found_alias" -o "$found_manual" ] && nameadd="$pkg" || unset nameadd
|
||||
|
Loading…
Reference in New Issue
Block a user