summaryrefslogtreecommitdiff
path: root/archweb.inc.sh
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2017-03-25 08:59:38 -0400
committerDave Reisner <dreisner@archlinux.org>2017-03-25 09:18:50 -0400
commitc2b33327aa7b8faf3c88aeaa007e7eb4bba4869f (patch)
tree15b46e42eb771e2c095e31ba7e27ee3fe6dcab02 /archweb.inc.sh
parentf638242d6e81b72f8e0ea11a4f8c3c84099fd5b6 (diff)
downloadasp32-c2b33327aa7b8faf3c88aeaa007e7eb4bba4869f.tar.xz
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.
Diffstat (limited to 'archweb.inc.sh')
-rw-r--r--archweb.inc.sh9
1 files changed, 9 insertions, 0 deletions
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"
+}