diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2018-06-23 21:51:28 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2018-10-07 19:00:51 -0400 |
commit | 00f5e670ce6f1827e21940af8a35972b416263fe (patch) | |
tree | 3def7da612b6d38b2030bf84c2c2445076fbb5ba | |
parent | 71ca32c94c4c63b14e567daf4a00349bf68c0618 (diff) |
db-update: Compute repos=() in a single pass
Currently, it first figures staging_repos=(), which look like
"$STAGING/whatever/repo", then it maps and filters that list to be
repos=(), which looks like "repo". We can do this all in one pass, for
less code and greater clarity.
Note that this subsumes fauno's previous commit 86b3d7c0 that protected
against duplicate repos.
-rwxr-xr-x | db-update | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -9,19 +9,16 @@ if (( $# >= 1 )); then fi # Find repos with packages to release -mapfile -t -d '' staging_repos < <( +mapfile -t -d '' repos < <( for f in "${STAGING}"/**/*${PKGEXTS}; do - printf '%s\0' "${f%/*}" + repo=${f%/*} + repo=${repo##*/} + if in_array "$repo" "${PKGREPOS[@]}"; then + printf '%s\0' "$repo" + fi done | sort -uz ) -repos=() -for staging_repo in "${staging_repos[@]##*/}"; do - if in_array "${staging_repo}" "${PKGREPOS[@]}"; then - repos+=("${staging_repo}") - fi -done - # TODO: this might lock too much (architectures) for repo in "${repos[@]}"; do for pkgarch in "${ARCHES[@]}"; do |