From c2b33327aa7b8faf3c88aeaa007e7eb4bba4869f Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 25 Mar 2017 08:59:38 -0400 Subject: Handle split packages When a basic lookup fails, attempt to resolve the package name through archweb to get the pkgbase, under the assumption that this might be a split package. This adds jq as a new dependency. Closes #8. --- archweb.inc.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 archweb.inc.sh (limited to 'archweb.inc.sh') diff --git a/archweb.inc.sh b/archweb.inc.sh new file mode 100644 index 0000000..b660c29 --- /dev/null +++ b/archweb.inc.sh @@ -0,0 +1,9 @@ +archweb_get_pkgbase() { + local pkgbase + + pkgbase=$(curl -s "https://www.archlinux.org/packages/search/json/?q=$1" | + jq -r --arg pkgname "$1" 'limit(1; .results[] | select(.pkgname == $pkgname).pkgbase)') + [[ $pkgbase ]] || return 1 + + printf '%s\n' "$pkgbase" +} -- cgit v1.2.3-54-g00ecf