summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-18 00:10:08 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-06-18 00:10:08 -0400
commit878a9afd8fe40fa4263c5af04491ff91c8f0c09a (patch)
tree5c8fd61691a9a1560be001cd0ace0112cb432a5a
parent5b6036ac62755ebc7414e0583abeeab33bb75644 (diff)
Use printf-formatters when possible (incomplete)
-rwxr-xr-xcron-jobs/ftpdir-cleanup2
-rwxr-xr-xcron-jobs/integrity-check2
-rwxr-xr-xcron-jobs/sourceballs8
-rwxr-xr-xcron-jobs/sourceballs24
-rwxr-xr-xdb-check-nonfree6
-rw-r--r--db-functions26
6 files changed, 24 insertions, 24 deletions
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index 77d90d2..af56aac 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -44,7 +44,7 @@ for repo in "${PKGREPOS[@]}"; do
missing_pkgs=($(comm -13 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}"))
if [ ${#missing_pkgs[@]} -ge 1 ]; then
- error "Missing packages in [${repo}] (${arch})..."
+ error "Missing packages in [%s] (%s)..." "${repo}" "${arch}"
for missing_pkg in "${missing_pkgs[@]}"; do
msg2 "${missing_pkg}"
done
diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check
index 33a4eb6..7459380 100755
--- a/cron-jobs/integrity-check
+++ b/cron-jobs/integrity-check
@@ -8,7 +8,7 @@ dirname="$(dirname "$(readlink -e "$0")")"
script_lock
if [ $# -ne 1 ]; then
- die "usage: ${0##*/} <mailto>"
+ die "usage: %s <mailto>" "${0##*/}"
fi
mailto=$1
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 2c11de2..2fc09d5 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -104,15 +104,15 @@ for repo in "${PKGREPOS[@]}"; do
done < "${WORKDIR}/db-${repo}"
if [ ${#newpkgs[@]} -ge 1 ]; then
- msg "Adding source packages for [${repo}]..."
+ msg "Adding source packages for [%s]..." "${repo}"
for new_pkg in "${newpkgs[@]}"; do
- msg2 "${new_pkg}"
+ msg2 '%s' "${new_pkg}"
done
fi
if [ ${#failedpkgs[@]} -ge 1 ]; then
- msg "Failed to create source packages for [${repo}]..."
+ msg "Failed to create source packages for [%s]..." "${repo}"
for failed_pkg in "${failedpkgs[@]}"; do
- msg2 "${failed_pkg}"
+ msg2 '%s' "${failed_pkg}"
done
fi
done
diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2
index 64bae4a..02ed04c 100755
--- a/cron-jobs/sourceballs2
+++ b/cron-jobs/sourceballs2
@@ -22,14 +22,14 @@ find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort
pushd "${SVNREPO}" >/dev/null
for repo in "${PKGREPOS[@]}"; do
- msg "Sourceballing [${repo}]"
+ msg "Sourceballing [%s]" "${repo}"
pushd "$repo" >/dev/null
find -maxdepth 1 -type d | while read pkg; do
pushd "${SVNREPO}/$repo/$pkg" >/dev/null
[[ ! -e ./PKGBUILD ]] && {
- warning "$repo/$pkg is not a package"
+ warning "%s is not a package" "$repo/$pkg"
continue
}
diff --git a/db-check-nonfree b/db-check-nonfree
index 253490b..bea0fa8 100755
--- a/db-check-nonfree
+++ b/db-check-nonfree
@@ -4,7 +4,7 @@
. "$(dirname "$(readlink -e "$0")")/db-functions"
if [[ $# -ge 1 ]]; then
- warning "Calling ${0##*/} with a specific repository is not supported"
+ error "Calling %s with a specific repository is not supported" "${0##*/}"
exit 1
fi
@@ -19,7 +19,7 @@ msg "Check nonfree in repo:"
nonfree=($(cut -d: -f1 "${BLACKLIST_FILE}" | sort -u))
for repo in "${ARCHREPOS[@]}"; do
for pkgarch in "${ARCHES[@]}"; do
- msg2 "$repo $pkgarch"
+ msg2 "%s %s" "$repo" "$pkgarch"
if [ ! -f "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" ]; then
continue
fi
@@ -33,7 +33,7 @@ for repo in "${ARCHREPOS[@]}"; do
fi
done
if [ ${#cleanpkgs[@]} -ge 1 ]; then
- msg2 "Nonfree: ${cleanpkgs[*]}"
+ msg2 "Nonfree: %s" "${cleanpkgs[*]}"
arch_repo_remove "${repo}" "${pkgarch}" "${cleanpkgs[@]}"
fi
done
diff --git a/db-functions b/db-functions
index 86a2b1e..a2f638e 100644
--- a/db-functions
+++ b/db-functions
@@ -40,7 +40,7 @@ script_lock() {
local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}"
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
local _owner="$(/usr/bin/stat -c %U "$LOCKDIR")"
- error "Script ${0##*/} is already locked by $_owner."
+ error "Script %s is already locked by $_owner." "${0##*/}"
exit 1
else
set_umask
@@ -51,7 +51,7 @@ script_lock() {
script_unlock() {
local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}"
if [ ! -d "$LOCKDIR" ]; then
- warning "Script ${0##*/} was not locked!"
+ warning "Script %s was not locked!" "${0##*/}"
restore_umask
return 1
else
@@ -71,12 +71,12 @@ cleanup() {
repo=${l%.*}
arch=${l#*.}
if [ -d "$TMPDIR/.repolock.$repo.$arch" ]; then
- msg "Removing left over lock from [${repo}] (${arch})"
+ msg "Removing left over lock from [%s] (%s)" "${repo}" "${arch}"
repo_unlock "$repo" "$arch"
fi
done
if [ -d "$TMPDIR/.scriptlock.${0##*/}" ]; then
- msg "Removing left over lock from ${0##*/}"
+ msg "Removing left over lock from %s" "${0##*/}"
script_unlock
fi
rm -rf "$WORKDIR"
@@ -115,11 +115,11 @@ repo_lock () {
# This is the lock file used by repo-add and repo-remove
if [ -f "${DBLOCKFILE}" ]; then
- error "Repo [${1}] (${2}) is already locked by repo-{add,remove} process $(cat $DBLOCKFILE)"
+ error "Repo [%s] (%s) is already locked by repo-{add,remove} process %s" "$1" "$2" "$(<"$DBLOCKFILE")"
return 1
fi
if [ -f "${FILESLOCKFILE}" ]; then
- error "Repo [${1}] (${2}) is already locked by repo-{add,remove} process $(cat ${FILESLOCKFILE})"
+ error "Repo [%s] (%s) is already locked by repo-{add,remove} process %s" "$1" "$2" "$(<"$FILESLOCKFILE")"
return 1
fi
@@ -136,8 +136,8 @@ repo_lock () {
while [ "$_count" -le "$_trial" ] || "$_lockblock" ; do
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
_owner="$(/usr/bin/stat -c %U "$LOCKDIR")"
- warning "Repo [${1}] (${2}) is already locked by $_owner. "
- msg2 "Retrying in $LOCK_DELAY seconds..."
+ warning "Repo [%s] (%s) is already locked by %s. " "${1}" "${2}" "$_owner"
+ msg2 "Retrying in %d seconds..." "$LOCK_DELAY"
else
LOCKS[${#LOCKS[*]}]="$1.$2"
set_umask
@@ -147,14 +147,14 @@ repo_lock () {
let _count=$_count+1
done
- error "Repo [${1}] (${2}) is already locked by $_owner. Giving up!"
+ error "Repo [%s] (%s) is already locked by %s. Giving up!" "${1}" "${2}" "$_owner"
return 1
}
repo_unlock () { #repo_unlock <repo-name> <arch>
local LOCKDIR="$TMPDIR/.repolock.$1.$2"
if [ ! -d "$LOCKDIR" ]; then
- warning "Repo lock [${1}] (${2}) was not locked!"
+ warning "Repo lock [%s] (%s) was not locked!" "${1}" "${2}"
restore_umask
return 1
else
@@ -202,7 +202,7 @@ getpkgname() {
_name="$(_grep_pkginfo "$1" "pkgname")"
if [ -z "$_name" ]; then
- error "Package '$1' has no pkgname in the PKGINFO. Fail!"
+ error "Package '%s' has no pkgname in the PKGINFO. Fail!" "$1"
exit 1
fi
@@ -215,7 +215,7 @@ getpkgver() {
_ver="$(_grep_pkginfo "$1" "pkgver")"
if [ -z "$_ver" ]; then
- error "Package '$1' has no pkgver in the PKGINFO. Fail!"
+ error "Package '%s' has no pkgver in the PKGINFO. Fail!" "$1"
exit 1
fi
@@ -227,7 +227,7 @@ getpkgarch() {
_ver="$(_grep_pkginfo "$1" "arch")"
if [ -z "$_ver" ]; then
- error "Package '$1' has no arch in the PKGINFO. Fail!"
+ error "Package '%s' has no arch in the PKGINFO. Fail!" "$1"
exit 1
fi