libapse.lib: fix and simplify update check at sourceforge.net

This commit is contained in:
Silvan Calarco 2013-01-03 14:45:37 +01:00
parent 0fa42ac965
commit 9c934b546d

View File

@ -433,12 +433,9 @@ sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10 ))
notify.note $"looking at"" ${NOTE}(#1)${NORM} \
<${NOTE}${apse_site_name[1]}${NORM}>..."
local prj_name
prj_name="$specname"
[ "$prj_name" ] || notify.error $"\
(bug)"" -- $FUNCNAME: "$"assertion failed:"" \"\$prj_name\" != \"\""
[ "$src_name" ] || src_name="$specname"
curr_curl_url="http://sourceforge.net/projects/$prj_name/files/latest"
curr_curl_url="http://sourceforge.net/projects/$src_name/files/latest/download"
notify.debug \
"running: curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\""
curl $curr_curl_proxy_opts -I -A Linux -s -L "$curr_curl_url" \
@ -455,27 +452,16 @@ sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10 ))
[ "$retval" = "0" ] &&
if [ "$(sed -n "s,.*Invalid Project.*,error,pi" $fcurlout)" != \
"error" ]; then
[ "$src_name" ] || src_name="$specname"
pck_file=`grep -i -m1 "Location:" $fcurlout | \
grep -i "$src_name" | \
sed -n "s,Location: \(.*\)/download,\1,pi"`
sed -n "s,Location: \(.*\)?.*,\1,pi"`
notify.debug "$FUNCNAME: pck_file = \"$pck_file\""
[ "$src_name" ] && unset src_name
new_version=`echo $pck_file | sed "s|.*/\([0-9.]*\)/.*|\1|"`
new_version=`echo $pck_file | sed "s|.*/$src_name-\([0-9]*[0-9.]*[0-9]\)[^0-9]*.*|\1|"`
[ "$new_version" = "$pck_file" ] && new_version=
[ "$new_version" ] || \
new_version=`echo $pck_file | sed -n "\
/[0-9]/!q # return nothing if no number is found in the package name
s,.*/,, # remove directory name, if any
s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...)
s|.*/\([0-9.]*\)/.*|\1|
/-[0-9]*/{s/.*-\([0-9]*.*\)/\1/p;q} # <pck_name>-<pck_ver>
/_[0-9]*/{s/.*_\([0-9]*.*\)/\1/p;q} # <pck_name>_<pck_ver>
/[^-\.][0-9]\./{s/.*[^-\.]\([0-9]\..*\)/\1/p;q} # <pck_name><pck_ver>
# <pck_name> (no version, but <pck_name> can end with numbers)
/^[^0-9]*[0-9]*$/q"`
[ "$src_name" ] && unset src_name
fi
if [ "$new_version" ]; then