# vim: set ts=4 sw=4 et ft=bash : update_check() { local i p url pkgurlname rx found_version consider local update_override=$XBPS_SRCPKGDIR/$XBPS_TARGET_PKG/update local original_pkgname=$pkgname local pkgname=$sourcepkg local urlpfx urlsfx local -A fetchedurls local curlargs=( -A "xbps-src-update-check/$XBPS_SRC_VERSION" --max-time 10 --compressed -Lsk ) pkgname=${pkgname#kf6-} # XBPS_UPDATE_CHECK_VERBOSE is the old way to show verbose messages [ "$XBPS_UPDATE_CHECK_VERBOSE" ] && XBPS_VERBOSE="$XBPS_UPDATE_CHECK_VERBOSE" if [ -r $update_override ]; then . $update_override msg_verbose "using $XBPS_TARGET_PKG/update overrides\n" if [ -n "$disabled" ]; then msg_verbose "update-check DISABLED for $original_pkgname: $disabled\n" return 0 fi elif [ -z "$distfiles" ]; then msg_verbose "NO DISTFILES found for $original_pkgname\n" return 0 fi if ! type curl >/dev/null 2>&1; then echo "ERROR: cannot find \`curl' executable!" return 1 fi export LC_ALL=C if [ -z "$site" ]; then case "$distfiles" in # special case those sites provide better source elsewhere *ftp.gnome.org*|*download.gnome.org*) ;; *archive.xfce.org*) ;; *) printf '%s\n' "$homepage" ;; esac for i in $distfiles; do printf '%s\n' "${i%/*}/" done 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 # default case: don't rewrite url printf '%s\n' "$url" if [ "$single_directory" ]; then continue fi rx= urlpfx="${url}" urlsfx= dirpfx= case "$url" in *.voidlinux.*|\ *sourceforge.net/sourceforge*|\ *code.google.com*|*googlecode*|\ *launchpad.net*|\ *cpan.*|\ *pythonhosted.org*|*pypi.org/project/*|\ *github.com*|\ *//gitlab.*|\ *bitbucket.org*|\ *ftp.gnome.org*|*download.gnome.org*|\ *archive.xfce.org*|\ *kernel.org/pub/linux/kernel/*|\ *cran.r-project.org/src/contrib*|\ *rubygems.org*|\ *crates.io*|\ *codeberg.org*|\ *hg.sr.ht*|\ *software.sil.org*|\ *git.sr.ht*) continue ;; *) vdpfx=${vdprefix:-"|v|\\Q$pkgname\\E"} vdsfx=${vdsuffix:-"|\\.x"} match=$(grep -Po "^[^/]+//[^/]+(/.+)?/($vdpfx)(?=[-_.0-9]*[0-9](?\Q'"${url%/*}"'\E/(v-?|\Q'"$pkgname"'\E-)?\K[\d.]+(?=)' ;; *pkgs.fedoraproject.org*) url="https://pkgs.fedoraproject.org/repo/pkgs/$pkgname" ;; *software.sil.org/downloads/*) pkgurlname=$(printf '%s\n' "$url" | cut -d/ -f6) url="https://software.sil.org/$pkgurlname/download/" pkgname="${pkgname#font-}" pkgname="${pkgname#sil-}" _pkgname="${pkgname//-/}" rx="($_pkgname|${_pkgname}SIL)[_-]\K[0-9.]+(?=\.tar|\.zip)" ;; *software.sil.org/*) pkgname="${pkgname#font-}" pkgname="${pkgname#sil-}" _pkgname="${pkgname//-/}" rx="($_pkgname|${_pkgname}SIL)[_-]\K[0-9.]+(?=\.tar|\.zip)" ;; esac fi rx=${pattern:-$rx} rx=${rx:-'(?&2 } | while IFS= read -r found_version; do msg_verbose "found version $found_version\n" consider=true p="$ignore " while [ -n "$p" ]; do i=${p%% *} p=${p#* } case "$found_version" in $i) consider=false msg_verbose "ignored $found_version due to $i\n" esac done if $consider; then xbps-uhelper cmpver "$original_pkgname-${version}_1" \ "$original_pkgname-$(printf %s "$found_version" | tr - .)_1" if [ $? = 255 ]; then echo "${original_pkgname}-${version} -> ${original_pkgname}-${found_version}" fi fi done }