index : devops | |
Archlinux32 devs' convenience-scripts | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-07-10 15:24:56 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-07-10 15:24:56 +0200 |
commit | f29a56575b1296eb22d91d7e7de87a566bbb46ec (patch) | |
tree | 4d2bbb03970aaa3d8633791972738c93173c9422 /watch-versions | |
parent | 2ddb6b0f7fc2d4faa30d9c2ed8881e361c2c4ccb (diff) |
-rwxr-xr-x | watch-versions | 71 |
diff --git a/watch-versions b/watch-versions new file mode 100755 index 0000000..83c70df --- /dev/null +++ b/watch-versions @@ -0,0 +1,71 @@ +#!/bin/sh + +if [ $# -eq 0 ]; then + git -C "$(dirname "$0")/../packages" pull --ff-only >/dev/null 2>&1 +# curl -Ss 'https://packages.archlinux32.org/?uses_upstream=Does+Not+Use+Upstream&fuzzy&tsv' + curl -Ss 'http://packages.archlinux32.local/?uses_upstream=Does+Not+Use+Upstream&fuzzy&tsv' | \ + { + read -r headers + pkgbase_column=$( + printf '%s\n' "${headers}" | \ + tr '\t' '\n' | \ + grep -nxF 'pkgbase' | \ + cut -d: -f1 + ) + cut -f${pkgbase_column} + } | \ + sort -u | \ + parallel -j0 "$0" + exit $? +elif [ $# -gt 1 ]; then + >&2 echo 'I need zero or one argument.' + exit 1 +fi + +pkgbase="$1" +unset pkgver +unset epoch + +eval "$( + git -C "$(dirname "$0")/../packages" archive origin/master -- | \ + tar -Ox --wildcards '*/'"${pkgbase}"'/PKGBUILD' | \ + sed -n ' + /^epoch=/p + /^pkgver=/p + ' +)" + +oldver="${epoch}${epoch+:}${pkgver}" + +case "${pkgbase}" in + 'linux-pae') + url='https://www.kernel.org/pub/linux/kernel/v4.x/' + regex='<a href="linux-\([0-9.]\+\)\.tar\.sign">' + ;; + 'pcmciautils') + url='https://kernel.org/pub/linux/utils/kernel/pcmcia/' + regex='<a href="pcmciautils-\([0-9.]\+\)\.tar\.sign">' + ;; + 'archlinux32-keyring'|'archlinux32-keyring-transition') + url='https://sources.archlinux32.org/sources/' + regex='<a href="archlinux32-keyring-v\([0-9.]\+\)\.tar\.gz">' + ;; +esac + +newver=$( + curl -LSs "${url}" | \ + sed -n ' + s/^.*'"${regex}"'.*$/\1/ + T + p + ' | \ + sort -V | \ + tail -n1 +) + +if [ "${newver}" != "${oldver}" ]; then + printf '%s: %s vs. %s\n' \ + "${pkgbase}" \ + "${newver}" \ + "${oldver}" +fi |