summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-18 14:06:59 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-06-18 14:06:59 -0400
commit32786b02317f9018ae6e1b7aa069763e9496a834 (patch)
treede25210cbb95470239e20105f7225d0ffd1d7beb
parentcc3720b21451fbf73e0075b0955653fb37d1e106 (diff)
parent3abd3eaf4b3e6495d4603a8eb478e0f603ad51d9 (diff)
Merge branch 'master' into lukeshu/xbs
Conflicts: any-to-ours create-repo cron-jobs/ftpdir-cleanup cron-jobs/repo-sanity-check cron-jobs/sourceballs cron-jobs/sourceballs2 db-check-nonfree db-cleanup db-functions db-move db-remove db-sync db-update libremessages testing2x
-rwxr-xr-xany-to-ours21
-rwxr-xr-xcreate-repo11
-rwxr-xr-xcron-jobs/ftpdir-cleanup10
-rwxr-xr-xcron-jobs/repo-sanity-check2
-rwxr-xr-xcron-jobs/sourceballs4
-rwxr-xr-xcron-jobs/sourceballs24
-rwxr-xr-xdb-check-nonfree2
-rwxr-xr-xdb-cleanup4
-rwxr-xr-xdb-list-unsigned-packages2
-rwxr-xr-xdb-sync57
-rwxr-xr-xtesting2x34
11 files changed, 74 insertions, 77 deletions
diff --git a/any-to-ours b/any-to-ours
index 4ba01dc..8a4e874 100755
--- a/any-to-ours
+++ b/any-to-ours
@@ -21,8 +21,8 @@ trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
BASEARCH='x86_64'
# Traverse all Arch repos
-for _repo in ${ARCHREPOS[@]}; do
- msg "Processing ${_repo}..."
+for _repo in "${ARCHREPOS[@]}"; do
+ 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}..."
+ for _arch in "${OURARCHES[@]}"; do
+ msg2 "Syncing %s..." "${_arch}"
# Sync 'any' only and extract the synced packages
SYNCED=($(
@@ -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 ))
@@ -54,15 +54,14 @@ for _repo in ${ARCHREPOS[@]}; do
continue
fi
- msg2 "Synced ${#SYNCED[@]} packages: ${SYNCED[@]}"
+ msg2 "Synced %d packages: %s" "${#SYNCED[@]}" "${SYNCED[*]}"
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
diff --git a/create-repo b/create-repo
index cfdbc23..3feb098 100755
--- a/create-repo
+++ b/create-repo
@@ -5,20 +5,17 @@
. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -eq 0 ]; then
- msg "Usage: ${0##*/} repo1 [repo2 ... repoX]"
+ msg "Usage: %s repo1 [repo2 ... repoX]" "${0##*/}"
exit 1
fi
msg "Creating repos..."
for _repo in "$@"; do
- msg2 "Creating [${_repo}]"
- mkdir -p "${FTP_BASE}/staging/${_repo}" || \
- error "Failed creating staging dir"
-
+ msg2 "Creating [%s]" "${_repo}"
for _arch in "${ARCHES[@]}"; do
mkdir -p "${FTP_BASE}/${_repo}/os/${_arch}" || \
- error "Failed creating ${_arch} dir"
+ error "Failed creating %s dir" "${_arch}"
done
done
-msg "Don't forget to add them to the PKGREPOS array on %s/config" "$(dirname "$(readlink -e "$0")")"
+msg "Don't forget to add them to the PKGREPOS array on %s" "$(dirname "$(readlink -e "$0")")/config"
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index af56aac..560689a 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -46,15 +46,15 @@ for repo in "${PKGREPOS[@]}"; do
if [ ${#missing_pkgs[@]} -ge 1 ]; then
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/repo-sanity-check b/cron-jobs/repo-sanity-check
index fadb248..bd89240 100755
--- a/cron-jobs/repo-sanity-check
+++ b/cron-jobs/repo-sanity-check
@@ -6,7 +6,7 @@
# Traverse all repos
for _repo in "${PKGREPOS[@]}"; do
- msg "Cleaning up [${_repo}]"
+ msg "Cleaning up [%s]" "${_repo}"
# Find all pkgnames on this repo's abs
on_abs=($(
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 44492ef..c12a128 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -126,7 +126,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}"
@@ -138,7 +138,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/sourceballs2 b/cron-jobs/sourceballs2
index 02ed04c..e935f86 100755
--- a/cron-jobs/sourceballs2
+++ b/cron-jobs/sourceballs2
@@ -50,11 +50,11 @@ for repo in "${PKGREPOS[@]}"; do
echo "${srcfile}" >> "${WORKDIR}/expected-src-pkgs"
# Skip already sourceballed
- [[ -e "${SRCPKGDEST}/${srcfile}" ]] && continue
+ [ -e "${SRCPKGDEST}/${srcfile}" ] && continue
makepkg --allsource --ignorearch -c >/dev/null 2>&1
- [[ $? -ne 0 ]] && plain "${srcfile}"
+ [ $? -ne 0 ] && plain '%s' "${srcfile}"
done # end find pkgs
popd >/dev/null
diff --git a/db-check-nonfree b/db-check-nonfree
index bea0fa8..37b7cf6 100755
--- a/db-check-nonfree
+++ b/db-check-nonfree
@@ -3,7 +3,7 @@
. "$(dirname "$(readlink -e "$0")")/config"
. "$(dirname "$(readlink -e "$0")")/db-functions"
-if [[ $# -ge 1 ]]; then
+if [ $# -ge 1 ]; then
error "Calling %s with a specific repository is not supported" "${0##*/}"
exit 1
fi
diff --git a/db-cleanup b/db-cleanup
index 413ce06..54c1ba8 100755
--- a/db-cleanup
+++ b/db-cleanup
@@ -33,7 +33,7 @@ trap "rm -f -- $(printf %q "$filter")" EXIT
for _repo in "${PKGREPOS[@]}"; do
for _arch in "${ARCHES[@]}"; do
- msg "Getting %s database" "${_repo}-${_arch}"
+ msg "Getting %s-%s database" "${_repo}" "${_arch}"
dbfile="${FTP_BASE}/${_repo}/os/${_arch}/${_repo}${DBEXT}"
@@ -54,7 +54,7 @@ done
msg "Removing old files:"
for POOL in "${PKGPOOLS[@]}" "${SRCPOOLS[@]}"; do
- msg2 "${POOL}"
+ msg2 '%s' "${POOL}"
rsync "${EXTRAFLAGS[@]}" -va --delete-excluded \
--include-from="$filter" \
diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages
index c88203b..095e1e6 100755
--- a/db-list-unsigned-packages
+++ b/db-list-unsigned-packages
@@ -24,7 +24,7 @@ set -e
. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 1 ]; then
- msg "usage: ${0##*/} <architecture>"
+ msg "usage: %s <architecture>" "${0##*/}"
exit 1
fi
diff --git a/db-sync b/db-sync
index 8b74244..b26e917 100755
--- a/db-sync
+++ b/db-sync
@@ -16,7 +16,8 @@
# Run as `V=true db-sync` to get verbose output
VERBOSE=${V}
-${VERBOSE} && extra="-v"
+extra=()
+${VERBOSE} && extra+=(-v)
WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX")
trap "rm -rf -- $(printf '%q' "${WORKDIR}")" EXIT
@@ -24,19 +25,19 @@ trap "rm -rf -- $(printf '%q' "${WORKDIR}")" EXIT
# Returns contents of a repo
get_repos() {
# Exclude everything but db files
- rsync ${extra} --no-motd -mrtlH --no-p --include="*/" \
+ rsync "${extra[@]}" --no-motd -mrtlH --no-p --include="*/" \
--include="*.db" \
--include="*${DBEXT}" \
--include="*.files" \
--include="*${FILESEXT}" \
--exclude="*" \
--delete-after \
- rsync://${mirror}/${mirrorpath}/ "$WORKDIR"
+ "rsync://${mirror}/${mirrorpath}/" "$WORKDIR"
}
get_repo_content() {
# Return all contents
- bsdtar tf ${1} | \
+ bsdtar tf "${1}" | \
cut -d "/" -f 1 | \
sort -u
}
@@ -70,10 +71,10 @@ init() {
# Traverse all repo-arch pairs
for _repo in "${ARCHREPOS[@]}"; do
for _arch in "${ARCHARCHES[@]}"; do
- msg "Processing ${_repo}-${_arch}"
+ msg "Processing %s-%s" "${_repo}-${_arch}"
- db_file=$(get_repo_file ${_repo} ${_arch})${DBEXT}
- files_file=$(get_repo_file ${_repo} ${_arch})${FILESEXT}
+ db_file=$(get_repo_file "${_repo}" "${_arch}")${DBEXT}
+ files_file=$(get_repo_file "${_repo}" "${_arch}")${FILESEXT}
if [ ! -f "${db_file}" ]; then
warning "%s doesn't exist, skipping this repo-arch" "${db_file}"
@@ -93,7 +94,7 @@ init() {
LC_ALL=C repo-remove "${files_file}" "${blacklist[@]}" \
|& sed -n 's/-> Removing/ &/p'
# Get db contents
- db=($(get_repo_content ${db_file}))
+ db=($(get_repo_content "${db_file}"))
msg2 "Process clean db for syncing..."
@@ -103,30 +104,30 @@ init() {
# IMPORTANT: the . in the sed command is needed because an empty
# whitelist would consist of a single * allowing any package to
# pass through
- printf '%s\n' "${db[@]}" | sed "s|.$|&*|g" > /tmp/${_repo}-${_arch}.whitelist
+ printf '%s\n' "${db[@]}" | sed "s|.$|&*|g" > "/tmp/${_repo}-${_arch}.whitelist"
- msg2 "$(wc -l /tmp/${_repo}-${_arch}.whitelist | cut -d' ' -f1) packages in whitelist"
+ msg2 "%d packages in whitelist" "$(wc -l /tmp/${_repo}-${_arch}.whitelist | cut -d' ' -f1)"
# Sync excluding everything but whitelist
# We delete here for cleanup
- rsync ${extra} --no-motd -rtlH \
+ rsync "${extra[@]}" --no-motd -rtlH \
--delete-after \
--delete-excluded \
--delay-updates \
- --include-from=/tmp/${_repo}-${_arch}.whitelist \
+ --include-from="/tmp/${_repo}-${_arch}.whitelist" \
--exclude="*" \
- rsync://${mirror}/${mirrorpath}/${_repo}/os/${_arch}/ \
- ${FTP_BASE}/${_repo}/os/${_arch}/
+ "rsync://${mirror}/${mirrorpath}/${_repo}/os/${_arch}/" \
+ "${FTP_BASE}/${_repo}/os/${_arch}/"
# Add a new whitelist
whitelists+=(/tmp/${_repo}-${_arch}.whitelist)
msg "Putting databases back in place"
- rsync ${extra} --no-motd -rtlH \
+ rsync "${extra[@]}" --no-motd -rtlH \
--delay-updates \
--safe-links \
"${WORKDIR}/${_repo}/os/${_arch}/" \
- ${FTP_BASE}/${_repo}/os/${_arch}/
+ "${FTP_BASE}/${_repo}/os/${_arch}/"
# Cleanup
unset db
@@ -136,22 +137,22 @@ init() {
msg "Syncing package pool"
# Concatenate all whitelists, check for single *s just in case
- cat ${whitelists[@]} | grep -v "^\*$" | sort -u > /tmp/any.whitelist
+ cat "${whitelists[@]}" | grep -v "^\*$" | sort -u > /tmp/any.whitelist
- msg2 "Retrieving $(wc -l /tmp/any.whitelist | cut -d' ' -f1) packages from pool"
+ msg2 "Retrieving %d packages from pool" "$(wc -l /tmp/any.whitelist | cut -d' ' -f1)"
# Sync
# *Don't delete-after*, this is the job of cleanup scripts. It will remove our
# packages too
local pkgpool
- for pkgpool in ${ARCHPKGPOOLS[@]}; do
- rsync ${extra} --no-motd -rtlH \
+ for pkgpool in "${ARCHPKGPOOLS[@]}"; do
+ rsync "${extra[@]}" --no-motd -rtlH \
--delay-updates \
--safe-links \
--include-from=/tmp/any.whitelist \
--exclude="*" \
- rsync://${mirror}/${mirrorpath}/${pkgpool}/ \
- ${FTP_BASE}/${pkgpool}/
+ "rsync://${mirror}/${mirrorpath}/${pkgpool}/" \
+ "${FTP_BASE}/${pkgpool}/"
done
# Sync sources
@@ -163,14 +164,14 @@ init() {
# *Don't delete-after*, this is the job of cleanup scripts. It will remove our
# packages too
local srcpool
- for srcpool in ${ARCHSRCPOOLS[@]}; do
- rsync ${extra} --no-motd -rtlH \
+ for srcpool in "${ARCHSRCPOOLS[@]}"; do
+ rsync "${extra[@]}" --no-motd -rtlH \
--delay-updates \
--safe-links \
--include-from=/tmp/any.whitelist \
--exclude="*" \
- rsync://${mirror}/${mirrorpath}/${srcpool}/ \
- ${FTP_BASE}/${srcpool}/
+ "rsync://${mirror}/${mirrorpath}/${srcpool}/" \
+ "${FTP_BASE}/${srcpool}/"
done
# Cleanup
@@ -197,13 +198,13 @@ source "$(librelib messages)"
# Check variables presence
for var in DBEXT FILESEXT mirror mirrorpath WORKDIR BLACKLIST_FILE FTP_BASE ARCHSRCPOOLS ARCHPKGPOOLS; do
- test -z "${!var}" && fatal_error "Empty ${var}"
+ test -z "${!var}" && fatal_error "Empty %s" "${var}"
done
# From makepkg
set -E
for signal in TERM HUP QUIT; do
- trap "trap_exit $signal '%s signal caught. Exiting...' $signal" $signal
+ trap "trap_exit $signal '%s signal caught. Exiting...' $signal" "$signal"
done
trap 'trap_exit INT "Aborted by user! Exiting..."' INT
trap 'trap_exit USR1 "An unknown error has occurred. Exiting..."' ERR
diff --git a/testing2x b/testing2x
index 6646179..b76438b 100755
--- a/testing2x
+++ b/testing2x
@@ -4,35 +4,35 @@
. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 1 ]; then
- msg "usage: ${0##*/} <pkgname|pkgbase> ..."
+ msg "usage: %s <pkgname|pkgbase> ..." "${0##*/}"
exit 1
fi
# Lock everything to reduce possibility of interfering task between the different repo-updates
script_lock
-for repo in ${TESTING_REPO} ${STABLE_REPOS[@]}; do
- for pkgarch in ${ARCHES[@]}; do
- repo_lock ${repo} ${pkgarch} || exit 1
+for repo in "${TESTING_REPO}" "${STABLE_REPOS[@]}"; do
+ for pkgarch in "${ARCHES[@]}"; do
+ repo_lock "${repo}" "${pkgarch}" || exit 1
done
done
declare -A pkgs
-for pkgbase in $*; do
+for pkgbase in "$@"; do
if [ ! -d "${WORKDIR}/${pkgbase}" ]; then
found_source=false
- for pkgarch in ${ARCHES[@]} 'any'; do
- xbsrepo_from="$(xbs releasepath ${pkgbase} ${TESTING_REPO} ${pkgarch})"
+ for pkgarch in "${ARCHES[@]}" 'any'; do
+ xbsrepo_from="$(xbs releasepath "${pkgbase}" "${TESTING_REPO}" "${pkgarch}")"
if [ -r "${xbsrepo_from}/PKGBUILD" ]; then
found_source=true
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
- xbsrepo_to="$(xbs releasepath ${pkgbase} ${repo} ${pkgarch})"
+ for pkgarch in "${ARCHES[@]}" 'any'; do
+ for repo in "${STABLE_REPOS[@]}"; do
+ xbsrepo_to="$(xbs releasepath "${pkgbase}" "${repo}" "${pkgarch}")"
if [ -r "${xbsrepo_to}/PKGBUILD" ]; then
found_target=true
pkgs[${repo}]+="${pkgbase} "
@@ -40,16 +40,16 @@ 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: %s" "${pkgbase}" "${STABLE_REPOS[*]}"
fi
done
-for pkgarch in ${ARCHES[@]}; do
- repo_unlock ${TESTING_REPO} ${pkgarch}
+for pkgarch in "${ARCHES[@]}"; do
+ repo_unlock "${TESTING_REPO}" "${pkgarch}"
done
-for repo in ${STABLE_REPOS[@]}; do
- for pkgarch in ${ARCHES[@]}; do
- repo_unlock ${repo} ${pkgarch}
+for repo in "${STABLE_REPOS[@]}"; do
+ for pkgarch in "${ARCHES[@]}"; do
+ repo_unlock "${repo}" "${pkgarch}"
done
if [ -n "${pkgs[${repo}]}" ]; then
"$(dirname "$(readlink -e "$0")")/db-move" ${TESTING_REPO} "${repo}" ${pkgs[${repo}]}