summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2018-02-15 22:26:24 -0500
committerEli Schwartz <eschwartz@archlinux.org>2018-02-20 00:34:41 -0500
commit3e01ba9a82234c1d78a14be095c18a626591ad71 (patch)
treea116cdb1d9186d06d84d87c4846adeca54a96997
parent8757c459089c0db12e57db66561f640f657e34ac (diff)
db-update: replace external find command with bash globbing
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.
-rw-r--r--db-functions4
-rwxr-xr-xdb-update8
2 files changed, 9 insertions, 3 deletions
diff --git a/db-functions b/db-functions
index e8eb2bc..394c7a2 100644
--- a/db-functions
+++ b/db-functions
@@ -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"
diff --git a/db-update b/db-update
index a8d885a..4e17184 100755
--- a/db-update
+++ b/db-update
@@ -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