autospec/patches/autospec-1.4.4-scrape_source0_dir.patch
2011-04-26 21:39:44 +02:00

106 lines
3.8 KiB
Diff

diff -Nru autospec-1.4.4.orig/lib/libapse.lib.in autospec-1.4.4/lib/libapse.lib.in
--- autospec-1.4.4.orig/lib/libapse.lib.in 2008-12-18 23:01:10.000000000 +0100
+++ autospec-1.4.4/lib/libapse.lib.in 2009-01-02 13:45:55.000000000 +0100
@@ -230,7 +230,7 @@
local ARGS
ARGS=`LANG=C getopt -o han:s:w:p:u: \
- --long help,allurl,pckname:,specname:,pckurl:,proxy:,proxy-user: \
+ --long help,allurl,pckname:,specname:,pckurl:,pckurlverbatim:,proxy:,proxy-user: \
-n "$FUNCNAME" -- "$@"`
[ $? = 0 ] || notify.error $"\
(bug)"" -- $FUNCNAME: "$"\`getopt' error"
@@ -253,6 +253,10 @@
pckurl="$2"; shift
notify.debug "$FUNCNAME: pckurl = \"$pckurl\""
;;
+ -v|--pckurlverbatim)
+ pckurlverbatim="$2"; shift
+ notify.debug "$FUNCNAME: pckurlverbatim = \"$pckurlverbatim\""
+ ;;
-p|--proxy)
proxy="$2"; shift
notify.debug "$FUNCNAME: proxy = \"$proxy\""
@@ -291,12 +295,11 @@
local curr_curl_proxy_opts="\
${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}"
- # sourceforge.net, sf.net
+ # sourceforge.net, sf.net
local prj_name prj_group_id
if [ "$(echo $pckurl | grep "sourceforge.net\|sf.net")" ]; then
- notify.note $"looking at"" <${NOTE}http://sourceforge.net${NORM}>..."
prj_name=$(echo "$pckurl" | sed -n 's,.*/\(.*\)/.*,\1,p')
[ "$prj_name" ] || notify.error $"\
@@ -364,11 +367,48 @@
fi
fi
fi
+
+ else
+
+ # SOURCE url based search
+ notify.note $"looking at"" "$"source0 base directory..."
+ local pckurldir="`dirname $pckurl`/"
+ local pcknameverbatim=`basename $pckurlverbatim`
+
+ curr_curl_url="\
+$pckurldir"
+ notify.debug "curl $curr_curl_proxy_opts -s -L \"$curr_curl_url\""
+
+ curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout
+ let "retval = $?"
+ case "$retval" in
+ 0) ;;
+ 6) notify.warning $"couldn't resolve host" ;;
+ 7) notify.warning $"failed to connect to host" ;;
+ *) notify.warning $"curl error (exit code: $retval)" ;;
+ esac
+
+ local pcknameregexp=$(echo $pcknameverbatim | sed "\
+ s,%[{]*name[}]*,$specname,
+ s,%{.*}*,[^[:space:]-]*,")
+
+ if [ $? -eq 0 ]; then
+
+ new_version=$(\
+grep -i "$pcknameregexp" $fcurlout | sed "\
+ s,.*\($pcknameregexp\).*,\1,g
+ s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...)
+ s/.*-\([0-9]*.*\)/\1/ # <pck_name>-<pck_ver>
+ s/.*_\([0-9]*.*\)/\1/ # <pck_name>_<pck_ver>
+ s/.+\([0-9]\..*\)/\1/g # <pck_name><pck_ver>
+ " | sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10| head -n1)
+
+ fi
fi
if [ "$new_version" ]; then
- notify.note "* "$"found version:"" \`${NOTE}$new_version${NORM}'"
- last_version="$new_version"
+ notify.note "* "$"found version:"" \`${NOTE}$new_version${NORM}'"
+ last_version="$new_version"
fi
# check at the other supported web sites...
diff -Nru autospec-1.4.4.orig/plugins/pck-update.in autospec-1.4.4/plugins/pck-update.in
--- autospec-1.4.4.orig/plugins/pck-update.in 2009-01-01 23:01:36.000000000 +0100
+++ autospec-1.4.4/plugins/pck-update.in 2009-01-01 23:04:59.000000000 +0100
@@ -1253,9 +1253,13 @@
unset SPEC_SOURCE0_PCKNAME
specfile.getvars SPEC_SOURCE0_PCKNAME
+ unset SPEC_SOURCE0_VERBATIM
+ specfile.getvars --verbatim SPEC_SOURCE0
+
apse.scrapeversion \
--pckname "$SPEC_SOURCE0_PCKNAME" \
--pckurl "${SPEC_SOURCE[0]}" \
+ --pckurlverbatim "${SPEC_SOURCE0_VERBATIM}" \
--specname "$SPEC_NAME" \
${proxy:+ --proxy $proxy} \
${proxy_user:+ --proxy-user $proxy_user}