summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-01-14 08:57:07 +0100
committerErich Eckner <git@eckner.net>2020-01-14 08:57:07 +0100
commit90c542991e4aad8924ac6eeccfb87cb7e5c3ee12 (patch)
treed1a363191bf70b69d9659d6f98797373d98dac7d
parent2e81aa9cda646d8486d2b3ae2d6158641510abca (diff)
downloaddevops-90c542991e4aad8924ac6eeccfb87cb7e5c3ee12.tar.xz
watch-versions: add fallback of (slightly modified) upstream package
-rwxr-xr-xwatch-versions52
1 files changed, 35 insertions, 17 deletions
diff --git a/watch-versions b/watch-versions
index ac42c72..85d16e9 100755
--- a/watch-versions
+++ b/watch-versions
@@ -95,27 +95,45 @@ case "${pkgbase}" in
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
+ # It might be a (slightly modified) copy of an upstream package:
+ # Then we simply take the upstream pkgver.
+ newver=$(
+ for repository in /var/lib/pacman/sync/*.db; do
+ bsdtar -tf "${repository}"
+ done \
+ | sed '
+ s@^'"${pkgbase//./\.}"'-\([^-]\+\)-[0-9.]\+/desc$@\1@
+ t
+ d
+ ' \
+ | sort -V \
+ | tail -n1
+ )
+ if [ -z "${newver}" ]; then
+ >&2 printf 'Checking the version of package "%s" is not yet implemented!\n' "${pkgbase}"
+ exit 1
+ fi
;;
esac
-if [ -z "${regex_b}" ]; then
- regex_b="${regex}"
-fi
+if [ -z "${newver}" ]; then
+ if [ -z "${regex_b}" ]; then
+ regex_b="${regex}"
+ fi
-newver=$(
- curl -LSs "${url}" | \
- sed '
- '"${range}"' s/^.*'"${regex}"'.*$/\1/
- t
- '"${range}"' s/^.*'"${regex_b}"'.*$/\1/
- t
- d
- ' | \
- sort -V | \
- tail -n1
-)
+ newver=$(
+ curl -LSs "${url}" | \
+ sed '
+ '"${range}"' s/^.*'"${regex}"'.*$/\1/
+ t
+ '"${range}"' s/^.*'"${regex_b}"'.*$/\1/
+ t
+ d
+ ' | \
+ sort -V | \
+ tail -n1
+ )
+fi
if [ "${newver}" != "${oldver}" ]; then
if ${machine_readable}; then