From bba8d555491a6dab6ec6406486499b1cad8c37d5 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sun, 26 Jun 2011 16:34:58 +0200 Subject: [PATCH] libapse (sourceforge): also get version from package name if there is no version indication in upper level directory name --- lib/libapse.lib.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/libapse.lib.in b/lib/libapse.lib.in index d6746eb..728afd8 100644 --- a/lib/libapse.lib.in +++ b/lib/libapse.lib.in @@ -427,6 +427,17 @@ sed -n "s,Location: \(.*\)/download,\1,pi"` notify.debug "pck_file = \"$pck_file\"" [ "$src_name" ] && unset src_name new_version=`echo $pck_file | sed "s|.*/\([0-9.]*\)/.*|\1|"` + [ "$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} # - +/_[0-9]*/{s/.*_\([0-9]*.*\)/\1/p;q} # _ +/[^-\.][0-9]\./{s/.*[^-\.]\([0-9]\..*\)/\1/p;q} # +# (no version, but can end with numbers) +/^[^0-9]*[0-9]*$/q"` fi if [ "$new_version" ]; then