diff options
author | Dave Reisner <dreisner@archlinux.org> | 2017-03-25 08:59:38 -0400 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2017-03-25 09:18:50 -0400 |
commit | c2b33327aa7b8faf3c88aeaa007e7eb4bba4869f (patch) | |
tree | 15b46e42eb771e2c095e31ba7e27ee3fe6dcab02 /archweb.inc.sh | |
parent | f638242d6e81b72f8e0ea11a4f8c3c84099fd5b6 (diff) | |
download | asp32-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.sh | 9 |
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" +} |