From 90c542991e4aad8924ac6eeccfb87cb7e5c3ee12 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 14 Jan 2020 08:57:07 +0100 Subject: watch-versions: add fallback of (slightly modified) upstream package --- watch-versions | 52 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 17 deletions(-) (limited to 'watch-versions') 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='\([^-<>]\+\)-[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 -- cgit v1.2.3-70-g09d2