From 8944a9130e881954cf85acc8a62635e1620dac05 Mon Sep 17 00:00:00 2001 From: yopito Date: Sun, 22 Jul 2018 15:39:08 +0200 Subject: [PATCH] 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) --- common/xbps-src/shutils/update_check.sh | 33 ++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/common/xbps-src/shutils/update_check.sh b/common/xbps-src/shutils/update_check.sh index 8eef7b52c37..ef88bd5f4a4 100644 --- a/common/xbps-src/shutils/update_check.sh +++ b/common/xbps-src/shutils/update_check.sh @@ -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\.]*(?=")' ;;