aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremmett1 <emmett1.2miligrams@protonmail.com>2024-06-24 00:09:41 +0800
committeremmett1 <emmett1.2miligrams@protonmail.com>2024-06-24 00:09:41 +0800
commitd1817ea579b6ca637b9d422e859be57f12ac0a88 (patch)
tree471726e4f92f4b7309007c54eb6979201372e423
parentdfd4934a783d991b31063171f9e454a218e431b1 (diff)
downloadautils-d1817ea579b6ca637b9d422e859be57f12ac0a88.tar.gz
autils-d1817ea579b6ca637b9d422e859be57f12ac0a88.zip
added apkg-outdated
-rwxr-xr-xapkg-outdated32
1 files changed, 32 insertions, 0 deletions
diff --git a/apkg-outdated b/apkg-outdated
new file mode 100755
index 0000000..6660175
--- /dev/null
+++ b/apkg-outdated
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+[ "$1" ] || {
+ echo "script to check outdated package from repology"
+ echo " usage: $0 <port path> <port path> ..."
+ echo
+ exit 1
+}
+
+while [ "$1" ]; do
+ unset curver port
+ [ -f $1/abuild ] && port=$(realpath $1)
+ [ "$port" ] || { shift; continue; }
+ repo=${port%/*}; repo=${repo##*/}
+ pname=${1##*/}
+ curver=$(grep ^version= $port/abuild | awk -F = '{print $2}')
+ [ "$curver" ] || { shift; continue; }
+ if [ -s $1/outdated ]; then
+ pname=$(tail -n1 $1/outdated)
+ else
+ case $pname in
+ python-*) pname=python:${pname#python-};;
+ esac
+ fi
+ newver=$(curl -SsZA a https://repology.org/badge/latest-versions/$pname.svg | grep middle | sed 's/.*middle">//;s/<.*//;s/,//' | tr ' ' '\n' | tail -n1)
+ if [ "$newver" = "-" ]; then
+ echo "$repo/$pname 404 ($curver)"
+ elif [ "$curver" != "$newver" ]; then
+ echo "$repo/$pname $newver ($curver)"
+ fi
+ shift
+done