summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-04-17 14:45:58 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-17 14:45:58 -0400
commit6262754028e750dbbacd1d68618bf5553d78f3cd (patch)
tree735090a8c1c23771c7fcc778a26a95de27c374b2
parent6638878c5eb6d5116580d06cc3042a5e9beacb7e (diff)
Use += instead of jumping through hoops.
The += operator was introduced in Bash 3.1, and was already used in some places in dbscripts, but not everywhere. For normal strings, this isn't a big deal, but appending to an array without using += is nasty.
-rwxr-xr-xcron-jobs/sourceballs6
-rw-r--r--db-functions2
-rwxr-xr-xdb-move2
-rwxr-xr-xdb-remove4
-rwxr-xr-xdb-update2
5 files changed, 8 insertions, 8 deletions
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 0c2f9f9..a1030e9 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -82,7 +82,7 @@ for repo in "${PKGREPOS[@]}"; do
arch_svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \
"${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1
if [ $? -ge 1 ]; then
- failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}"
+ failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}")
continue
fi
@@ -93,9 +93,9 @@ for repo in "${PKGREPOS[@]}"; do
mv_acl "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}/${pkgbase}-${pkgver}${SRCEXT}"
# Avoid creating the same source package for every arch
echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs"
- newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}"
+ newpkgs+=("${pkgbase}-${pkgver}${SRCEXT}")
else
- failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}"
+ failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}")
cat "${WORKDIR}/${pkgbase}.log" >> "${WORKDIR}/makepkg-fail.log"
fi
popd >/dev/null
diff --git a/db-functions b/db-functions
index 9845e45..f00ed55 100644
--- a/db-functions
+++ b/db-functions
@@ -197,7 +197,7 @@ repo_lock () {
warning "Repo [%s] (%s) is already locked by %s." "${1}" "${2}" "$_owner"
msg2 "Retrying in %d seconds..." "$LOCK_DELAY"
else
- LOCKS[${#LOCKS[*]}]="$1.$2"
+ LOCKS+=("$1.$2")
set_umask
return 0
fi
diff --git a/db-move b/db-move
index cd67953..b589bca 100755
--- a/db-move
+++ b/db-move
@@ -91,7 +91,7 @@ for pkgbase in "${args[@]:2}"; do
arch_svn mv -q -r HEAD "${svnrepo_from}/$file@" "${svnrepo_to}/"
done
arch_svn rm --force -q "${svnrepo_from}"
- tag_list="$tag_list, $pkgarch"
+ tag_list+=", $pkgarch"
for pkgname in "${pkgnames[@]}"; do
for tarch in "${tarches[@]}"; do
diff --git a/db-remove b/db-remove
index 3bb67b0..ca56ecc 100755
--- a/db-remove
+++ b/db-remove
@@ -35,14 +35,14 @@ for pkgbase in "${pkgbases[@]}"; do
arch_svn checkout -q "${SVNREPO}/${pkgbase}" "${WORKDIR}/svn/${pkgbase}" >/dev/null
if [ -d "${WORKDIR}/svn/$pkgbase/repos/$svnrepo" ]; then
- remove_pkgs=("${remove_pkgs[@]}" $(. "${WORKDIR}/svn/$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgname[@]}))
+ remove_pkgs+=($(. "${WORKDIR}/svn/$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgname[@]}))
arch_svn rm --force -q "${WORKDIR}/svn/$pkgbase/repos/$svnrepo"
arch_svn commit -q "${WORKDIR}/svn/$pkgbase" -m "${0##*/}: $pkgbase removed by $(id -un)"
else
warning "%s not found in %s" "$pkgbase" "$svnrepo"
warning "Removing only %s from the repo" "$pkgbase"
warning "If it was a split package you have to remove the others yourself!"
- remove_pkgs[${#remove_pkgs[*]}]=$pkgbase
+ remove_pkgs+=("$pkgbase")
fi
done
diff --git a/db-update b/db-update
index 9a57b19..9fa9c1b 100755
--- a/db-update
+++ b/db-update
@@ -90,7 +90,7 @@ for repo in "${repos[@]}"; do
if [ -f "$FTP_BASE/${PKGPOOL}/${pkgfile}.sig" ]; then
ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "$FTP_BASE/$repo/os/${pkgarch}"
fi
- add_pkgs[${#add_pkgs[*]}]=${pkgfile}
+ add_pkgs+=("${pkgfile}")
done
if [ ${#add_pkgs[@]} -ge 1 ]; then
arch_repo_add "${repo}" "${pkgarch}" "${add_pkgs[@]}"