From 9159b9577f51f60f13f34506280737be0b4edd97 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 26 Feb 2021 17:25:14 +0300 Subject: Convert bash functions that return arrays to comply with Bash Style Guide --- brep/handler/submit/submit-pub.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'brep/handler/submit/submit-pub.in') diff --git a/brep/handler/submit/submit-pub.in b/brep/handler/submit/submit-pub.in index ccb701d..ea12a29 100644 --- a/brep/handler/submit/submit-pub.in +++ b/brep/handler/submit/submit-pub.in @@ -85,7 +85,10 @@ verbose= #true rep_lock_timeout=60 trap "{ exit 1; }" ERR -set -o errtrace # Trap ERR in functions. +set -o errtrace # Trap in functions and subshells. +set -o pipefail # Fail if any pipeline command fails. +shopt -s lastpipe # Execute last pipeline command in the current shell. +shopt -s nullglob # Expand no-match globs to nothing rather than themselves. @import brep/handler/handler@ @import brep/handler/submit/submit@ @@ -297,7 +300,7 @@ trap exit_trap EXIT # Use -.* without .tar.gz in case we want to support more # archive types later. # -IFS=$'\n' eval 'p=($(run pkg_find_archive "$name-$version.*" "$repo_old/1"))' +run pkg_find_archive "$name-$version.*" "$repo_old/1" | readarray -t p if [ "${#p[@]}" -ne 0 ]; then n="${p[1]}" @@ -327,8 +330,7 @@ run rsync -rtO --exclude 'packages.manifest' --link-dest="$repo_old" \ # Remove the package version revision archives that may exist in the # repository. # -IFS=$'\n' eval \ -'arcs=($(run pkg_find_archives "$name" "$version*" "$repo_new/1"))' +run pkg_find_archives "$name" "$version*" "$repo_new/1" | readarray -t arcs for f in "${arcs[@]}"; do run rm "$f" -- cgit v1.1