#!/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 oldver=$( git -C "$(dirname "$0")/../packages" remote | \ while read -r remote; do eval "$( git -C "$(dirname "$0")/../packages" archive "${remote}/master" -- 2>/dev/null | \ tar -Ox --wildcards '*/'"${pkgbase}"'/PKGBUILD' 2>/dev/null | \ sed -n ' /^epoch=/p /^pkgver=/p ' )" printf '%s %s\n' "${epoch-0}" "${pkgver}" done | \ sort -k1n,1 -k2V,2 | \ tail -n1 | \ sed ' s/^0\s\+// s/\s\+/:/ ' ) case "${pkgbase}" in 'linux-pae') url='https://www.kernel.org/pub/linux/kernel/v4.x/' regex='' ;; 'pcmciautils') url='https://kernel.org/pub/linux/utils/kernel/pcmcia/' regex='' ;; 'archlinux32-keyring'|'archlinux32-keyring-transition') url='https://sources.archlinux32.org/sources/' regex='' ;; *) >&2 printf 'Checking the version of package "%s" is not yet implemented!\n' "${pkgbase}" exit 1 ;; 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