Mercurial > infra > home / .stash/scripts/pacman-pkgsearch.sh
changeset 49: |
f3c32ffdbbef |
parent: |
953c5127546a
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Thu, 20 Jun 2024 22:29:29 -0400 |
permissions: |
-rwxr-xr-x |
description: |
publish-dir remote |
3 # SPDX-License-Identifier: GPL-2.0 13 -m [maintainer] find packages from maintainer 14 -p [packager] find packages from the last packager 16 -s print the package maintainers 17 -l [limit] co-maintainer limit to filter on default: 1 18 -f [repository] filter on repository, Default: core extra multilib community 19 -o list flagged packages 20 -n use pkgname instead of pkgbase (not recommended as we sort away split pkgs) 23 Packages from a maintainer with 2 maintainers 24 $ pkgsearch -m Foxboron -l 2 25 Orphaned packages in [extra] 26 $ pkgsearch -f extra -l 0 -m orphan 27 Packages installed on the system from [core] with 1 maintainer 28 $ pkgsearch -q -f core -l 1 29 Locally installed packages from [community], orphaned, and flagged out-of-date 30 $ pkgsearch -q -f community -l 0 -m orphan -o 43 -m
) shift
; maintainer_query="maintainer=$1" ;; 44 -p
) shift
; packager_query="&packager=$1" ;; 45 -q
) local_packages=1;; 46 -s
) see_maintainers=1;; 47 -l
) shift
; limit_maintainers=$1;; 48 -f
) shift
; filter+=("${1,,}");; 49 -o
) out_of_date="Flagged";; 58 test ${#filter} -eq
0 && filter=(core
extra
community
multilib
) 59 if ((local_packages
)); then 60 # shellcheck disable=SC2046 61 expac
-S
"%r %a %n %e" $(expac
%n
) | grep
-P
"^($(tr
' ' '|' <<< "${filter[*]}")) " 63 filter=("${filter[@]^}") # Uppercase the repo names 64 filter=("${filter[@]/#/&repo=}") # Prepend &repo= to all elements 65 query="?${maintainer_query}${packager_query}$(printf "%s" "${filter[@]}")&flagged=$out_of_date" 66 curl
-s
"https://archlinux.org/packages/search/json/$query" \ 67 | jq
-r
'.results[] | "\(.repo) \(.arch) \(.pkgname) \(.pkgbase)"' | sort
| uniq
71 while read -r
repo
arch
pkg
_
; do 72 # shellcheck disable=SC2016 73 format="select(.maintainers | length == \$LIMIT) | \"\(${name})\"" 74 if ((see_maintainers
)); then 75 # shellcheck disable=SC2016 76 format="select(.maintainers | length == \$LIMIT) | \"\(${name})\", (.maintainers | join(\" \"))" 78 curl
-s
"https://archlinux.org/packages/$repo/$arch/$pkg/json/" | \ 79 jq
-r
--argjson
LIMIT
"$limit_maintainers" "$format" 80 done <<< "$(find_packages
| sort
-u
-k4,4
)"