xbps-src: update_check.sh: check distfile existence for kde

* KDE distfile storage is based on versionned "folder".
An existing folder_version does not mean that the corresponding
distifile exists, so let's check its existence.

* wider scope for KDE urls that will use that rule.
Fine for plenty other packages, except kdb that don't follow
this hierarchy (yet)
This commit is contained in:
yopito 2018-07-22 15:39:08 +02:00 committed by John
parent 23a615211a
commit 8944a9130e
No known key found for this signature in database
GPG Key ID: 778558807E4FFC55
1 changed files with 30 additions and 3 deletions

View File

@ -4,6 +4,7 @@ update_check() {
local i p url sfname lpname bbname githubname rx found_version consider
local update_override=$XBPS_SRCPKGDIR/$XBPS_TARGET_PKG/update
local original_pkgname=$pkgname
local urlpfx urlsfx
if [ -r $update_override ]; then
. $update_override
@ -27,6 +28,35 @@ update_check() {
else
printf '%s\n' "$site"
fi |
# filter loop: if version are "folder" name based,
# substitute original url by every folder based ones (expand)
while IFS= read -r url; do
rx=
urlpfx="${url}"
urlsfx=
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/*|\
*download.kde.org/stable/digikam/*|*download.kde.org/stable/phonon/*)
urlpfx="${url%%${version%.*}*}"
urlsfx="${url##${urlpfx}${version%.*}}"
urlsfx="${urlsfx#.*/}"
urlsfx="/${urlsfx#/}"
rx='href="\K[\d\.]+(?=/")'
;;
esac
if [ -z "$rx" ]; then
# default case: don't rewrite url
printf '%s\n' "$url"
else
# substitute url if needed
if [ -n "$XBPS_UPDATE_CHECK_VERBOSE" ]; then
echo "(folder) fetching $urlpfx" 1>&2
fi
curl -A "xbps-src-update-check/$XBPS_SRC_VERSION" --max-time 10 -Lsk "$urlpfx" |
grep -Po -i "$rx" | xargs -r -n 1 -I @@ printf '%s\n' "${urlpfx}@@${urlsfx}"
fi
done |
while IFS= read -r url; do
rx=
if [ -z "$site" ]; then
@ -64,9 +94,6 @@ update_check() {
rx=linux-'\K'${version%.*}'[\d.]+(?=\.tar\.xz)';;
*cran.r-project.org/src/contrib*)
rx='\b\Q'"${pkgname#R-cran-}"'\E_\K\d+(\.\d+)*(-\d+)?(?=\.tar)';;
*download.kde.org/stable/applications*|*download.kde.org/stable/frameworks*|*download.kde.org/stable/plasma*)
url="${url%%${version%.*}*}"
rx='href="\K[\d\.]+(?=/")';;
*rubygems.org*)
url="https://rubygems.org/gems/${pkgname#ruby-}"
rx='href="/gems/'${pkgname#ruby-}'/versions/\K[\d\.]*(?=")' ;;