[arch-projects] [dbscripts] [PATCH 02/11] Use printf-formatters instead of string interpolation on msg, error, etc.

Luke Shumaker lukeshu at sbcglobal.net
Sun May 17 23:44:10 UTC 2015


From: Luke Shumaker <LukeShu at sbcglobal.net>

---
 cron-jobs/ftpdir-cleanup  | 12 +++++-----
 cron-jobs/integrity-check |  2 +-
 cron-jobs/sourceballs     | 12 +++++-----
 cron-jobs/update-web-db   |  2 +-
 db-functions              | 57 +++++++++++++++++++++++------------------------
 db-move                   | 10 ++++-----
 db-remove                 | 10 ++++-----
 db-repo-add               |  8 +++----
 db-repo-remove            |  6 ++---
 db-update                 | 24 ++++++++++----------
 testing2x                 |  6 ++---
 11 files changed, 74 insertions(+), 75 deletions(-)

diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index a2820e1..f6487cf 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -44,17 +44,17 @@ 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}"
+				msg2 '%s' "${missing_pkg}"
 			done
 		fi
 
 		old_pkgs=($(comm -23 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}"))
 		if [ ${#old_pkgs[@]} -ge 1 ]; then
-			msg "Removing old packages from [${repo}] (${arch})..."
+			msg "Removing old packages from [%s] (%s)..." "${repo}" "${arch}"
 			for old_pkg in "${old_pkgs[@]}"; do
-				msg2 "${old_pkg}"
+				msg2 '%s' "${old_pkg}"
 				clean_pkg "${FTP_BASE}/${repo}/os/${arch}/${old_pkg}"
 			done
 		fi
@@ -70,7 +70,7 @@ old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db"))
 if [ ${#old_pkgs[@]} -ge 1 ]; then
 	msg "Removing old packages from package pool..."
 	for old_pkg in "${old_pkgs[@]}"; do
-		msg2 "${old_pkg}"
+		msg2 '%s' "${old_pkg}"
 		clean_pkg "$FTP_BASE/${PKGPOOL}/${old_pkg}"
 	done
 fi
@@ -79,7 +79,7 @@ old_pkgs=($(find "${CLEANUP_DESTDIR}" -type f -name "*${PKGEXT}" -mtime +"${CLEA
 if [ ${#old_pkgs[@]} -ge 1 ]; then
 	msg "Removing old packages from the cleanup directory..."
 	for old_pkg in "${old_pkgs[@]}"; do
-		msg2 "${old_pkg}"
+		msg2 '%s' "${old_pkg}"
 		if ! "${CLEANUP_DRYRUN}"; then
 			rm -f "${CLEANUP_DESTDIR}/${old_pkg}"
 			rm -f "${CLEANUP_DESTDIR}/${old_pkg}.sig"
diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check
index e77eac7..677c0d3 100755
--- a/cron-jobs/integrity-check
+++ b/cron-jobs/integrity-check
@@ -8,7 +8,7 @@ dirname="$(dirname "$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 dee849a..0c2f9f9 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -103,15 +103,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
@@ -125,7 +125,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then
 	msg "Removing old source packages..."
 	"${SOURCE_CLEANUP_DRYRUN}" && warning 'dry run mode is active'
 	for old_pkg in "${old_pkgs[@]}"; do
-		msg2 "${old_pkg}"
+		msg2 '%s' "${old_pkg}"
 		if ! "${SOURCE_CLEANUP_DRYRUN}"; then
 			mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
 			touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
@@ -137,7 +137,7 @@ old_pkgs=($(find "${SOURCE_CLEANUP_DESTDIR}" -type f -name "*${SRCEXT}" -mtime +
 if [ ${#old_pkgs[@]} -ge 1 ]; then
 	msg "Removing old source packages from the cleanup directory..."
 	for old_pkg in "${old_pkgs[@]}"; do
-		msg2 "${old_pkg}"
+		msg2 '%s' "${old_pkg}"
 		"${SOURCE_CLEANUP_DRYRUN}" || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
 	done
 fi
diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db
index 1a725dc..88bf464 100755
--- a/cron-jobs/update-web-db
+++ b/cron-jobs/update-web-db
@@ -16,7 +16,7 @@ LOGOUT="/tmp/archweb_update.log"
 # figure out what operation to perform
 cmd="${0##*/}"
 if [[ $cmd != "update-web-db" && $cmd != "update-web-files-db" ]]; then
-	die "Invalid command name '$cmd' specified!"
+	die "Invalid command name '%s' specified!" "$cmd"
 fi
 
 script_lock
diff --git a/db-functions b/db-functions
index a40f2bb..2953d41 100644
--- a/db-functions
+++ b/db-functions
@@ -103,7 +103,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 %s." "${0##*/}" "$_owner"
 		exit 1
 	else
 		set_umask
@@ -114,7 +114,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
@@ -134,12 +134,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"
@@ -178,11 +178,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
 
@@ -199,8 +199,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
@@ -210,14 +210,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
@@ -265,7 +265,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
 
@@ -278,7 +278,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
 
@@ -290,7 +290,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
 
@@ -309,10 +309,10 @@ getpkgfile() {
 		error 'No canonical package found!'
 		exit 1
 	elif [ ! -f "${1}" ]; then
-		error "Package ${1} not found!"
+		error "Package %s not found!" "${1}"
 		exit 1
 	elif "${REQUIRE_SIGNATURE}" && [ ! -f "${1}.sig" ]; then
-		error "Package signature ${1}.sig not found!"
+		error "Package signature %s not found!" "${1}.sig"
 		exit 1
 	fi
 
@@ -328,10 +328,10 @@ getpkgfiles() {
 
 	for f in "${@}"; do
 		if  [ ! -f "${f}" ]; then
-			error "Package ${f} not found!"
+			error "Package %s not found!" "${f}"
 			exit 1
 		elif "${REQUIRE_SIGNATURE}" && [ ! -f "${f}.sig" ]; then
-			error "Package signature ${f}.sig not found!"
+			error "Package signature %s not found!" "${f}.sig"
 			exit 1
 		fi
 	done
@@ -415,8 +415,7 @@ check_splitpkgs() {
 		fi
 
 		local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo "${pkgname[@]}"))
-		printf '%s\n' in "${svnnames[@]}" >> "${repo}/${_pkgarch}/${_pkgbase}/svn"
-		done
+		printf '%s\n' "${svnnames[@]}" >> "${repo}/${_pkgarch}/${_pkgbase}/svn"
 	done
 	popd >/dev/null
 
@@ -489,12 +488,12 @@ set_repo_permission() {
 
 	if [ -w "${dbfile}" ]; then
 		local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")")
-		chgrp "$group" "${dbfile}"    || error "Could not change group of ${dbfile} to $group"
-		chgrp "$group" "${filesfile}" || error "Could not change group of ${filesfile} to $group"
-		chmod g+w "${dbfile}"    || error "Could not set write permission for group $group to ${dbfile}"
-		chmod g+w "${filesfile}" || error "Could not set write permission for group $group to ${filesfile}"
+		chgrp "$group" "${dbfile}"    || error "Could not change group of %s to %s" "${dbfile}"    "$group"
+		chgrp "$group" "${filesfile}" || error "Could not change group of %s to %s" "${filesfile}" "$group"
+		chmod g+w "${dbfile}"    || error "Could not set write permission for group %s to %s" "$group" "${dbfile}"
+		chmod g+w "${filesfile}" || error "Could not set write permission for group %s to %s" "$group" "${filesfile}"
 	else
-		error "You don't have permission to change ${dbfile}"
+		error "You don't have permission to change %s" "${dbfile}"
 	fi
 }
 
@@ -506,9 +505,9 @@ arch_repo_add() {
 	# package files might be relative to repo dir
 	pushd "${FTP_BASE}/${repo}/os/${arch}" >/dev/null
 	/usr/bin/repo-add -q "${repo}${DBEXT}" "${pkgs[@]}" \
-		|| error "repo-add ${repo}${DBEXT} ${pkgs[*]}"
+		|| error '%s' "repo-add ${repo}${DBEXT} ${pkgs[*]}"
 	/usr/bin/repo-add -f -q "${repo}${FILESEXT}" "${pkgs[@]}" \
-		|| error "repo-add -f ${repo}${FILESEXT} ${pkgs[*]}"
+		|| error '%s' "repo-add -f ${repo}${FILESEXT} ${pkgs[*]}"
 	popd >/dev/null
 	set_repo_permission "${repo}" "${arch}"
 
@@ -523,13 +522,13 @@ arch_repo_remove() {
 	local filesfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}"
 
 	if [ ! -f "${dbfile}" ]; then
-		error "No database found at '${dbfile}'"
+		error "No database found at '%s'" "${dbfile}"
 		return 1
 	fi
 	/usr/bin/repo-remove -q "${dbfile}" "${pkgs[@]}" \
-		|| error "repo-remove ${dbfile} ${pkgs[*]}"
+		|| error '%s' "repo-remove ${dbfile} ${pkgs[*]}"
 	/usr/bin/repo-remove -q "${filesfile}" "${pkgs[@]}" \
-		|| error "repo-remove ${filesfile} ${pkgs[*]}"
+		|| error '%s' "repo-remove ${filesfile} ${pkgs[*]}"
 	set_repo_permission "${repo}" "${arch}"
 
 	REPO_MODIFIED=1
diff --git a/db-move b/db-move
index 4828e75..cd67953 100755
--- a/db-move
+++ b/db-move
@@ -4,7 +4,7 @@
 . "$(dirname "$0")/db-functions"
 
 if [ $# -lt 3 ]; then
-	msg "usage: ${0##*/} <repo-from> <repo-to> <pkgname|pkgbase> ..."
+	msg "usage: %s <repo-from> <repo-to> <pkgname|pkgbase> ..." "${0##*/}"
 	exit 1
 fi
 
@@ -15,7 +15,7 @@ ftppath_from="${FTP_BASE}/${repo_from}/os/"
 ftppath_to="${FTP_BASE}/${repo_to}/os/"
 
 if ! check_repo_permission "$repo_to" || ! check_repo_permission "$repo_from"; then
-	die "You don't have permission to move packages from ${repo_from} to ${repo_to}"
+	die "You don't have permission to move packages from %s to %s" "${repo_from}" "${repo_to}"
 fi
 
 # TODO: this might lock too much (architectures)
@@ -55,10 +55,10 @@ for pkgbase in "${args[@]:2}"; do
 			continue 2
 		fi
 	done
-	die "${pkgbase} not found in ${repo_from}"
+	die "%s not found in %s" "${pkgbase}" "${repo_from}"
 done
 
-msg "Moving packages from [${repo_from}] to [${repo_to}]..."
+msg "Moving packages from [%s] to [%s]..." "${repo_from}" "${repo_to}"
 
 declare -A add_pkgs
 declare -A remove_pkgs
@@ -74,7 +74,7 @@ for pkgbase in "${args[@]:2}"; do
 			else
 				tarches=("${pkgarch}")
 			fi
-			msg2 "${pkgbase} (${tarches[*]})"
+			msg2 "%s (%s)" "${pkgbase}" "${tarches[*]}"
 			pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo "${pkgname[@]}"))
 			pkgver=$(. "${svnrepo_from}/PKGBUILD"; get_full_version "${epoch:-0}" "${pkgver}" "${pkgrel}")
 
diff --git a/db-remove b/db-remove
index f23cd9e..3bb67b0 100755
--- a/db-remove
+++ b/db-remove
@@ -4,7 +4,7 @@
 . "$(dirname "$0")/db-functions"
 
 if [ $# -lt 3 ]; then
-	msg "usage: ${0##*/} <repo> <arch> <pkgname|pkgbase> ..."
+	msg "usage: %s <repo> <arch> <pkgname|pkgbase> ..." "${0##*/}"
 	exit 1
 fi
 
@@ -16,7 +16,7 @@ ftppath="$FTP_BASE/$repo/os"
 svnrepo="$repo-$arch"
 
 if ! check_repo_permission "$repo"; then
-	die "You don't have permission to remove packages from ${repo}"
+	die "You don't have permission to remove packages from %s" "${repo}"
 fi
 
 if [ "$arch" == "any" ]; then
@@ -31,7 +31,7 @@ done
 
 remove_pkgs=()
 for pkgbase in "${pkgbases[@]}"; do
-	msg "Removing $pkgbase from [$repo]..."
+	msg "Removing %s from [%s]..." "$pkgbase" "$repo"
 	arch_svn checkout -q "${SVNREPO}/${pkgbase}" "${WORKDIR}/svn/${pkgbase}" >/dev/null
 
 	if [ -d "${WORKDIR}/svn/$pkgbase/repos/$svnrepo" ]; then
@@ -39,8 +39,8 @@ for pkgbase in "${pkgbases[@]}"; do
 		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 "$pkgbase not found in $svnrepo"
-		warning "Removing only $pkgbase from the repo"
+		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
 	fi
diff --git a/db-repo-add b/db-repo-add
index a53884e..09ce865 100755
--- a/db-repo-add
+++ b/db-repo-add
@@ -4,7 +4,7 @@
 . "$(dirname "$0")/db-functions"
 
 if [ $# -lt 3 ]; then
-	msg "usage: ${0##*/} <repo> <arch> <pkgfile> ..."
+	msg "usage: %s <repo> <arch> <pkgfile> ..." "${0##*/}"
 	exit 1
 fi
 
@@ -15,7 +15,7 @@ pkgfiles=("${@:3}")
 ftppath="$FTP_BASE/$repo/os"
 
 if ! check_repo_permission "$repo"; then
-	die "You don't have permission to add packages to ${repo}"
+	die "You don't have permission to add packages to %s" "${repo}"
 fi
 
 if [ "$arch" == "any" ]; then
@@ -31,9 +31,9 @@ done
 for tarch in "${tarches[@]}"; do
 	for pkgfile in "${pkgfiles[@]}"; do
 		if [[ ! -f "${FTP_BASE}/${repo}/os/${arch}/${pkgfile##*/}" ]]; then
-			die "Package file ${pkgfile##*/} not found in ${FTP_BASE}/${repo}/os/${arch}/"
+			die "Package file %s not found in %s" "${pkgfile##*/}" "${FTP_BASE}/${repo}/os/${arch}/"
 		else
-			msg "Adding $pkgfile to [$repo]..."
+			msg "Adding %s to [%s]..." "$pkgfile" "$repo"
 		fi
 	done
 	arch_repo_add "${repo}" "${tarch}" "${pkgfiles[@]}"
diff --git a/db-repo-remove b/db-repo-remove
index df746fb..97a671b 100755
--- a/db-repo-remove
+++ b/db-repo-remove
@@ -4,7 +4,7 @@
 . "$(dirname "$0")/db-functions"
 
 if [ $# -lt 3 ]; then
-	msg "usage: ${0##*/} <repo> <arch> <pkgname> ..."
+	msg "usage: %s <repo> <arch> <pkgname> ..." "${0##*/}"
 	exit 1
 fi
 
@@ -15,7 +15,7 @@ pkgnames=("${@:3}")
 ftppath="$FTP_BASE/$repo/os"
 
 if ! check_repo_permission "$repo"; then
-	die "You don't have permission to remove packages from ${repo}"
+	die "You don't have permission to remove packages from %s" "${repo}"
 fi
 
 if [ "$arch" == "any" ]; then
@@ -30,7 +30,7 @@ done
 
 for tarch in "${tarches[@]}"; do
 	for pkgname in "${pkgnames[@]}"; do
-		msg "Removing $pkgname from [$repo]..."
+		msg "Removing %s from [%s]..." "$pkgname" "$repo"
 	done
 	arch_repo_remove "${repo}" "${tarch}" "${pkgnames[@]}"
 	repo_unlock "$repo" "$tarch"
diff --git a/db-update b/db-update
index ec3c0f9..33dc551 100755
--- a/db-update
+++ b/db-update
@@ -4,14 +4,14 @@
 . "$(dirname "$0")/db-functions"
 
 if [ $# -ge 1 ]; then
-	warning "Calling ${0##*/} with a specific repository is no longer supported"
+	warning "Calling %s with a specific repository is no longer supported" "${0##*/}"
 	exit 1
 fi
 
 # Find repos with packages to release
 staging_repos=($(find  "${STAGING}" -mindepth 1 -type f -name "*${PKGEXT}" -printf '%h\n' | sort -u))
 if [ $? -ge 1 ]; then
-	die "Could not read ${STAGING}"
+	die "Could not read %s" "${STAGING}"
 fi
 
 repos=()
@@ -31,47 +31,47 @@ done
 # check if packages are valid
 for repo in "${repos[@]}"; do
 	if ! check_repo_permission "${repo}"; then
-		die "You don't have permission to update packages in ${repo}"
+		die "You don't have permission to update packages in %s" "${repo}"
 	fi
 	pkgs=($(getpkgfiles "${STAGING}/${repo}/"*${PKGEXT}))
 	if [ $? -eq 0 ]; then
 		for pkg in "${pkgs[@]}"; do
 			if [ -h "${pkg}" ]; then
-				die "Package ${repo}/${pkg##*/} is a symbolic link"
+				die "Package %s is a symbolic link" "${repo}/${pkg##*/}"
 			fi
 			if ! check_pkgfile "${pkg}"; then
-				die "Package ${repo}/${pkg##*/} is not consistent with its meta data"
+				die "Package %s is not consistent with its meta data" "${repo}/${pkg##*/}"
 			fi
 			if "${REQUIRE_SIGNATURE}" && ! pacman-key -v "${pkg}.sig" >/dev/null 2>&1; then
-				die "Package ${repo}/${pkg##*/} does not have a valid signature"
+				die "Package %s does not have a valid signature" "${repo}/${pkg##*/}"
 			fi
 			if ! check_pkgsvn "${pkg}" "${repo}"; then
-				die "Package ${repo}/${pkg##*/} is not consistent with svn repository"
+				die "Package %s is not consistent with svn repository" "${repo}/${pkg##*/}"
 			fi
 			if ! check_pkgrepos "${pkg}"; then
-				die "Package ${repo}/${pkg##*/} already exists in another repository"
+				die "Package %s already exists in another repository" "${repo}/${pkg##*/}"
 			fi
 			if ! check_packager "${pkg}"; then
 				die "Package ${repo}/${pkg##*/} does not have a valid packager"
 			fi
 		done
 		if ! check_splitpkgs "${repo}" "${pkgs[@]}"; then
-			die "Missing split packages for ${repo}"
+			die "Missing split packages for %s" "${repo}"
 		fi
 	else
-		die "Could not read ${STAGING}"
+		die "Could not read %s" "${STAGING}"
 	fi
 done
 
 for repo in "${repos[@]}"; do
-	msg "Updating [${repo}]..."
+	msg "Updating [%s]..." "${repo}"
 	any_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-any${PKGEXT} 2>/dev/null))
 	for pkgarch in "${ARCHES[@]}"; do
 		add_pkgs=()
 		arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-"${pkgarch}"${PKGEXT} 2>/dev/null))
 		for pkg in "${arch_pkgs[@]}" "${any_pkgs[@]}"; do
 			pkgfile="${pkg##*/}"
-			msg2 "${pkgfile} (${pkgarch})"
+			msg2 "%s (%s)" "${pkgfile}" "${pkgarch}"
 			# any packages might have been moved by the previous run
 			if [ -f "${pkg}" ]; then
 				mv "${pkg}" "$FTP_BASE/${PKGPOOL}"
diff --git a/testing2x b/testing2x
index 9ff2319..e269248 100755
--- a/testing2x
+++ b/testing2x
@@ -4,7 +4,7 @@
 . "$(dirname "$0")/db-functions"
 
 if [ $# -lt 1 ]; then
-	msg "usage: ${0##*/} <pkgname|pkgbase> ..."
+	msg "usage: %s <pkgname|pkgbase> ..." "${0##*/}"
 	exit 1
 fi
 
@@ -30,7 +30,7 @@ for pkgbase in "$@"; do
 				break
 			fi
 		done
-		"${found_source}" || die "${pkgbase} not found in [${TESTING_REPO}]"
+		"${found_source}" || die "%s not found in [%s]" "${pkgbase}" "${TESTING_REPO}"
 		found_target=false
 		for pkgarch in "${ARCHES[@]}" 'any'; do
 			for repo in "${STABLE_REPOS[@]}"; do
@@ -42,7 +42,7 @@ for pkgbase in "$@"; do
 				fi
 			done
 		done
-		"${found_target}" || die "${pkgbase} not found in any of these repos: ${STABLE_REPOS[*]}"
+		"${found_target}" || die "%s not found in any of these repos: " "${pkgbase}" "${STABLE_REPOS[*]}"
 	fi
 done
 
-- 
2.4.1


More information about the arch-projects mailing list