update-check: generalize checking version directories

This commit is contained in:
Piotr Wójcik 2019-04-29 10:26:49 +02:00 committed by Enno Boland
parent 79273c05d9
commit 906f339d6a

View file

@ -36,15 +36,19 @@ update_check() {
rx= rx=
urlpfx="${url}" urlpfx="${url}"
urlsfx= urlsfx=
dirpfx=
case "$url" in case "$url" in
*download.kde.org/stable/applications/*|*download.kde.org/stable/frameworks/*|*download.kde.org/stable/plasma/*|\ *)
*download.kde.org/stable/kdevelop/*|*download.kde.org/stable/krita/*|*download.kde.org/stable/clazy/*|\ vdpfx=${vdprefix:-"|v|\\Q$pkgname\\E"}
*download.kde.org/stable/digikam/*|*download.kde.org/stable/phonon/*) vdsfx=${vdsuffix:-"|\\.x"}
urlpfx="${url%%${version%.*}*}" match=$(grep -Po "^[^/]+//[^/]+(/.+)?/($vdpfx)(?=[-_.0-9]*[0-9](?<!\\Q$pkgname\\E)($vdsfx)/)" <<< "$url")
urlsfx="${url##${urlpfx}${version%.*}}" if [ "$?" = 0 ]; then
urlsfx="${urlsfx#.*/}" urlpfx="${match%/*}/"
urlsfx="/${urlsfx#/}" dirpfx="${match##*/}"
rx='href="\K[\d\.]+(?=/")' urlsfx="${url#$urlpfx}"
urlsfx="${urlsfx#*/}"
rx="href=[\"']?(\\Q$urlpfx\\E)?\\.?/?\\K\\Q$dirpfx\\E[-_.0-9]*[0-9]($vdsfx)[\"'/]"
fi
;; ;;
esac esac
if [ "$rx" ]; then if [ "$rx" ]; then