@@ -2,6 +2,10 @@
. /usr/share/makepkg/util.sh
+# global shell options for enhanced bash scripting
+shopt -s globstar nullglob
+
+
# Some PKGBUILDs need CARCH to be set
CARCH="x86_64"
@@ -9,9 +9,11 @@ if (( $# >= 1 )); then
fi
# Find repos with packages to release
-if ! staging_repos=($(find "${STAGING}" -mindepth 1 -type f -name "*${PKGEXTS}" -printf '%h\n' | sort -u)); then
- die "Could not read %s" "$STAGING"
-fi
+mapfile -t -d '' staging_repos < <(
+ for f in "${STAGING}"/**/*${PKGEXTS}; do
+ printf '%s\0' "${f%/*}"
+ done | sort -uz
+)
repos=()
for staging_repo in ${staging_repos[@]##*/}; do
Don't bother emitting errors. bash doesn't show globbing errors if it cannot read a directory to try globbing there. And the former code never aborted on errors anyway, as without `set -o pipefail` the sort command swallowed the return code. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> --- v3: remove extraneous use of [[ -d ... ]] db-functions | 4 ++++ db-update | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-)