Avoid using string interpolation; use printf format strings instead.
This involves extending the signature of lib/common.sh's `stat_busy()`, `lock()`, and `slock()`. The `mesg=$1; shift` in stat_busy even suggests that this is what was originally intended from it.
This commit is contained in:
parent
14d5e1c21b
commit
cb35d74f8c
|
@ -33,7 +33,7 @@ while getopts 'hC:M:c:' arg; do
|
|||
M) makepkg_conf="$OPTARG" ;;
|
||||
c) cache_dir="$OPTARG" ;;
|
||||
h|?) usage ;;
|
||||
*) error "invalid argument '$arg'"; usage ;;
|
||||
*) error "invalid argument '%s'" "$arg"; usage ;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
|
|
@ -45,13 +45,13 @@ check_root
|
|||
makechrootpkg_args+=("${@:$OPTIND}")
|
||||
|
||||
if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
||||
msg "Creating chroot for [${repo}] (${arch})..."
|
||||
msg "Creating chroot for [%s] (%s)..." "${repo}" "${arch}"
|
||||
|
||||
for copy in "${chroots}/${repo}-${arch}"/*; do
|
||||
[[ -d $copy ]] || continue
|
||||
msg2 "Deleting chroot copy '$(basename "${copy}")'..."
|
||||
msg2 "Deleting chroot copy '%s'..." "$(basename "${copy}")"
|
||||
|
||||
lock 9 "$copy.lock" "Locking chroot copy '$copy'"
|
||||
lock 9 "$copy.lock" "Locking chroot copy '%s'" "$copy"
|
||||
|
||||
subvolume_delete_recursive "${copy}"
|
||||
rm -rf --one-file-system "${copy}"
|
||||
|
@ -74,5 +74,5 @@ else
|
|||
pacman -Syu --noconfirm || abort
|
||||
fi
|
||||
|
||||
msg "Building in chroot for [${repo}] (${arch})..."
|
||||
msg "Building in chroot for [%s] (%s)..." "${repo}" "${arch}"
|
||||
exec makechrootpkg -r "${chroots}/${repo}-${arch}" "${makechrootpkg_args[@]}"
|
||||
|
|
|
@ -6,7 +6,7 @@ m4_include(lib/common.sh)
|
|||
scriptname=${0##*/}
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo 'Usage: '$scriptname' <package name>...'
|
||||
printf 'Usage: %s <package name>...\n' "$scriptname"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ done
|
|||
known_files=("${known_files[@]/%/@}")
|
||||
|
||||
for tag in "$@"; do
|
||||
stat_busy "Copying ${trunk} to ${tag}"
|
||||
stat_busy "Copying %s to %s" "${trunk}" "${tag}"
|
||||
|
||||
if [[ -d repos/$tag ]]; then
|
||||
declare -a trash
|
||||
|
|
|
@ -70,8 +70,8 @@ for _pkgname in "${pkgname[@]}"; do
|
|||
msg "Sonames differ in $_pkgname!"
|
||||
echo "$diff_output"
|
||||
else
|
||||
msg "No soname differences for $_pkgname."
|
||||
msg "No soname differences for %s." "$_pkgname"
|
||||
fi
|
||||
done
|
||||
|
||||
msg "Files saved to $TEMPDIR"
|
||||
msg "Files saved to %s" "$TEMPDIR"
|
||||
|
|
|
@ -136,7 +136,7 @@ for _arch in ${arch[@]}; do
|
|||
fullver=$(get_full_version $_pkgname)
|
||||
|
||||
if ! pkgfile=$(find_cached_package "$_pkgname" "$fullver" "${_arch}"); then
|
||||
warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file"
|
||||
warning "Skipping %s: failed to locate package file" "$_pkgname-$fullver-$_arch"
|
||||
skip_arches+=($_arch)
|
||||
continue 2
|
||||
fi
|
||||
|
@ -144,7 +144,7 @@ for _arch in ${arch[@]}; do
|
|||
|
||||
sigfile="${pkgfile}.sig"
|
||||
if [[ ! -f $sigfile ]]; then
|
||||
msg "Signing package ${pkgfile}..."
|
||||
msg "Signing package %s..." "${pkgfile}"
|
||||
if [[ -n $GPGKEY ]]; then
|
||||
SIGNWITHKEY="-u ${GPGKEY}"
|
||||
fi
|
||||
|
@ -184,7 +184,7 @@ fi
|
|||
if [[ "${arch[*]}" == 'any' ]]; then
|
||||
if [[ -d ../repos/$repo-i686 && -d ../repos/$repo-x86_64 ]]; then
|
||||
pushd ../repos/ >/dev/null
|
||||
stat_busy "Removing $repo-i686 and $repo-x86_64"
|
||||
stat_busy "Removing %s and %s" "$repo-i686" "$repo-x86_64"
|
||||
svn rm -q $repo-i686
|
||||
svn rm -q $repo-x86_64
|
||||
svn commit -q -m "Removed $repo-i686 and $repo-x86_64 for $pkgname"
|
||||
|
@ -194,7 +194,7 @@ if [[ "${arch[*]}" == 'any' ]]; then
|
|||
else
|
||||
if [[ -d ../repos/$repo-any ]]; then
|
||||
pushd ../repos/ >/dev/null
|
||||
stat_busy "Removing $repo-any"
|
||||
stat_busy "Removing %s" "$repo-any"
|
||||
svn rm -q $repo-any
|
||||
svn commit -q -m "Removed $repo-any for $pkgname"
|
||||
stat_done
|
||||
|
|
|
@ -6,7 +6,7 @@ m4_include(lib/common.sh)
|
|||
scriptname=${0##*/}
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo 'Usage: '$scriptname' [pkgbase]'
|
||||
printf 'Usage: %s [pkgbase]\n' "$scriptname"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -40,13 +40,13 @@ setup_workdir
|
|||
|
||||
pushd $WORKDIR >/dev/null
|
||||
|
||||
msg "Downloading sources for ${pkgbase}"
|
||||
msg "Downloading sources for %s" "${pkgbase}"
|
||||
svn -q checkout -N "${target_svn}" target_checkout
|
||||
mkdir -p "target_checkout/${pkgbase}/repos"
|
||||
svn -q export "${source_svn}/${pkgbase}/trunk" "target_checkout/${pkgbase}/trunk" || die
|
||||
. "target_checkout/${pkgbase}/trunk/PKGBUILD"
|
||||
|
||||
msg "Downloading packages for ${pkgbase}"
|
||||
msg "Downloading packages for %s" "${pkgbase}"
|
||||
for _arch in ${arch[@]}; do
|
||||
if [[ "${_arch[*]}" == 'any' ]]; then
|
||||
repo_arch='x86_64'
|
||||
|
@ -60,7 +60,7 @@ for _arch in ${arch[@]}; do
|
|||
done
|
||||
done
|
||||
|
||||
msg "Adding ${pkgbase} to ${target_repo}"
|
||||
msg "Adding %s to %s" "${pkgbase}" "${target_repo}"
|
||||
svn -q add "target_checkout/${pkgbase}"
|
||||
svn -q propset svn:keywords 'Id' "target_checkout/${pkgbase}/trunk/PKGBUILD"
|
||||
svn -q commit -m"${scriptname}: Moving ${pkgbase} from ${source_repo} to ${target_repo}" target_checkout
|
||||
|
@ -70,7 +70,7 @@ popd >/dev/null
|
|||
|
||||
ssh "${server}" "${target_dbscripts}/db-update" || die
|
||||
|
||||
msg "Removing ${pkgbase} from ${source_repo}"
|
||||
msg "Removing %s from %s" "${pkgbase}" "${source_repo}"
|
||||
for _arch in ${arch[@]}; do
|
||||
ssh "${server}" "${source_dbscripts}/db-remove ${source_repo} ${_arch} ${pkgbase}"
|
||||
done
|
||||
|
|
4
lddd.in
4
lddd.in
|
@ -17,7 +17,7 @@ TEMPDIR=$(mktemp -d --tmpdir lddd-script.XXXX)
|
|||
msg 'Go out and drink some tea, this will take a while :) ...'
|
||||
# Check ELF binaries in the PATH and specified dir trees.
|
||||
for tree in $PATH $libdirs $extras; do
|
||||
msg2 "DIR $tree"
|
||||
msg2 "DIR %s" "$tree"
|
||||
|
||||
# Get list of files in tree.
|
||||
files=$(find $tree -type f ! -name '*.a' ! -name '*.la' ! -name '*.py*' ! -name '*.txt' ! -name '*.h' ! -name '*.ttf' ! \
|
||||
|
@ -46,4 +46,4 @@ done
|
|||
# clean list
|
||||
sort -u $TEMPDIR/pacman.txt >> $TEMPDIR/possible-rebuilds.txt
|
||||
|
||||
msg "Files saved to $TEMPDIR"
|
||||
msg "Files saved to %s" "$TEMPDIR"
|
||||
|
|
|
@ -56,7 +56,7 @@ error() {
|
|||
|
||||
stat_busy() {
|
||||
local mesg=$1; shift
|
||||
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" >&2
|
||||
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" "$@" >&2
|
||||
}
|
||||
|
||||
stat_done() {
|
||||
|
@ -142,7 +142,7 @@ get_full_version() {
|
|||
}
|
||||
|
||||
##
|
||||
# usage : lock( $fd, $file, $message )
|
||||
# usage : lock( $fd, $file, $message, [ $message_arguments... ] )
|
||||
##
|
||||
lock() {
|
||||
# Only reopen the FD if it wasn't handed to us
|
||||
|
@ -152,14 +152,14 @@ lock() {
|
|||
fi
|
||||
|
||||
if ! flock -n $1; then
|
||||
stat_busy "$3"
|
||||
stat_busy "${@:3}"
|
||||
flock $1
|
||||
stat_done
|
||||
fi
|
||||
}
|
||||
|
||||
##
|
||||
# usage : slock( $fd, $file, $message )
|
||||
# usage : slock( $fd, $file, $message, [ $message_arguments... ] )
|
||||
##
|
||||
slock() {
|
||||
# Only reopen the FD if it wasn't handed to us
|
||||
|
@ -169,7 +169,7 @@ slock() {
|
|||
fi
|
||||
|
||||
if ! flock -sn $1; then
|
||||
stat_busy "$3"
|
||||
stat_busy "${@:3}"
|
||||
flock -s $1
|
||||
stat_done
|
||||
fi
|
||||
|
|
|
@ -90,14 +90,14 @@ load_vars() {
|
|||
|
||||
create_chroot() {
|
||||
# Lock the chroot we want to use. We'll keep this lock until we exit.
|
||||
lock 9 "$copydir.lock" "Locking chroot copy [$copy]"
|
||||
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
|
||||
|
||||
if [[ ! -d $copydir ]] || $clean_first; then
|
||||
# Get a read lock on the root chroot to make
|
||||
# sure we don't clone a half-updated chroot
|
||||
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
|
||||
|
||||
stat_busy "Creating clean working copy [$copy]"
|
||||
stat_busy "Creating clean working copy [%s]" "$copy"
|
||||
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||
subvolume_delete_recursive "$copydir" ||
|
||||
die "Unable to delete subvolume %s" "$copydir"
|
||||
|
@ -118,7 +118,7 @@ create_chroot() {
|
|||
}
|
||||
|
||||
clean_temporary() {
|
||||
stat_busy "Removing temporary copy [$copy]"
|
||||
stat_busy "Removing temporary copy [%s]" "$copy"
|
||||
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||
btrfs subvolume delete "$copydir" >/dev/null ||
|
||||
die "Unable to delete subvolume %s" "$copydir"
|
||||
|
|
|
@ -31,7 +31,7 @@ while getopts 'hC:M:c:' arg; do
|
|||
M) makepkg_conf="$OPTARG" ;;
|
||||
c) cache_dir="$OPTARG" ;;
|
||||
h|?) usage ;;
|
||||
*) error "invalid argument '$arg'"; usage ;;
|
||||
*) error "invalid argument '%s'" "$arg"; usage ;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
m4_include(lib/common.sh)
|
||||
|
||||
if (( $# < 1 )); then
|
||||
echo "Usage: $(basename $0) <chrootdir> <packages to rebuild>"
|
||||
echo " example: $(basename $0) ~/chroot readline bash foo bar baz"
|
||||
printf 'Usage: %s <chrootdir> <packages to rebuild>\n' "$(basename "$0")"
|
||||
printf ' example: %s ~/chroot readline bash foo bar baz\n' "$(basename "$0")"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -51,7 +51,7 @@ pkgs="$@"
|
|||
|
||||
SVNPATH='svn+ssh://repos.archlinux.org/srv/repos/svn-packages/svn'
|
||||
|
||||
msg "Work will be done in $(pwd)/rebuilds"
|
||||
msg "Work will be done in %s" "$(pwd)/rebuilds"
|
||||
|
||||
REBUILD_ROOT="$(pwd)/rebuilds"
|
||||
mkdir -p "$REBUILD_ROOT"
|
||||
|
@ -63,11 +63,11 @@ FAILED=""
|
|||
for pkg in $pkgs; do
|
||||
cd "$REBUILD_ROOT/svn-packages"
|
||||
|
||||
msg2 "Building '$pkg'"
|
||||
msg2 "Building '%s'" "$pkg"
|
||||
/usr/bin/svn update "$pkg"
|
||||
if [[ ! -d "$pkg/trunk" ]]; then
|
||||
FAILED="$FAILED $pkg"
|
||||
warning "$pkg does not exist in SVN"
|
||||
warning "%s does not exist in SVN" "$pkg"
|
||||
continue
|
||||
fi
|
||||
cd "$pkg/trunk/"
|
||||
|
@ -76,14 +76,14 @@ for pkg in $pkgs; do
|
|||
|
||||
if ! sudo makechrootpkg -u -d -r "$chrootdir" -- --noconfirm; then
|
||||
FAILED="$FAILED $pkg"
|
||||
error "$pkg Failed!"
|
||||
error "%s Failed!" "$pkg"
|
||||
else
|
||||
pkgfile=$(pkg_from_pkgbuild)
|
||||
if [[ -e $pkgfile ]]; then
|
||||
msg2 "$pkg Complete"
|
||||
msg2 "%s Complete" "$pkg"
|
||||
else
|
||||
FAILED="$FAILED $pkg"
|
||||
error "$pkg Failed, no package built!"
|
||||
error "%s Failed, no package built!" "$pkg"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
@ -92,7 +92,7 @@ cd "$REBUILD_ROOT"
|
|||
if [[ -n $FAILED ]]; then
|
||||
msg 'Packages failed:'
|
||||
for pkg in $FAILED; do
|
||||
msg2 "$pkg"
|
||||
msg2 "%s" "$pkg"
|
||||
done
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue