summaryrefslogtreecommitdiff
path: root/watch-versions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-12-27 20:30:33 +0100
committerErich Eckner <git@eckner.net>2019-12-27 20:30:33 +0100
commit13944f176d869ff2bbe3296dadc2acc6980e4227 (patch)
tree50ad3bc5b708d9167a4c3f95f3aced804c77cb4a /watch-versions
parente97f284a35c12f30d48c45f4a9b09ba73ff3b657 (diff)
downloaddevops-13944f176d869ff2bbe3296dadc2acc6980e4227.tar.xz
watch-versions: learn *-dummy packages
Diffstat (limited to 'watch-versions')
-rwxr-xr-xwatch-versions22
1 files changed, 18 insertions, 4 deletions
diff --git a/watch-versions b/watch-versions
index 9f8c920..3fd9f11 100755
--- a/watch-versions
+++ b/watch-versions
@@ -90,18 +90,32 @@ case "${pkgbase}" in
url='https://github.com/pypa/setuptools/releases'
regex='<a href="\/pypa\/setuptools\/releases\/tag\/v\([0-9.]\+\)">'
;;
+ *'-dummy')
+ rem_pkgbase="${pkgbase%-dummy}"
+ rem_pkgbase="${rem_pkgbase//+/%2B}"
+ url='https://www.archlinux.org/packages/?q='"${rem_pkgbase}"
+ range='/^<div id="exact-matches"/,/^<\/div>/'
+ regex='<td>\([^-<>]\+\)-[0-9]\+<\/td>'
+ regex_b='<td><span class="flagged">\([^-<>]\+\)-[0-9]\+<\/span><\/td>'
+ ;;
*)
>&2 printf 'Checking the version of package "%s" is not yet implemented!\n' "${pkgbase}"
exit 1
;;
esac
+if [ -z "${regex_b}" ]; then
+ regex_b="${regex}"
+fi
+
newver=$(
curl -LSs "${url}" | \
- sed -n '
- s/^.*'"${regex}"'.*$/\1/
- T
- p
+ sed '
+ '"${range}"' s/^.*'"${regex}"'.*$/\1/
+ t
+ '"${range}"' s/^.*'"${regex_b}"'.*$/\1/
+ t
+ d
' | \
sort -V | \
tail -n1