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
|
||||||
echo " -h: generate distromatic HTML output"
|
echo " -h: generate distromatic HTML output"
|
||||||
echo " -m: report missing packages only"
|
echo " -m: report missing packages only"
|
||||||
|
echo " -s: skip fetching and parsing upstream updates"
|
||||||
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 distromatic base (default: devel)"
|
echo " -r repository: specify the distromatic base (default: devel)"
|
||||||
@ -78,10 +79,10 @@ function version_compare()
|
|||||||
A=$1
|
A=$1
|
||||||
B=$2
|
B=$2
|
||||||
|
|
||||||
if [[ ${1} =~ "^[0-9]+$" && ${2} =~ "^[0-9]+$" ]]; then
|
if [[ ${1} =~ ^[0-9]+$ && ${2} =~ ^[0-9]+$ ]]; then
|
||||||
if [ ${A/[a-zA-Z_]*} -gt ${B/[a-zA-Z_]*} ]; then
|
if [ $((10#${A/[a-zA-Z_]*})) -gt $((10#${B/[a-zA-Z_]*})) ]; then
|
||||||
return 1
|
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
|
return 2
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -132,6 +133,7 @@ while [ "$1" ]; do
|
|||||||
else
|
else
|
||||||
missing_only=1
|
missing_only=1
|
||||||
fi ;;
|
fi ;;
|
||||||
|
-s) skip_parsing=1 ;;
|
||||||
-u) needupdate_only=1 ;;
|
-u) needupdate_only=1 ;;
|
||||||
-r) [ "$2" ] || {
|
-r) [ "$2" ] || {
|
||||||
echo "Error: option -r requires repository name as parameter"
|
echo "Error: option -r requires repository name as parameter"
|
||||||
@ -166,17 +168,15 @@ 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
|
||||||
|
|
||||||
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() {
|
||||||
# parse Arch Linux package list
|
# parse Arch Linux package list
|
||||||
[ "$quiet" ] || echo -n "Parsing Arch Linux packages list..." >&2
|
[ "$quiet" ] || echo -n "Parsing Arch Linux packages list..." >&2
|
||||||
#for page in `seq 1 45`; do
|
#for page in `seq 1 45`; do
|
||||||
for rep in core community extra; 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="https://www.archlinux.org/packages/?page=$page&sort=-last_update&q=&arch=i686&maintainer=&flagged="
|
||||||
SOURCEURL="http://lug.mtu.edu/archlinux/$rep/os/i686/"
|
SOURCEURL="http://lug.mtu.edu/archlinux/$rep/os/i686/"
|
||||||
curl -s "$SOURCEURL" | \
|
curl -L -s "$SOURCEURL" | \
|
||||||
grep ".pkg." | grep -v ".sig\"" | \
|
grep ".pkg." | grep -v ".sig\"" | \
|
||||||
while read line; do
|
while read line; do
|
||||||
line=`echo $line | sed "s|.*href=\"\([^\"]*\)\">.*|\1|"`
|
line=`echo $line | sed "s|.*href=\"\([^\"]*\)\">.*|\1|"`
|
||||||
@ -195,11 +195,13 @@ for rep in core community extra; do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
rm -f $buildstmp
|
rm -f $buildstmp
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_xorg() {
|
||||||
# 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
|
||||||
SOURCEURL="ftp://ftp.x.org/pub/$XORG_RELEASE/src/everything/"
|
SOURCEURL="ftp://ftp.x.org/pub/$XORG_RELEASE/src/everything/"
|
||||||
curl -s $SOURCEURL -l | sed "s|\.tar\..*||" | sort -u |
|
curl -L -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|.*-||"`
|
||||||
@ -213,12 +215,14 @@ while read line; do
|
|||||||
[ "$pkg" -a "$ver" ] && echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
|
[ "$pkg" -a "$ver" ] && echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_gnome() {
|
||||||
# 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
|
||||||
SOURCEURL="http://people.gnome.org/~vuntz/tmp/versions/$f"
|
SOURCEURL="https://people.gnome.org/~vuntz/tmp/versions/$f"
|
||||||
curl -s $SOURCEURL | grep -v "^#" |
|
curl -s -L $SOURCEURL | grep -v "^#" |
|
||||||
while read line; do
|
while read line; do
|
||||||
if [ "$line" ]; then
|
if [ "$line" ]; then
|
||||||
IFS=":"
|
IFS=":"
|
||||||
@ -231,7 +235,9 @@ for f in versions-stable versions-stable-extras; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
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.com/packages.php"
|
||||||
@ -248,6 +254,17 @@ while read line; do
|
|||||||
echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
|
echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
parse_arch_linux
|
||||||
|
parse_xorg
|
||||||
|
parse_gnome
|
||||||
|
parse_distromatic
|
||||||
|
|
||||||
cat $tmpfile | sort -uf > $UPDATES_DB.tmp
|
cat $tmpfile | sort -uf > $UPDATES_DB.tmp
|
||||||
rm -f $tmpfile
|
rm -f $tmpfile
|
||||||
@ -276,6 +293,7 @@ while read pkg ver upsource alias; do
|
|||||||
lastver=$ver
|
lastver=$ver
|
||||||
done < $UPDATES_DB.tmp
|
done < $UPDATES_DB.tmp
|
||||||
rm -f $UPDATES_DB.tmp
|
rm -f $UPDATES_DB.tmp
|
||||||
|
fi
|
||||||
|
|
||||||
> $UPDATES_DB.missing
|
> $UPDATES_DB.missing
|
||||||
> $BUILDLIST_FILE
|
> $BUILDLIST_FILE
|
||||||
@ -311,6 +329,7 @@ while read pkg ver upsource alias; do
|
|||||||
pkgrep=$4
|
pkgrep=$4
|
||||||
version_find_bigger $pkgver ${ver/-/.}
|
version_find_bigger $pkgver ${ver/-/.}
|
||||||
vercmp=$?
|
vercmp=$?
|
||||||
|
#echo "$pkgname - version_find_bigger $pkgver ${ver/-/.} result=$vercmp"
|
||||||
[ "${vercmp}" != "2" -a "$needupdate_only" ] && continue
|
[ "${vercmp}" != "2" -a "$needupdate_only" ] && continue
|
||||||
[ "$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
|
||||||
|
Loading…
Reference in New Issue
Block a user