From df49c9b89e56b6c8d2d20cdcc9e03dc80996fcdd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 12:36:33 -0400 Subject: use tab indent --- any-to-ours | 78 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'any-to-ours') diff --git a/any-to-ours b/any-to-ours index a1697c7..6afc7b0 100755 --- a/any-to-ours +++ b/any-to-ours @@ -2,9 +2,9 @@ # Releases 'any' packages from Arch arches to ours trap_exit() { - echo - error "$@" - exit 1 + echo + error "$@" + exit 1 } source "$(dirname "$(readlink -e "$0")")/config" @@ -22,51 +22,51 @@ BASEARCH='x86_64' # Traverse all Arch repos for _repo in ${ARCHREPOS[@]}; do - msg "Processing ${_repo}..." + msg "Processing ${_repo}..." -# Find 'any' packages -# This is hardcoded but it could release other arches... - PKGS=($(find "${FTP_BASE}/${_repo}/os/${BASEARCH}/" \ - -iname '*-any.pkg.tar.?z' \ - -printf "%f ")) + # Find 'any' packages + # This is hardcoded but it could release other arches... + PKGS=($(find "${FTP_BASE}/${_repo}/os/${BASEARCH}/" \ + -iname '*-any.pkg.tar.?z' \ + -printf "%f ")) - if [ ${#PKGS[@]} -eq 0 ]; then - msg2 "No 'any' packages here" - continue - fi + if [ ${#PKGS[@]} -eq 0 ]; then + msg2 "No 'any' packages here" + continue + fi - for _arch in ${OURARCHES[@]}; do - msg2 "Syncing ${_arch}..." + for _arch in ${OURARCHES[@]}; do + msg2 "Syncing ${_arch}..." -# Sync 'any' only and extract the synced packages - SYNCED=($( - rsync -av \ - --include='*-any.pkg.tar.?z' \ - --include='*-any.pkg.tar.?z.sig' \ - --exclude='*' \ - ${FTP_BASE}/${_repo}/os/${BASEARCH}/ \ - ${FTP_BASE}/${_repo}/os/${_arch}/ 2>&1 | \ - grep 'any\.pkg\.tar\..z$' | \ - cut -d ' ' -f 1 )) + # Sync 'any' only and extract the synced packages + SYNCED=($( + rsync -av \ + --include='*-any.pkg.tar.?z' \ + --include='*-any.pkg.tar.?z.sig' \ + --exclude='*' \ + ${FTP_BASE}/${_repo}/os/${BASEARCH}/ \ + ${FTP_BASE}/${_repo}/os/${_arch}/ 2>&1 | \ + grep 'any\.pkg\.tar\..z$' | \ + cut -d ' ' -f 1 )) - if [ ${#SYNCED[@]} -eq 0 ]; then - msg2 "Already synced (or error happened)" - continue - fi + if [ ${#SYNCED[@]} -eq 0 ]; then + msg2 "Already synced (or error happened)" + continue + fi - msg2 "Synced ${#SYNCED[@]} packages: ${SYNCED[@]}" + msg2 "Synced ${#SYNCED[@]} packages: ${SYNCED[@]}" - msg2 "Adding to db..." + msg2 "Adding to db..." - pushd ${FTP_BASE}/${_repo}/os/${_arch}/ >/dev/null + pushd ${FTP_BASE}/${_repo}/os/${_arch}/ >/dev/null -# Add the packages to the db - repo-add ${_repo}${DBEXT} \ - ${SYNCED[@]} + # Add the packages to the db + repo-add ${_repo}${DBEXT} \ + ${SYNCED[@]} - popd >/dev/null + popd >/dev/null -# Avoid mixups - unset SYNCED PKGS - done + # Avoid mixups + unset SYNCED PKGS + done done -- cgit v1.2.3-2-g168b From ba575a4e64be157eeae1028ed86b29cb0042f41b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 13:29:51 -0400 Subject: More quoting fixes --- any-to-ours | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'any-to-ours') diff --git a/any-to-ours b/any-to-ours index 6afc7b0..c203a6e 100755 --- a/any-to-ours +++ b/any-to-ours @@ -21,7 +21,7 @@ trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR BASEARCH='x86_64' # Traverse all Arch repos -for _repo in ${ARCHREPOS[@]}; do +for _repo in "${ARCHREPOS[@]}"; do msg "Processing ${_repo}..." # Find 'any' packages @@ -35,7 +35,7 @@ for _repo in ${ARCHREPOS[@]}; do continue fi - for _arch in ${OURARCHES[@]}; do + for _arch in "${OURARCHES[@]}"; do msg2 "Syncing ${_arch}..." # Sync 'any' only and extract the synced packages @@ -44,8 +44,8 @@ for _repo in ${ARCHREPOS[@]}; do --include='*-any.pkg.tar.?z' \ --include='*-any.pkg.tar.?z.sig' \ --exclude='*' \ - ${FTP_BASE}/${_repo}/os/${BASEARCH}/ \ - ${FTP_BASE}/${_repo}/os/${_arch}/ 2>&1 | \ + "${FTP_BASE}/${_repo}/os/${BASEARCH}/" \ + "${FTP_BASE}/${_repo}/os/${_arch}/" 2>&1 | \ grep 'any\.pkg\.tar\..z$' | \ cut -d ' ' -f 1 )) @@ -58,11 +58,10 @@ for _repo in ${ARCHREPOS[@]}; do msg2 "Adding to db..." - pushd ${FTP_BASE}/${_repo}/os/${_arch}/ >/dev/null + pushd "${FTP_BASE}/${_repo}/os/${_arch}/" >/dev/null # Add the packages to the db - repo-add ${_repo}${DBEXT} \ - ${SYNCED[@]} + repo-add "${_repo}${DBEXT}" "${SYNCED[@]}" popd >/dev/null -- cgit v1.2.3-2-g168b From 386c2d00249eb244bbcc9a173a64f9435b70180a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 13:45:10 -0400 Subject: Use printf formatters instead of string interpolation. I used this command to find them: egrep -r --exclude-dir={test,.git} '(plain|msg|msg2|warning|error|stat_busy|stat_done|abort|die)\s+"?[^"]*\$' --- any-to-ours | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'any-to-ours') diff --git a/any-to-ours b/any-to-ours index c203a6e..d98cc5d 100755 --- a/any-to-ours +++ b/any-to-ours @@ -22,7 +22,7 @@ BASEARCH='x86_64' # Traverse all Arch repos for _repo in "${ARCHREPOS[@]}"; do - msg "Processing ${_repo}..." + msg "Processing %s..." "${_repo}" # Find 'any' packages # This is hardcoded but it could release other arches... @@ -31,12 +31,12 @@ for _repo in "${ARCHREPOS[@]}"; do -printf "%f ")) if [ ${#PKGS[@]} -eq 0 ]; then - msg2 "No 'any' packages here" + msg2 "No '%s' packages here" any continue fi for _arch in "${OURARCHES[@]}"; do - msg2 "Syncing ${_arch}..." + msg2 "Syncing %s..." "${_arch}" # Sync 'any' only and extract the synced packages SYNCED=($( @@ -54,7 +54,7 @@ for _repo in "${ARCHREPOS[@]}"; do continue fi - msg2 "Synced ${#SYNCED[@]} packages: ${SYNCED[@]}" + msg2 "Synced %d packages: %s" "${#SYNCED[@]}" "${SYNCED[*]}" msg2 "Adding to db..." -- cgit v1.2.3-2-g168b