index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Levente Polyak <anthraxx@archlinux.org> | 2022-09-11 22:08:47 +0200 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2023-05-19 22:27:11 +0200 |
commit | 30616c4fdea37dda26c33d4f94052b99dba2401d (patch) | |
tree | 4ddfb16dcf3a59ecd3f2603ef75ca7939c9be8fb | |
parent | 5eb09a9cc931ca506875276dcd7b794395ba77d0 (diff) |
-rw-r--r-- | contrib/completion/zsh/_devtools.in | 1 | ||||
-rw-r--r-- | lib/common.sh | 5 | ||||
-rw-r--r-- | src/archco.in | 24 |
diff --git a/contrib/completion/zsh/_devtools.in b/contrib/completion/zsh/_devtools.in index 1dc112f..d2fcfed 100644 --- a/contrib/completion/zsh/_devtools.in +++ b/contrib/completion/zsh/_devtools.in @@ -22,6 +22,7 @@ _archco_cmds=( ) _archco_clone_args=( + '(-m --maintainer=)'{-m,--maintainer=}'[Clone all packages of the named maintainer]:maintainer:' '(-u --unprivileged)'{-u,--unprivileged}'[Read-only access without packager info as Git author]' '(-h --help)'{-h,--help}'[Display usage]' '*:packages:_devtools_completions_all_packages' diff --git a/lib/common.sh b/lib/common.sh index 5f134ae..fe6450a 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -42,6 +42,11 @@ stat_busy() { printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" "$@" >&2 } +stat_progress() { + # shellcheck disable=2059 + printf "${BOLD}.${ALL_OFF}" >&2 +} + stat_done() { # shellcheck disable=2059 printf "${BOLD}done${ALL_OFF}\n" >&2 diff --git a/src/archco.in b/src/archco.in index b401c23..2804cba 100644 --- a/src/archco.in +++ b/src/archco.in @@ -46,6 +46,7 @@ usage_clone() { HTTPS. OPTIONS + -m, --maintainer=NAME Clone all packages of the named maintainer -u, --unprivileged Clone package with read-only access and without packager info as Git author. -h, --help Show this help text @@ -127,6 +128,15 @@ if (( CLONE )); then UNPRIVILEGED=1 shift ;; + -m|--maintainer) + (( $# <= 1 )) && die "missing argument for %s" "$1" + MAINTAINER="$2" + shift 2 + ;; + --maintainer=*) + MAINTAINER="${1#*=}" + shift + ;; --) shift break @@ -170,6 +180,8 @@ elif (( CONFIGURE )); then done fi +pkgbases=("$@") + # Load makepkg.conf variables to be available load_makepkg_config @@ -191,7 +203,17 @@ if (( ! UNPRIVILEGED )); then fi fi -pkgbases=("$@") +# Query packages of a maintainer +if [[ -n ${MAINTAINER} ]]; then + stat_busy "Query packages for ${MAINTAINER}" + max_pages=$(curl --silent --location --fail --retry 3 --retry-delay 3 "https://archlinux.org/packages/search/json/?sort=name&maintainer=${MAINTAINER}" | jq -r '.num_pages') + mapfile -t pkgbases < <(for page in $(seq "${max_pages}"); do + curl --silent --location --fail --retry 3 --retry-delay 3 "https://archlinux.org/packages/search/json/?sort=name&maintainer=${MAINTAINER}&page=${page}" | jq -r '.results[].pkgbase' + stat_progress + done | sort --unique) + stat_done +fi + for pkgbase in "${pkgbases[@]}"; do if (( CLONE )); then if [[ ! -d ${pkgbase} ]]; then |