diff options
Diffstat (limited to 'xnuxnu')
-rwxr-xr-x | xnuxnu | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/xnuxnu b/xnuxnu new file mode 100755 index 0000000..aaf0105 --- /dev/null +++ b/xnuxnu @@ -0,0 +1,30 @@ +#!/bin/sh +# xnuxnu - upstream version checker for XBPS templates + +pkgname=$1 +IFS=' +' + +export LC_ALL=C + +./xbps-src show "$1" | + sed -n '/distfiles:/{s/[^:]*:[\t]*//;s|/[^/]*$|/|p}; + /Upstream URL/s/[^:]*:[\t]*//p' | + while read url; do + rx="\b$pkgname[-_]((src|source)[-_])?\K([^-/_\s]*?\d[^-/_\s]*?)(?=(?:[-_.](?:src|source|orig))?\.(?:[jt]ar|t[bglx]z|tbz2|zip))\b" + case "$url" in + *sourceforge.net/sourceforge*) + url="http://sourceforge.net/projects/$pkgname/rss?limit=200";; + *cpan.org*) + pkgname=${pkgname#perl-};; + *github.com*) + githubname="$(echo $url | cut -d/ -f4,5)" + url="https://api.github.com/repos/$githubname/tags" + rx='"name":\s*"\K[^\d]*([\d\.]+)(?=")';; + esac + + echo "fetching $url" 2>/dev/null + curl -A xnuxnu -Ls $url | + grep -Po -i "$rx" | + sort -Vu + done |