#!/bin/bash
usage() {
>&2 echo 'Verwendung: '
>&2 echo " $0"' [--32] [-f|--force] [-n|--no-cache] [-j|--jobs=${jobs}]'
>&2 echo ' --32: Versionen in archlinux32 statt archlinuxewe prüfen'
>&2 echo ' -f|--force|--noUpdate: prüfe Versionen unhabhängig von Zeit der letzten Prüfung'
>&2 echo ' -j|--jobs: Anzahl parallel auszufuehrender Anfragen'
>&2 echo ' -m: maschinenlesbare Ausgabe erzeugen'
exit 1
}
curl_it() {
local source="$1"
local cache_file
local i
cache_file=$(
{
printf '%s\n' "$1"
printf '%s\n' "$@" | \
sort -u
} | \
sha512sum | \
awk '{print $1}'
)
shift
cache_file="${curl_cache}/${cache_file}"
if ${use_cache} && \
[ -s "${cache_file}" ] && \
[ $(stat -c%Y "${cache_file}") -gt $(($(date +%s)-300)) ] &&
! grep -qiF 'access denied' "${cache_file}"; then
cat "${cache_file}"
return
fi
tmp_file=$(mktemp)
for i in {1..5}; do
curl --compressed -o "${tmp_file}" --connect-timeout 10 -s -x socks5h://127.0.0.1:9050 "$@" "${source}"
if grep -qiF "$(
printf '%s\n' \
'access denied' \
'Repository seems to be empty'
)" "${tmp_file}"; then
: >"${tmp_file}"
fi
if [ -s "${tmp_file}" ]; then
break
fi
done
if [ ! -s "${tmp_file}" ]; then
curl --compressed -o "${tmp_file}" --connect-timeout 10 -s "$@" "${source}"
fi
cat "${tmp_file}"
local trials
if grep -qiF "$(
printf '%s\n' \
'access denied' \
'Repository seems to be empty'
)" "${tmp_file}"; then
trials=-1
else
trials=5
while [ ${trials} -gt 0 ] && \
! mv "${tmp_file}" "${cache_file}"; do
sleep 1
trials=$((trials-1))
done
fi
if [ ${trials} -le 0 ]; then
rm -f "${tmp_file}"
fi
}
latest_version() {
if [ "x$1" = 'xperl' ]; then
local versions
versions=$(cat)
printf '%s\n' "${versions}" \
| if printf '%s\n' "${versions}" \
| grep -q '\..*\.'; then
sort -V
else
sort -g
fi
else
sort -V
fi \
| tail -n1
}
extract_sourceforge_file_list() {
local verzeichnis
verzeichnis="$1"
curl_it "${verzeichnis}" \
| sed -n '
/^\s*
\s*$/,/^\s*<\/table>\s*$/p
' \
| sed -n '
/^\s*\s*$/,/^\s*<\/tbody>\s*$/p
' \
| sed -n '
/^\s*/ p
' \
| sed '
s@^.*&2 echo "FEHLER: Verstehe Option \"$1\" doch nicht! Ich beende."
rm -rf "${tmpDir}"
usage
esac
shift
done
[ ! -r "${versionenDatei}" ] && force=true
versionenErmitteln=${force}
! ${versionenErmitteln} && [ "$(head -n1 "${versionenDatei}")" -le $[$(date "+%s")-300] ] && versionenErmitteln=true
${maschinenlesbar} && versionenErmitteln=true
${unForce} && versionenErmitteln=false
versionenSchreiben=${versionenErmitteln}
[ ! -w "${versionenDatei}" ] && versionenSchreiben=false
${maschinenlesbar} && versionenSchreiben=false
if [ $# -eq 0 ]
then
if ${versionenSchreiben}
then
tmpFile="$(mktemp /tmp/versionen.XXXXXX)"
date "+%s" > "${tmpFile}"
set -o pipefail
if ${archlinuxewe}; then
${me} "${args[@]}" $(echo */PKGBUILD | tr " " "\n" | sed "s|/PKGBUILD||") | tee -a "${tmpFile}"
err=$?
else
/usr/src/archlinux32/devops/watch-versions | sed 's/$/ (arch32)/' | tee -a "${tmpFile}"
${me} "${args[@]}" $(echo *32/PKGBUILD | tr ' ' '\n' | sed 's|/PKGBUILD||') | tee -a "${tmpFile}"
err=$?
fi
set +o pipefail
cat "${tmpFile}" > "${versionenDatei}"
rm "${tmpFile}"
elif ! ${versionenErmitteln}
then
sed '1d' "${versionenDatei}"
err=$?
elif ${archlinuxewe}; then
${me} "${args[@]}" $(echo */PKGBUILD | tr " " "\n" | sed "s|/PKGBUILD||")
err=$?
else
/usr/src/archlinux32/devops/watch-versions | sed 's/$/ (arch32)/'
${me} "${args[@]}" $(echo */PKGBUILD | tr " " "\n" | sed "s|/PKGBUILD||" | grep '32$')
err=$?
fi
exit ${err}
elif [ $# -eq 1 ] && ${versionenErmitteln}
then
unset pkgbase
unset pkgname
unset pkgver
if ${archlinuxewe}; then
. $1/PKGBUILD
srcKnown=false
else
eval "$(
grep '^pkg\(base\|name\|ver\)=' $1/PKGBUILD
)"
remVer=$(
for a in i486 i686 pentium4; do
for r in core extra community testing community-testing staging community-staging; do
curl -Ss 'https://mirror.archlinux32.org/'"${a}"'/'"${r}"'/'"${r}"'.db' \
| bsdtar -Oxf - \
| sed -n '
/^%FILENAME%/ {
N
s/^%FILENAME%\n//
/^'"${1%32}"'-[^-]\+-[^-]\+-any\.pkg\.tar\.\(xz\|zst\)$/ p
}
'
done
done \
| sed '
s/-[^-]\+-[^-]\+$//
s/^.*-//
' \
| latest_version
)
srcKnown=true
source=()
fi
if [ -n "${pkgbase}" ]; then
pkgname="${pkgbase}"
fi
for src in "${source[@]}" "${source_i686[@]}" "${source_x86_64[@]}"
do
src_name="${src%%::*}"
src="${src#*::}"
if echo "${src}" | \
grep '^https://archive-server\.archlinux32\.org/' |
grep '[&?]t=git' | \
grep '[&?]r=' | \
grep -q '[&?]tag='; then
remDir=$(
printf '%s\n' "${src}" \
| sed 's,^.*[?&]r=\([^&]\+\)\(\&.*\)\?$,\1,' \
| sed 's/%3D/=/g'
)
remTag=$(
printf '%s\n' "${src}" \
| sed 's,^.*[?&]tag=\([^&]\+\)\(\&.*\)\?$,\1,' \
| sed 's/%3D/=/g'
)
remVer=$(
git -C "/usr/src/skripte/archive-server/work/repositories/git/${remDir}" tag \
| sed '
s/^[^0-9.*]*'"$(
printf '%s\n' "$remTag" \
| sed 's/[0-9.]\+$/\\([0-9.]\\+\\)/'
)"'$/\1/
t
d
' \
| latest_version
)
elif [ "${pkgname}" = 'python2-sip' ]; then
remVer=$(
pacman -Ss '^python-sip$' \
| sed '
s@^\S\+/python-sip \([0-9.]\+\)-[0-9]\+\( .*\)\?$@\1@
t
d
'
)
elif [ "${pkgname}" = 'local-certificates' ]; then
remVer=$(
curl_it 'https://eckner.net/certs/sha512sums' \
| sed '
s/^\S\+ \([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\)T\([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\)\.\S\+$/\1.\2.\3.\4.\5.\6/
t
d
' \
| latest_version
)
elif [ "${pkgbase}" = 'bareos' ]; then
remVer=$(
curl_it 'https://github.com/bareos/bareos/releases' \
| sed '
s,^.* href="/bareos/bareos/archive/refs/tags/Release/\([0-9.]\+\)\.tar\.gz"\( [^>]*\)\?>.*$,\1,
t
d
' \
| latest_version
)
elif [ "${pkgname}" = 'python2-courier-pythonfilter' ]
then
remVer=$(
curl_it 'https://bitbucket.org/gordonmessmer/courier-pythonfilter/downloads/?tab=tags' \
| tr '"' '\n' \
| sed '
s,^/gordonmessmer/courier-pythonfilter/get/release-\([-0-9]\+\)\.tar\.gz$,\1,
t
d
' \
| tr '-' '.' \
| latest_version
)
elif [ "${pkgname}" = 'pacman-static' ]
then
git submodule update "${pkgname}"
eval "$(
sed -n '
s/^pkgver=/remVer=/
T
p
' "${pkgname}/PKGBUILD"
)"
elif echo "${src}" | \
grep -qF '/ssacli-'; then
centosVer=$(
curl_it "${src%/*/*/*/*}/" | \
tr '"' '\n' | \
sed '
s,^\([0-9]\+\)/$,\1,
t
d
' | \
latest_version
)
remVer=$(
curl_it "${src%/*/*/*/*}/${centosVer}/x86_64/current/" | \
tr '"' '\n' | \
sed '
s,^ssacli-\([0-9.]\+\)-\([0-9.]\+\)\.x86_64\.rpm$,\1_\2,
t
d
' | \
latest_version
)
elif [ "${pkgname}" = 'adduser' ]
then
remVer=$(
curl_it "${source[0]#*::}" '-L' | \
grep '^# Version: ' | \
sed 's|^# Version: \+||'
)
elif [ "${pkgname}" = 'dropbox' ]
then
remVer=$(
curl_it 'https://www.dropboxforum.com/t5/Dropbox-desktop-client-builds/bd-p/101003016' | \
tr '<>' '\n' | \
sed '
s/^\s*Stable Build \([0-9.-]\+\)\s*$/\1/
t
d
' | \
latest_version
)
elif [ "${pkgname}" = 'tightvnc' ]
then
remVer=$(
curl_it 'https://www.tightvnc.com/download-old.php' | \
tr '"' '\n' | \
grep -x 'https://www\.tightvnc\.com/download/\([0-9.]\+\)/tightvnc-\1_unixsrc\.tar\.bz2' | \
sed 's|^https://www\.tightvnc\.com/download/\([0-9.]\+\)/tightvnc-\1_unixsrc\.tar\.bz2$|\1|'
)
elif [ "${pkgname}" = 'g95' ]
then
remVer='0.94'
elif [ "${pkgname}" = 'pgplot-for-ifeffit' ]
then
remVer=$(
curl_it "ftp://ftp.astro.caltech.edu/pub/pgplot/" | \
grep "\spgplot[0-9.]\+\.tar\.gz -> \S\+\$" | \
sed "s|^.*\spgplot\([0-9.]\+\)\.tar\.gz -> \S\+\$|\1|" | \
latest_version
)
elif echo "${src}" | \
grep -q '^http://ftp.linux.org.uk/.*/netkit/'
then
quVer="${src%/*}/"
remVer="$(
curl_it "${quVer}" | \
tr '<>' '\n' | \
grep "^${pkgname#netkit-}-[0-9.-]\+\.tar\.gz\$" | \
sed "s|^${pkgname#netkit-}-\([0-9.-]\+\)\.tar\.gz\$|\1|" | \
latest_version
)"
elif [ "${pkgname}" == "archiso32" ] || [ "${pkgname}" == 'archiso-dual' ]
then
git -C /usr/src/archlinux/archiso fetch upstream
git -C /usr/src/archlinux32/archiso32 fetch origin
remVer="$(
{
git -C /usr/src/archlinux/archiso tag
git -C /usr/src/archlinux32/archiso32 tag
} | \
sed -n '
s/^v//
T
p
' | \
latest_version
)"
elif [ "${pkgname}" == 'devtools32' ]
then
git -C /usr/src/archlinux/devtools fetch upstream
git -C /usr/src/archlinux32/devtools32 fetch origin
remVer="$(
(
git -C /usr/src/archlinux/devtools archive --format=tar upstream/master -- Makefile | \
tar -Ox | \
grep -m1 '^V=[0-9.]\+$' | \
cut -d= -f2
git -C /usr/src/archlinux32/devtools32 tag | \
sed -n '
s/^v//
/^[0-9.]\+$/p
'
) | \
latest_version
)"
elif [ "${pkgname}" == 'pacman-mirrorlist32' ]
then
git -C "/usr/src/archlinux32/packages" fetch origin >/dev/null 2>&1
remVer=$(
{
git -C "/usr/src/archlinux32/packages" archive origin/master -- core/pacman-mirrorlist/PKGBUILD | \
tar -Ox | \
grep -m1 '^pkgver=[0-9.]\+$' | \
cut -d= -f2
} | \
latest_version
)
elif echo "${src}" | \
grep -q '//www\.abisource\.com/'
then
quVer="$(
echo "${src}" | \
sed 's|\(/[^/]\+\)\{3\}$|/|'
)"
remVer="$(
curl_it "${quVer}" | \
tr '<>' '\n' | \
sed -n '
s,^a href="\([0-9.]\+\)/"$,\1,
T
p
' | \
latest_version
)"
elif echo "${src}" | \
grep -q '//download\.virtualbox\.org/'
then
quVer="$(
echo "${src}" | \
sed 's|/[^/]\+/[^/]\+$||'
)"
remVer="$(
curl_it "${quVer}/" | \
sed -n '
s,^.*.*$,\1,
T
p
' | \
latest_version
)"
elif echo "${src}" | \
grep -q "//raw\.githubusercontent\.com/qemu/qemu/"; then
sum=$(
curl -Ss "${src}" | \
sha512sum - | \
awk '{print $1}'
)
if printf '%s\n' "${sha512sums[@]}" | \
grep -qxF "${sum}"; then
remVer="${pkgver}"
else
remVer=$(
date +%Y%m%d
)
fi
elif echo "${src}" | \
grep -q "//www\.mpich\.org/"
then
quVer="${src%/*/*}/"
aVers="$(
curl_it "${quVer}" | \
tr '"' '\n' | \
grep '^[0-9.]\+/$' | \
sed 's|/$||'
)"
if [ ! "${pkgname}" == "mpich" ]
then
aVers="$(
(
echo "${aVers}"
echo "${pkgname#mpich} %%%SCHNIPP%%%"
) |
sort -V | \
sed '/%%%SCHNIPP%%%/q' | \
grep -v '%%%SCHNIPP%%%'
)"
fi
remVer="$(
echo "${aVers}" | \
latest_version
)"
elif echo "${src}" | \
grep -q '^git://anonscm\.debian\.org/\|^git\(+https\?\)\?://git\(hub\.com\|\.archlinux32\.org\)/.*#tag='
then
src="${src#git+}"
src="${src%#*}"
src="${src%?signed}"
remVer=$(
{
git ls-remote --tags "${src}" 2>/dev/null || \
git ls-remote --tags "${src//git.archlinux32.org\/archlinux32\//git2.archlinux32.org/archlinux32/}" 2>/dev/null
} | \
awk '{print $2}' | \
sed '
s|^refs/tags/'"$(
if ! echo "${src}" | \
grep -qF archlinux32; then
printf 'v'
fi
)"'\([0-9.]\+\)$|\1|
t
d
' | \
latest_version
)
elif echo "${src}" | \
grep -q '^git\(+[^:]\+\)\?://[^#]\+\(#commit=[^#]\+\)\?$'
then
remVer=$(
cd "$1"
makepkg --verifysource >/dev/null 2>&1
git -C "${src_name}" fetch --all -p >/dev/null 2>&1
_commit='HEAD'
srcdir=$(pwd)
pkgver
)
elif echo "${src}" | \
grep -q '^svn\(+[^:]\+\)\?://[^#]\+\(#revision=[^#]\+\)\?$'
then
remVer=$(
cd "$1"
makepkg --verifysource >/dev/null 2>&1
(
cd "${src_name}"
svn update >/dev/null
)
srcdir=$(pwd)
pkgver
)
elif echo "${src}" | \
grep -q "^https://pypi\.python\.org/packages/"
then
qu=$(
echo "${src}" | \
sed 's|^.*/packages/.*/\([^/]\+\)-[^/-]\+\.tar\.gz$|https://pypi.org/project/\1/|'
)
_pkgname=$(
echo "${qu}" | \
sed '
s|/$||
s|^.*/||
'
)
remVer="$(
curl_it "${qu}" | \
tr '"' '\n' | \
grep "^/project/\(python-\)\?${_pkgname}/[0-9.-]\+/\$" | \
sed "s|^/project/\(python-\)\?${_pkgname}/\([0-9.-]\+\)/\$|\2|" | \
latest_version
)"
remHash="$(
curl_it "${qu}${remVer}/" | \
tr '"#' '\n' | \
sponge | \
grep -m1 "^https://files\.pythonhosted\.org/packages/.*/[0-9a-f]\{60\}/${_pkgname}-${remVer}\.tar\.\(gz\|bz2\|xz\)\$" | \
sed 's|/[^/]\+$|/|; s|^https://files\.pythonhosted\.org/packages/|/|'
)"
locHash="$(
echo "${src}" | \
sed 's|/[^/]\+$|/|; s|^https://pypi\.python\.org/packages/|/|'
)"
${maschinenlesbar} && \
[ "${remHash}" != "${locHash}" ] && \
echo "sed_extra='s@${locHash}@${remHash}@g;'"
elif echo "${src}" | \
grep -q "//bundles\.openttdcoop\.org/"
then
qu="$(
echo "${src}" | \
sed 's|^\(https\?://\([^/]\+/\)\{3\}\).*$|\1|'
)"
remVer="$(
curl_it "${qu}" | \
tr "\"" "\n" | \
grep '^[0-9.]\+/$' | \
sed 's|/$||' | \
latest_version
)"
elif echo "${src}" | \
grep -q "//git\.eckner\.net/"
then
quVer="${src%/*/*}"
quNam=$(
printf '%s\n' "${src}" | \
sed '
s,^.*/,,
s,-[0-9.]\+\.tar\.xz$,,
'
)
remVer=$( \
curl_it "${quVer}" | \
tr "<>'\"" '\n' | \
sed -n '
s,^/'"${quVer#*//*/}"'/snapshot/'"${quNam}"'-\([0-9.]\+\)\.tar\.xz$,\1,
T
p
' | \
latest_version
)
elif echo "${src}" | \
grep -q "//\(search\.m\?\)\?cpan\.org/\|//cpan\.metacpan\.org/authors/\|cpan\.org/modules/by-module/"
then
quVer=$( \
echo "${src%/*}/" | \
sed 's|//\(search\.m\?\)\?cpan\.org/|//www.cpan.org/|' | \
sed 's|/CPAN/|/|'
)
quNam=${src##*/}
quNam=${quNam%-*}
quEnd=$( \
echo "${src##*-}" | \
sed "s|^v\?[0-9.]*||" | \
sed 's|\.|\\\.|'
)
remVer=$( \
curl_it "${quVer}" | \
tr '"<>' '\n' | \
grep "^${quNam}-v\?[0-9.-]*\.${quEnd}\$" | \
sed "s|^${quNam}-v\?\([0-9.-]*\)\.${quEnd}\$|\1|" | \
latest_version 'perl'
)
elif echo "${src}" | \
grep -q "ftp://"
then
quVer="${src%/*}/"
quNam="${src##*/}"
quEnd=$( \
echo "${quNam}" |
sed "s|^.*v\?[0-9.]*[0-9]\(.\)|\1|"
)
quNam=$( \
echo ${quNam} | \
sed "s|v\?[0-9.]\+.*\$||"
)
tmpVer=$( \
curl_it "${quVer}" | \
awk '{print $9}' | \
grep "^${quNam}v\?[0-9.]*${quEnd}\$" | \
sed "s|^${quNam}v\?\([0-9.]*\)${quEnd}\$|\1|" | \
latest_version
)
[ "${pkgname}" == "pgplot" ] \
&& [ -n "${tmpVer}" ] \
&& remVer="${tmpVer:0:1}.${tmpVer:1:1}.${tmpVer:2}" \
|| remVer="${tmpVer}"
elif echo "${src}" | \
grep -q '//ftp\.gwdg\.de/\|//mirror\.archlinux32\.org/'
then
quVer="${src%/*}"
quVer="${quVer#*::}"
quNam=${src##*/}
quNam=${quNam%-*}
quNam=${quNam%-*}
quNam=${quNam%-*}
quEnd=${src##*-}
quEnd=${quEnd#*.}
remVer=$( \
curl_it "${quVer}/" | \
tr "\"" "\n" | \
grep "^${quNam}\(-[^-]*\)\{3\}\.${quEnd}\$" | \
sed "s|^${quNam}-\([^-]*\)\(-[^-]*\)\{2\}\.${quEnd}\$|\1|" | \
latest_version
)
elif echo "${src}" | \
grep -q '^https\?://github\.com/'
then
quVer=$(
echo "${src#*::}" | \
sed '
s|/archive/\(Release/\)\?[^/]*$|/releases|
s|/download/[^/]*/[^/]*$||
s|http:|https:|
'
)
quNam=$(
echo "/${quVer#*.com/}/tag/" | \
tr '[[:upper:]]' '[[:lower:]]'
)
if [ "${pkgname}" == 'boulder' ]; then
us_chars='-'
dot_chars=''
elif [ "${pkgname}" == 'jamulus-headless' ]; then
us_chars=''
dot_chars='_'
else
us_chars=''
dot_chars=''
fi
remVer=$( \
curl_it "${quVer}" | \
tr '"' '\n' | \
tr '[[:upper:]]' '[[:lower:]]' | \
sed '
s@^'"${quNam}"'\([rv]\|release\(%2f\|-\)\|\)\(['"${dot_chars}${us_chars}"'_0-9.]\+\)$@\3@
t
d
' | \
if [ -n "${dot_chars}" ]; then
tr "${dot_chars}" '.'
else
cat
fi | \
if [ -n "${us_chars}" ]; then
tr "${us_chars}" '_'
else
cat
fi | \
if [ "${pkgname}" == "conky-irc" ]; then
grep -v '\.999$'
elif [ "${pkgname}" == 'textmail' ]; then
grep -vx '[0-9]\{8\}'
else
cat
fi | \
latest_version
)
elif echo "${src}" | \
grep -q "//\(\(pr\)\?downloads\.\)\?sourceforge\.net/code-snapshots/svn/"
then
quVer=$(
echo "${src}" \
| sed '
s@^\([^/]\+//[^/]\+/\)code-snapshots/svn/\([^/]\)/\(\2[^/]\)\(/\3[^/]\+/[^/]\+\)/[^/]\+$@\1p\4/HEAD/@
'
)
remVer=$(
curl_it "${quVer}" \
| sed '
s@^.*>Commit \[\([^][]\+\)].*$@\1@
t
d
' \
| sort -V \
| tail -n1
)
elif echo "${src}" | \
grep -q "//\(\(pr\)\?downloads\.\)\?sourceforge\.net/"
then
quVer=$( \
echo "${src}" | \
sed '
s,^https\?://\(\(pr\)\?downloads\.\)\?sourceforge\.net/,,
s,^sourceforge/,,
s,^projects\?/,,
' | \
sed '
s,^\([^/]\+\)/[^/]\+$,\1/files/\1,
t end
s,^\([^/]\+\)/\(files/\)\?\([^/]\+\)/[0-9.]\+/[^/]\+$,\1/files/\3,
t end
s,^\([^/]\+\)/files/\1/\1-[0-9.]\+/[^/]\+$,\1/files/\1,
t end
s,^\([^/]\+\)/\(files/\)\?branch_[0-9.]\+/[^/]\+$,\1/files,
t end
s,^\([^/]\+\)/\(\1-[0-9.]\+\)/\2\.tar\.gz$,\1/files,
t end
s,^,unmatched sourceforge url: ,
w /dev/stderr
d
:end
s,/scidavis$,/SciDAVis,
s,^.*$,https://sourceforge.net/projects/\0/,
'
)
for ver in $(
extract_sourceforge_file_list "${quVer}" \
| sed '
s@/$@@
t
d
' \
| sed '
s@^\(\('"${pkgname}"'\|'"${_pkgname}"'\)\([-.]\|%20\)\)\(.*\)@\0 \4@
t
s@^.*$@\0 \0@
' \
| sort -k2Vr,2 \
| if [ "${pkgname}" = 'qwt5' ]; then
grep ' 5'
else
cat
fi \
| cut -d' ' -f1
); do \
remVer=$( \
extract_sourceforge_file_list "${quVer}${ver}/" \
| sed '
s@/download$@@
t
d
' \
| sed '
s@^\(\('"${pkgname}"'\|'"${_pkgname}"'\)\([-.]\|%20\|\)\)\?\([0-9.][-0-9.]*\)\(-src\)\?\(\.tar\.\([xgl]z\|bz2\)\|\.tgz\|\.zip\|-win-dist\.msi\)$@\4@
t
d
' \
| tr '-' '.' \
| latest_version
)
if [ -n "${remVer}" ]; then
break
fi
done
elif echo "${src}" | \
grep -q '//support\.hdfgroup\.org/'
then
quVer="${src%/*/*/*}/"
quNam="${src##*/}"
quNam="${quNam%-*}"
quNAM="${src#${quVer}}"
quNAM="${quNAM%%.*}"
quNAM="$(echo "${quNAM}" | tr '[:lower:]' '[:upper:]')"
remVer=$(
curl_it "${quVer}" \
| tr '"' '\n' \
| sed "
s|^${quNAM}\.\(.*\)/\$|\1|
t
d
" \
| sort -Vr \
| while read -r verKandidat; do
curl_it "${quVer}${quNAM}.${verKandidat}/src/" \
| sed '
s@^.*.*$@\1@
t
d
' \
| sort -Vr \
| grep -Fm1 '' \
&& break
done
)
elif echo "${src}" | \
grep -q 'https://bitbucket\.org/.*/get/[^/]\+$'
then
srcPreNam="$(
echo "${src}" | \
sed 's|^.*/\([^/0-9]\+[-_]\)[0-9][^/]\+$|\1|'
)"
srcEndg="$(
echo "${src}" | \
sed '
s|^.*\(\.tar[^/]*\)$|\1|
s|\.|\\.|g
'
)"
remVer="$(
curl_it "${src%/get/*}/downloads/?tab=tags" | \
tr '"' '\n' | \
sed '
s|^.*/'"${srcPreNam}"'\(.*\)'"${srcEndg}"'$|\1|
t
d
' | \
tr -- '-_' '.' | \
latest_version
)"
elif echo "${src}" | \
grep -q '^https\?://lilypond\.org/'
then
if echo "${src}" \
| grep -q '/v\?\([^/]\+\)/[^/]\+-\1[^/]\+$'; then
quVers=$(
curl_it "${src%/*/*}/" \
| sed '
s@^.*\1/.*$@\1/@
t
d
' \
| sort -Vr \
| sed 's@^@'"${src%/*/*}/"'@'
)
else
quVers="${src%/*}/"
fi
for quVer in ${quVers}; do
remVer=$(
curl_it "${quVer}" \
| tr '"<>' '\n' \
| sed '
s@^lilypond-\([0-9.]\+\)\(-[0-9]\+\.documentation\)\?\.t\(ar\(\.[gx]z\|\.bz2\)\?\|gz\)$@\1@
t
d
' \
| tr '_' '.' \
| latest_version
)
if [ -n "${remVer}" ]; then
break
fi
done
elif echo "${src}" | \
grep -qF '//www.cybernoia.de/'; then
quVer="${src%/*}.html"
remVer=$(
curl_it "${quVer}" | \
tr '<>' '\n' | \
sed -n '
s,^a href="'"${pkgname}/${pkgname}"'-\([0-9.]\+\)\.tar\.gz"$,\1,
T
p
'
)
elif echo "${src}" | \
grep -q "$(
printf '^https\\?://%s/\|' \
'archlinuxarm\.org' \
'bitbucket\.org' \
'bindfs\.org' \
'dist\.schmorp\.de' \
'dl\.suckless\.org' \
'download\.osgeo\.org' \
'download\.qemu\.org' \
'downloads\.powerdns\.com' \
'ftp\.daper\.net' \
'ftp\.pcre\.org' \
'isl\.gforge\.inria\.fr' \
'www\.lcdf\.org' \
'www\.vanheusden\.com'\
'people\.gnome\.org' \
'pkgbuild\.com' \
'qgis\.org' \
'sources\.archlinux\(32\)\?\.org' \
'webhome\.phy\.duke\.edu' \
'www\.dragonsdawn\.net' \
'www\.gaia-gis\.it' \
'www\.hashcash\.org' \
'www\.iozone\.org' \
'www\.tana\.it' \
'www\.tinc-vpn\.org' \
'www\.vandenoever\.info' \
'www\.wurzel\.org' \
'www.xcrysden.org' \
| sed 's@\\|$@\n@'
)"
then
for _pkgname in "${provides[@]}"; do
if [ "${pkgname#${_pkgname%=*}}" != "${pkgname}" ]; then
pkgname="${_pkgname%=*}"
break
fi
done
pkgname="${pkgname%-static}"
if [ "${pkgname}" = 'qemu-user' ]; then
pkgname='qemu'
fi
quVer="${src%/*}/"
if printf '%s\n' "${pkgver}" \
| grep -qx '[0-9.]\+_[0-9.]\+_rc[0-9]\+'; then
ist_rc=true
ver_match='[0-9._]\+[a-z]\?\(-rc[0-9]\+\)\?'
else
ist_rc=false
ver_match='[0-9._]\+[a-z]\?'
fi
if [ "${pkgname}" = 'spatialite-tools' ]; then
ver_match="$(
tar -Oxzf /var/lib/pacman/sync/community.db --wildcards 'libspatialite-*-*/desc' \
| sed -n '
/^%VERSION%/ {
N
s/^%VERSION%\n\([0-9]\+\.\).*$/\1/
T
p
}
'
)${ver_match}"
fi
remVer=$( \
curl_it "${quVer}" | \
tr '"<>' '\n\n\n' | \
sed '
s@^'"${pkgname#python2-}"'\(-src\)\?-\?v\?\('"${ver_match}"'\)\.t\(ar\(\.[gx]z\|\.bz2\)\?\|gz\)$@\2@
t
d
' | \
tr '_' '.' | \
sed '
s/^\(\S\+\)-\(rc[0-9]\+\)$/'"${pkgver%%_*}"'_\1_\2/
' | \
latest_version
)
elif echo "${src}" | \
grep -qF "$(
printf '%s\n' \
'https://www.kernel.org/pub/linux/utils/cryptsetup' \
'https://archive.apache.org/' \
'http://ftp.gnome.org/pub/gnome/sources/glib/'
)"; then
fileName=$(
printf '%s\n' "${src}" \
| sed '
s@^.*/@@
s@-[0-9.]\+[^0-9]\+$@@
'
)
for mainVer in $(
curl_it -L "${src%/*/*}/" \
| sed '
s@^.*]\+\)\?>\1/.*$@\1@
t
d
' \
| sort -Vr
); do
remVer=$(
curl_it -L "${src%/*/*}/${mainVer}/" \
| sed '
s@^.*]\+\)\?>\1.*$@\2@
t
d
' \
| latest_version
)
if [ -n "${remVer}" ]; then
break
fi
done
elif echo "${src}" | \
grep -q "http://www\.mkgmap\.org\.uk/download"
then
remUrl="$(
echo "${src}" | \
sed 's|-r[0-9]\+\.zip$|.html|'
)"
remVer="r$(
curl_it "${remUrl}" | \
grep '"text: current()\.version"' | \
tr '<>' '\n' |
grep '^[0-9]\+$' | \
latest_version
)"
elif echo "${src}" | \
grep -qF '//www.roguetemple.com/'
then
remVer=$(
curl_it "${src%/*}/download.php" | \
sed -n '
s,^.*[^<>]\+ source code.*$,\1.\2.\3,
T
s,\.$,,
p
'
)
elif echo "${src}" | \
grep -q '//www\.apache\.org/dist/spamassassin/source/'
then
remVer=$(
curl_it 'https://spamassassin.apache.org/downloads.cgi' | \
tr '"' '\n' | \
sed '
s,^.*/Mail-SpamAssassin-\([0-9.]\+\)\.tar\.gz$,\1,
t
d
' | \
latest_version
)
elif echo "${src}" | \
grep -q '//zircon\.org\.uk/topal/'
then
remVer=$(
curl_it "${src%/*/*}/" | \
sed '
s,^.*\1.*$,\2,
t
d
' | \
latest_version
)
elif echo "${src}" \
| grep -q 'https://download\.qt\.io/archive/qt/'; then
for major in $(
curl_it 'https://download.qt.io/archive/qt/' \
| sed -n '
s@^.*\1.*$@\1@
T
s@/$@@
/^'"${pkgname#qt}"'/ p
' \
| sort -rV
); do
remVer=$(
curl_it 'https://download.qt.io/archive/qt/'"${major}"'/' \
| sed -n '
s@^.*\1.*$@\1@
T
s@/$@@
p
' \
| sort -V \
| tail -n1
)
if [ -n "${remVer}" ]; then
break;
fi
done
elif echo "${src}" \
| grep -q 'https://www\.quinapalus\.com/'; then
remVer=$(
curl_it 'https://www.quinapalus.com/qxwdownload.html' \
| sed '
s@^Release \([0-9]\+\)$@\1@
t
d
' \
| sort -V \
| tail -n1
)
else
continue
fi
srcKnown=true
break
done
if [ -z "${source[*]}${source_i686[*]}${source_x86_64[*]}" ]; then
srcKnown=true
remVer="${pkgver}"
fi
if ! ${srcKnown}
then
printf '%s: Unknown source:\n' "$1"
printf "'%s'\n" "${source[@]}" "${source_i686[@]}" "${source_x86_64[@]}"
exit 1
fi
if ${maschinenlesbar}
then
echo "remVer='${remVer}'"
echo "pkgver='${pkgver}'"
echo "pkgrel='${pkgrel}'"
else
if [ ! "${pkgver}" == "${remVer}" ]
then
if ! ${archlinuxewe}; then
printf '(32) '
fi
echo "$1: ${pkgname}: ${remVer} vs. ${pkgver}" | \
sed "s|^\([^:]\+\): \1:|\1:|"
fi
fi
elif ${versionenErmitteln}
then
echo "$@" | \
tr " " "\n" | \
parallel -j${jobs} "${me}" "${optArgs[@]}" {} \;
exit $?
else
for s in "$@"
do
grep "^${s}:" "${versionenDatei}"
done
fi
|