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 ++++++++++++------------ create-repo | 18 +++--- cron-jobs/check_archlinux/parse_pkgbuilds.sh | 10 ++-- cron-jobs/devlist-mailer | 6 +- cron-jobs/repo-sanity-check | 88 ++++++++++++++-------------- cron-jobs/sourceballs2 | 48 +++++++-------- db-check-nonfree | 36 ++++++------ db-cleanup | 44 +++++++------- db-list-unsigned-packages | 4 +- libremessages | 4 +- mkrepo | 8 +-- 11 files changed, 172 insertions(+), 172 deletions(-) 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 diff --git a/create-repo b/create-repo index 1ec9798..cfdbc23 100755 --- a/create-repo +++ b/create-repo @@ -5,20 +5,20 @@ . "$(dirname "$(readlink -e "$0")")/db-functions" if [ $# -eq 0 ]; then - msg "Usage: ${0##*/} repo1 [repo2 ... repoX]" - exit 1 + msg "Usage: ${0##*/} repo1 [repo2 ... repoX]" + 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 [${_repo}]" + mkdir -p "${FTP_BASE}/staging/${_repo}" || \ + error "Failed creating staging dir" - for _arch in "${ARCHES[@]}"; do - mkdir -p "${FTP_BASE}/${_repo}/os/${_arch}" || \ - error "Failed creating ${_arch} dir" - done + for _arch in "${ARCHES[@]}"; do + mkdir -p "${FTP_BASE}/${_repo}/os/${_arch}" || \ + error "Failed creating ${_arch} dir" + done done msg "Don't forget to add them to the PKGREPOS array on %s/config" "$(dirname "$(readlink -e "$0")")" diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh index c8d8618..9b26f1e 100755 --- a/cron-jobs/check_archlinux/parse_pkgbuilds.sh +++ b/cron-jobs/check_archlinux/parse_pkgbuilds.sh @@ -118,11 +118,11 @@ source_pkgbuild() { } find_pkgbuilds() { - #Skip over some dirs - local d="${1##*/}" - if [ "$d" = "CVS" -o "$d" = ".svn" ]; then - return - fi + #Skip over some dirs + local d="${1##*/}" + if [ "$d" = "CVS" -o "$d" = ".svn" ]; then + return + fi if [ -f $1/PKGBUILD ]; then source_pkgbuild $1 diff --git a/cron-jobs/devlist-mailer b/cron-jobs/devlist-mailer index ca2e46b..32896f7 100755 --- a/cron-jobs/devlist-mailer +++ b/cron-jobs/devlist-mailer @@ -8,18 +8,18 @@ FROM="repomaint@archlinux.org" SUBJECT="Repository Maintenance $(date +"%d-%m-%Y")" if [ $# -ge 1 ]; then - SUBJECT="$1 $(date +"%d-%m-%Y")" + SUBJECT="$1 $(date +"%d-%m-%Y")" fi if [ $# -ge 2 ]; then - LIST="$2" + LIST="$2" fi stdin="$(cat)" #echo used to strip whitespace for checking for actual data if [ -n "$(echo $stdin)" ]; then -echo "Subject: $SUBJECT + echo "Subject: $SUBJECT To: $LIST From: $FROM diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 9d351df..f5f80c8 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -6,50 +6,50 @@ # Traverse all repos for _repo in "${PKGREPOS[@]}"; do - msg "Cleaning up [${_repo}]" - -# Find all pkgnames on this repo's abs - on_abs=($( - find ${SVNREPO}/${_repo} -name PKGBUILD | \ - while read pkgbuild; do - source ${pkgbuild} >/dev/null 2>&1 -# cleanup to save memory - unset build package source md5sums pkgdesc pkgver pkgrel epoch \ - url license arch depends makedepends optdepends options \ - >/dev/null 2>&1 - -# also cleanup package functions - for _pkg in "${pkgname[@]}"; do - unset package_${pkg} >/dev/null 2>&1 - done - -# this fills the on_abs array - echo ${pkgname[@]} - done - )) - -# quit if abs is empty - if [ ${#on_abs[*]} -eq 0 ]; then - warning "[${_repo}]'s ABS tree is empty, skipping" - break - fi - -# Find all pkgnames on repos - on_repo=($( - find ${FTP_BASE}/${_repo} -name "*.pkg.tar.?z" -printf "%f\n" | \ - sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" - )) - -# Compares them, whatever is on repos but not on abs should be removed - remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ - <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) - -# Remove them from databases, ftpdir-cleanup will take care of the rest - find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ - repo-remove {} ${remove[@]} >/dev/null 2>&1 \; - - msg2 "Removed the following packages:" - plain "$(echo ${remove[@]} | tr ' ' "\n")" + msg "Cleaning up [${_repo}]" + + # Find all pkgnames on this repo's abs + on_abs=($( + find ${SVNREPO}/${_repo} -name PKGBUILD | \ + while read pkgbuild; do + source ${pkgbuild} >/dev/null 2>&1 + # cleanup to save memory + unset build package source md5sums pkgdesc pkgver pkgrel epoch \ + url license arch depends makedepends optdepends options \ + >/dev/null 2>&1 + + # also cleanup package functions + for _pkg in "${pkgname[@]}"; do + unset package_${pkg} >/dev/null 2>&1 + done + + # this fills the on_abs array + echo ${pkgname[@]} + done + )) + + # quit if abs is empty + if [ ${#on_abs[*]} -eq 0 ]; then + warning "[${_repo}]'s ABS tree is empty, skipping" + break + fi + + # Find all pkgnames on repos + on_repo=($( + find ${FTP_BASE}/${_repo} -name "*.pkg.tar.?z" -printf "%f\n" | \ + sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" + )) + + # Compares them, whatever is on repos but not on abs should be removed + remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ + <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) + + # Remove them from databases, ftpdir-cleanup will take care of the rest + find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ + repo-remove {} ${remove[@]} >/dev/null 2>&1 \; + + msg2 "Removed the following packages:" + plain "$(echo ${remove[@]} | tr ' ' "\n")" done diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 2a26e6a..49a2dac 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -22,41 +22,41 @@ 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 [${repo}]" - pushd $repo >/dev/null - find -maxdepth 1 -type d | while read pkg; do - pushd "${SVNREPO}/$repo/$pkg" >/dev/null + 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" - continue - } + [[ ! -e PKGBUILD ]] && { + warning "$repo/$pkg is not a package" + continue + } -# Unset the previous data - unset pkgbase pkgname pkgver pkgrel - source PKGBUILD + # Unset the previous data + unset pkgbase pkgname pkgver pkgrel + source PKGBUILD - unset build package url pkgdesc source md5sums depends makedepends \ - optdepends license arch options check mksource + unset build package url pkgdesc source md5sums depends makedepends \ + optdepends license arch options check mksource - for _pkg in "${pkgname[@]}"; do - unset package_${_pkg} >/dev/null 2>&1 - done + for _pkg in "${pkgname[@]}"; do + unset package_${_pkg} >/dev/null 2>&1 + done - pkgbase=${pkgbase:-$pkgname} - srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" + pkgbase=${pkgbase:-$pkgname} + srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" echo "${srcfile}" >> "${WORKDIR}/expected-src-pkgs" - # Skip already sourceballed - [ -e "${SRCPKGDEST}/${srcfile}" ] && continue + # Skip already sourceballed + [ -e "${SRCPKGDEST}/${srcfile}" ] && continue - makepkg --allsource --ignorearch -c >/dev/null 2>&1 + makepkg --allsource --ignorearch -c >/dev/null 2>&1 - [ $? -ne 0 ] && plain ${srcfile} + [ $? -ne 0 ] && plain ${srcfile} - done # end find pkgs - popd >/dev/null + done # end find pkgs + popd >/dev/null done # end repos diff --git a/db-check-nonfree b/db-check-nonfree index 6e2dc17..b08b7b1 100755 --- a/db-check-nonfree +++ b/db-check-nonfree @@ -18,25 +18,25 @@ done 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" - if [ ! -f "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" ]; then - continue - fi - unset dbpkgs - unset cleanpkgs - cleanpkgs=() - dbpkgs=($(bsdtar -xOf "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" | awk '/^%NAME%/{getline;print}' | sort -u )) - for pkgname in "${dbpkgs[@]}"; do - if in_array "${pkgname}" "${nonfree[@]}"; then - cleanpkgs+=("${pkgname}") - fi + for pkgarch in "${ARCHES[@]}"; do + msg2 "$repo $pkgarch" + if [ ! -f "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" ]; then + continue + fi + unset dbpkgs + unset cleanpkgs + cleanpkgs=() + dbpkgs=($(bsdtar -xOf "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" | awk '/^%NAME%/{getline;print}' | sort -u )) + for pkgname in "${dbpkgs[@]}"; do + if in_array "${pkgname}" "${nonfree[@]}"; then + cleanpkgs+=("${pkgname}") + fi + done + if [ ${#cleanpkgs[@]} -ge 1 ]; then + msg2 "Nonfree: ${cleanpkgs[*]}" + arch_repo_remove "${repo}" "${pkgarch}" "${cleanpkgs[@]}" + fi done - if [ ${#cleanpkgs[@]} -ge 1 ]; then - msg2 "Nonfree: ${cleanpkgs[*]}" - arch_repo_remove "${repo}" "${pkgarch}" "${cleanpkgs[@]}" - fi - done done for repo in "${repos[@]}"; do diff --git a/db-cleanup b/db-cleanup index 57ef36e..a35bdf2 100755 --- a/db-cleanup +++ b/db-cleanup @@ -10,9 +10,9 @@ # * Instant cleanup! trap_exit() { - echo - error "$@" - exit 1 + echo + error "$@" + exit 1 } source "$(dirname "$(readlink -e "$0")")/config" @@ -28,35 +28,35 @@ trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR ${CLEANUP_DRYRUN} && EXTRAFLAGS+=" --dry-run" for _repo in ${PKGREPOS[@]}; do - for _arch in ${ARCHES[@]}; do - msg "Getting ${_repo}-${_arch} database" + for _arch in ${ARCHES[@]}; do + msg "Getting ${_repo}-${_arch} database" - dbfile="${FTP_BASE}/${_repo}/os/${_arch}/${_repo}${DBEXT}" + dbfile="${FTP_BASE}/${_repo}/os/${_arch}/${_repo}${DBEXT}" - if [ ! -r "${dbfile}" ]; then - warning "Not found" - continue - fi + if [ ! -r "${dbfile}" ]; then + warning "Not found" + continue + fi -# Echo the contents into a filter file - bsdtar tf "${dbfile}" | \ - cut -d'/' -f1 | \ - sort -u | \ - sed "s|$|*|" >> /tmp/${0##*/}.$$.filter + # Echo the contents into a filter file + bsdtar tf "${dbfile}" | \ + cut -d'/' -f1 | \ + sort -u | \ + sed "s|$|*|" >> /tmp/${0##*/}.$$.filter - done + done done msg "Removing old files:" for POOL in ${PKGPOOLS[@]} ${SRCPOOLS[@]}; do - msg2 "${POOL}" + msg2 "${POOL}" - rsync ${EXTRAFLAGS} -va --delete-excluded \ - --include-from="/tmp/${0##*/}.$$.filter" \ - --exclude="*" \ - ${FTP_BASE}/${POOL}/ \ - ${FTP_BASE}/${POOL}/ + rsync ${EXTRAFLAGS} -va --delete-excluded \ + --include-from="/tmp/${0##*/}.$$.filter" \ + --exclude="*" \ + ${FTP_BASE}/${POOL}/ \ + ${FTP_BASE}/${POOL}/ done msg "Removing symlinks:" diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index f593686..c88203b 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -33,6 +33,6 @@ shift for repo in "${PKGREPOS[@]}" do - db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" - [ -f "$db" ] && "$(dirname "$(readlink -e "$0")")/db-list-unsigned-packages.py" "$repo" "$@" < "$db" + db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" + [ -f "$db" ] && "$(dirname "$(readlink -e "$0")")/db-list-unsigned-packages.py" "$repo" "$@" < "$db" done diff --git a/libremessages b/libremessages index 0c6ded1..37df149 100755 --- a/libremessages +++ b/libremessages @@ -77,7 +77,7 @@ error() { fatal_error() { local mesg=$1; shift - error "$mesg" "$@" + error "$mesg" "$@" - exit 1 + exit 1 } diff --git a/mkrepo b/mkrepo index f30ad00..b11dc0b 100755 --- a/mkrepo +++ b/mkrepo @@ -6,10 +6,10 @@ source "$(dirname "$(readlink -e "$0")")/config" for repo in "$@"; do - echo ":: Creating [$repo]" - for arch in "${ARCHES[@]}"; do - mkdir -pv "${FTP_BASE}/${repo}/os/${arch}" - done + echo ":: Creating [$repo]" + for arch in "${ARCHES[@]}"; do + mkdir -pv "${FTP_BASE}/${repo}/os/${arch}" + done done echo ":: All done. Add the repo to the ParabolaWeb admin page." -- cgit v1.2.3-2-g168b From 46510e1fc48f37ce76c2bf5f19f885bba8d5d098 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 13:05:12 -0400 Subject: Clean up quoting. --- cron-jobs/check_archlinux/parse_pkgbuilds.sh | 36 +++++++------- cron-jobs/devlist-mailer | 2 +- cron-jobs/ftpdir-cleanup | 19 ++++--- cron-jobs/integrity-check | 4 +- cron-jobs/repo-sanity-check | 23 ++++----- cron-jobs/sourceballs | 18 +++---- cron-jobs/sourceballs2 | 8 +-- cron-jobs/update-abs-tarballs | 4 +- db-check-nonfree | 6 +-- db-cleanup | 21 ++++---- db-functions | 74 ++++++++++++++-------------- db-move | 32 ++++++------ db-remove | 8 +-- db-repo-add | 18 +++---- db-repo-remove | 18 +++---- db-sync | 56 ++++++++++----------- db-update | 6 +-- testing2x | 22 ++++----- 18 files changed, 187 insertions(+), 188 deletions(-) diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh index 9b26f1e..b857ac8 100755 --- a/cron-jobs/check_archlinux/parse_pkgbuilds.sh +++ b/cron-jobs/check_archlinux/parse_pkgbuilds.sh @@ -12,7 +12,7 @@ readonly -a variables splitpkg_overrides backup_package_variables() { for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done } @@ -20,9 +20,9 @@ restore_package_variables() { for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else - unset ${var} + unset "${var}" fi done } @@ -42,31 +42,31 @@ print_info() { if [ -n "$arch" ]; then echo "%ARCH%" - for i in "${arch[@]}"; do echo $i; done + for i in "${arch[@]}"; do echo "$i"; done echo "" fi if [ -n "$depends" ]; then echo "%DEPENDS%" for i in "${depends[@]}"; do - echo $i + echo "$i" done echo "" fi if [ -n "$makedepends" ]; then echo "%MAKEDEPENDS%" for i in "${makedepends[@]}"; do - echo $i + echo "$i" done echo "" fi if [ -n "$conflicts" ]; then echo "%CONFLICTS%" - for i in "${conflicts[@]}"; do echo $i; done + for i in "${conflicts[@]}"; do echo "$i"; done echo "" fi if [ -n "$provides" ]; then echo "%PROVIDES%" - for i in "${provides[@]}"; do echo $i; done + for i in "${provides[@]}"; do echo "$i"; done echo "" fi } @@ -76,9 +76,9 @@ source_pkgbuild() { dir=$1 pkgbuild=$dir/PKGBUILD for var in "${variables[@]}"; do - unset ${var} + unset "${var}" done - source $pkgbuild &>/dev/null || ret=$? + source "$pkgbuild" &>/dev/null || ret=$? # ensure $pkgname and $pkgver variables were found if [ $ret -ne 0 -o -z "$pkgname" -o -z "$pkgver" ]; then @@ -89,7 +89,7 @@ source_pkgbuild() { if [ "${#pkgname[@]}" -gt "1" ]; then pkgbase=${pkgbase:-${pkgname[0]}} for pkg in "${pkgname[@]}"; do - if [ "$(type -t package_${pkg})" != "function" ]; then + if [ "$(type -t "package_${pkg}")" != "function" ]; then echo -e "%INVALID%\n$pkgbuild\n" return 1 else @@ -104,7 +104,7 @@ source_pkgbuild() { break fi done - done < <(type package_${pkg}) + done < <(type "package_${pkg}") print_info restore_package_variables fi @@ -124,14 +124,14 @@ find_pkgbuilds() { return fi - if [ -f $1/PKGBUILD ]; then - source_pkgbuild $1 + if [ -f "$1/PKGBUILD" ]; then + source_pkgbuild "$1" return fi empty=1 - for dir in $1/*; do - if [ -d $dir ]; then - find_pkgbuilds $dir + for dir in "$1"/*; do + if [ -d "$dir" ]; then + find_pkgbuilds "$dir" unset empty fi done @@ -147,7 +147,7 @@ fi CARCH=$1 shift for dir in "$@"; do - find_pkgbuilds $dir + find_pkgbuilds "$dir" done exit 0 diff --git a/cron-jobs/devlist-mailer b/cron-jobs/devlist-mailer index 32896f7..1a05521 100755 --- a/cron-jobs/devlist-mailer +++ b/cron-jobs/devlist-mailer @@ -23,6 +23,6 @@ if [ -n "$(echo $stdin)" ]; then To: $LIST From: $FROM -$stdin" | /usr/sbin/sendmail -F$FROM "$LIST" +$stdin" | /usr/sbin/sendmail -F"$FROM" "$LIST" fi diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index f2d8b33..d5a277b 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -7,7 +7,7 @@ clean_pkg() { local pkg local target - if ! ${CLEANUP_DRYRUN}; then + if ! "${CLEANUP_DRYRUN}"; then for pkg in "$@"; do if [ -h "$pkg" ]; then rm -f "$pkg" "$pkg.sig" @@ -22,8 +22,7 @@ clean_pkg() { fi } - -${CLEANUP_DRYRUN} && warning 'dry run mode is active' +"${CLEANUP_DRYRUN}" && warning 'dry run mode is active' for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do @@ -38,7 +37,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})..." - for missing_pkg in ${missing_pkgs[@]}; do + for missing_pkg in "${missing_pkgs[@]}"; do msg2 "${missing_pkg}" done fi @@ -46,7 +45,7 @@ for repo in "${PKGREPOS[@]}"; do 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})..." - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" clean_pkg "${FTP_BASE}/${repo}/os/${arch}/${old_pkg}" done @@ -62,18 +61,18 @@ cat "${WORKDIR}/db-"* | sort -u > "${WORKDIR}/db" 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 + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" clean_pkg "$FTP_BASE/${PKGPOOL}/${old_pkg}" done fi -old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -name "*${PKGEXT}" -mtime +${CLEANUP_KEEP} -printf '%f\n')) +old_pkgs=($(find "${CLEANUP_DESTDIR}" -type f -name "*${PKGEXT}" -mtime +"${CLEANUP_KEEP}" -printf '%f\n')) if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old packages from the cleanup directory..." - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" - if ! ${CLEANUP_DRYRUN}; then + if ! "${CLEANUP_DRYRUN}"; then rm -f "${CLEANUP_DESTDIR}/${old_pkg}" rm -f "${CLEANUP_DESTDIR}/${old_pkg}.sig" fi @@ -82,7 +81,7 @@ fi for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${arch} + repo_unlock "${repo}" "${arch}" done done diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index 86a8f1d..33a4eb6 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -13,12 +13,12 @@ fi mailto=$1 check() { - ${dirname}/check_archlinux/check_packages.py \ + "${dirname}"/check_archlinux/check_packages.py \ --repos="${repos}" \ --abs-tree="/srv/abs/rsync/${arch},/srv/abs/rsync/any" \ --repo-dir="${FTP_BASE}" \ --arch="${arch}" \ - 2>&1 | ${dirname}/devlist-mailer "Integrity Check ${arch}: ${repos}" "${mailto}" + 2>&1 | "${dirname}"/devlist-mailer "Integrity Check ${arch}: ${repos}" "${mailto}" } repos='core,extra,community' diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index f5f80c8..105bac4 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -10,9 +10,9 @@ for _repo in "${PKGREPOS[@]}"; do # Find all pkgnames on this repo's abs on_abs=($( - find ${SVNREPO}/${_repo} -name PKGBUILD | \ + find "${SVNREPO}/${_repo}" -name PKGBUILD | \ while read pkgbuild; do - source ${pkgbuild} >/dev/null 2>&1 + source "${pkgbuild}" >/dev/null 2>&1 # cleanup to save memory unset build package source md5sums pkgdesc pkgver pkgrel epoch \ url license arch depends makedepends optdepends options \ @@ -20,11 +20,11 @@ for _repo in "${PKGREPOS[@]}"; do # also cleanup package functions for _pkg in "${pkgname[@]}"; do - unset package_${pkg} >/dev/null 2>&1 + unset "package_${pkg}" >/dev/null 2>&1 done # this fills the on_abs array - echo ${pkgname[@]} + echo "${pkgname[@]}" done )) @@ -36,20 +36,21 @@ for _repo in "${PKGREPOS[@]}"; do # Find all pkgnames on repos on_repo=($( - find ${FTP_BASE}/${_repo} -name "*.pkg.tar.?z" -printf "%f\n" | \ - sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" + find "${FTP_BASE}/${_repo}" -name "*.pkg.tar.?z" \ + -printf "%f\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" )) # Compares them, whatever is on repos but not on abs should be removed - remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ - <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) + remove=($(comm -13 \ + <(printf '%s\n' "${on_abs[@]}" | sort -u) \ + <(printf '%s\n' "${on_repo[@]}" | sort -u) )) # Remove them from databases, ftpdir-cleanup will take care of the rest - find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ - repo-remove {} ${remove[@]} >/dev/null 2>&1 \; + find "${FTP_BASE}/${_repo}" -name "*.db.tar.?z" -exec \ + repo-remove {} "${remove[@]}" >/dev/null 2>&1 \; msg2 "Removed the following packages:" - plain "$(echo ${remove[@]} | tr ' ' "\n")" + plain '%s' "${remove[@]}" done diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 8171980..9c07c22 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -9,7 +9,7 @@ script_lock for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_lock ${repo} ${arch} || exit 1 + repo_lock "${repo}" "${arch}" || exit 1 done done @@ -41,7 +41,7 @@ done for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${arch} + repo_unlock "${repo}" "${arch}" done done @@ -74,7 +74,7 @@ for repo in "${PKGREPOS[@]}"; do # Build the source package if its not already there if ! grep -Fqx "${pkgbase}-${pkgver}${SRCEXT}" "${WORKDIR}/available-src-pkgs"; then # Check if we had failed before - if in_array "${pkgbase}-${pkgver}${SRCEXT}" ${failedpkgs[@]}; then + if in_array "${pkgbase}-${pkgver}${SRCEXT}" "${failedpkgs[@]}"; then continue fi @@ -99,9 +99,9 @@ for repo in "${PKGREPOS[@]}"; do mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}" # Avoid creating the same source package for every arch echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" - newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" + newpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") else - failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" + failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") fi popd >/dev/null fi @@ -128,22 +128,22 @@ old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-s if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old source packages..." - ${SOURCE_CLEANUP_DRYRUN} && warning 'dry run mode is active' + "${SOURCE_CLEANUP_DRYRUN}" && warning 'dry run mode is active' for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" - if ! ${SOURCE_CLEANUP_DRYRUN}; then + if ! "${SOURCE_CLEANUP_DRYRUN}"; then mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" fi done fi -old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n')) +old_pkgs=($(find "${SOURCE_CLEANUP_DESTDIR}" -type f -name "*${SRCEXT}" -mtime +"${SOURCE_CLEANUP_KEEP}" -printf '%f\n')) 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}" - ${SOURCE_CLEANUP_DRYRUN} || rm -f "${SOURCE_CLEANUP_DESTDIR}/${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 49a2dac..f7b3779 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -24,11 +24,11 @@ pushd "${SVNREPO}" >/dev/null for repo in "${PKGREPOS[@]}"; do msg "Sourceballing [${repo}]" - pushd $repo >/dev/null + pushd "$repo" >/dev/null find -maxdepth 1 -type d | while read pkg; do pushd "${SVNREPO}/$repo/$pkg" >/dev/null - [[ ! -e PKGBUILD ]] && { + [[ ! -e ./PKGBUILD ]] && { warning "$repo/$pkg is not a package" continue } @@ -41,7 +41,7 @@ for repo in "${PKGREPOS[@]}"; do optdepends license arch options check mksource for _pkg in "${pkgname[@]}"; do - unset package_${_pkg} >/dev/null 2>&1 + unset "package_${_pkg}" >/dev/null 2>&1 done pkgbase=${pkgbase:-$pkgname} @@ -54,7 +54,7 @@ for repo in "${PKGREPOS[@]}"; do 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/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs index 901cc4b..e710f7c 100755 --- a/cron-jobs/update-abs-tarballs +++ b/cron-jobs/update-abs-tarballs @@ -2,6 +2,4 @@ . "$(dirname "$(readlink -e "$0")")/../config" -rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ ${FTP_BASE}/ - -exit $? +rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ "${FTP_BASE}/" diff --git a/db-check-nonfree b/db-check-nonfree index b08b7b1..cae4a14 100755 --- a/db-check-nonfree +++ b/db-check-nonfree @@ -11,12 +11,12 @@ fi # TODO: this might lock too much (architectures) for repo in "${repos[@]}"; do for pkgarch in "${ARCHES[@]}"; do - repo_lock ${repo} ${pkgarch} || exit 1 + repo_lock "${repo}" "${pkgarch}" || exit 1 done done msg "Check nonfree in repo:" -nonfree=($(cut -d: -f1 ${BLACKLIST_FILE} | sort -u)) +nonfree=($(cut -d: -f1 "${BLACKLIST_FILE}" | sort -u)) for repo in "${ARCHREPOS[@]}"; do for pkgarch in "${ARCHES[@]}"; do msg2 "$repo $pkgarch" @@ -41,6 +41,6 @@ done for repo in "${repos[@]}"; do for pkgarch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${pkgarch} + repo_unlock "${repo}" "${pkgarch}" done done diff --git a/db-cleanup b/db-cleanup index a35bdf2..b2f2e08 100755 --- a/db-cleanup +++ b/db-cleanup @@ -25,10 +25,11 @@ trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR -${CLEANUP_DRYRUN} && EXTRAFLAGS+=" --dry-run" +EXTRAFLAGS=() +"${CLEANUP_DRYRUN}" && EXTRAFLAGS+=(--dry-run) -for _repo in ${PKGREPOS[@]}; do - for _arch in ${ARCHES[@]}; do +for _repo in "${PKGREPOS[@]}"; do + for _arch in "${ARCHES[@]}"; do msg "Getting ${_repo}-${_arch} database" dbfile="${FTP_BASE}/${_repo}/os/${_arch}/${_repo}${DBEXT}" @@ -42,25 +43,25 @@ for _repo in ${PKGREPOS[@]}; do bsdtar tf "${dbfile}" | \ cut -d'/' -f1 | \ sort -u | \ - sed "s|$|*|" >> /tmp/${0##*/}.$$.filter + sed "s|$|*|" >> "/tmp/${0##*/}.$$.filter" done done msg "Removing old files:" -for POOL in ${PKGPOOLS[@]} ${SRCPOOLS[@]}; do +for POOL in "${PKGPOOLS[@]}" "${SRCPOOLS[@]}"; do msg2 "${POOL}" - rsync ${EXTRAFLAGS} -va --delete-excluded \ + rsync "${EXTRAFLAGS[@]}" -va --delete-excluded \ --include-from="/tmp/${0##*/}.$$.filter" \ --exclude="*" \ - ${FTP_BASE}/${POOL}/ \ - ${FTP_BASE}/${POOL}/ + "${FTP_BASE}/${POOL}/" \ + "${FTP_BASE}/${POOL}/" done msg "Removing symlinks:" -find -L ${FTP_BASE}/ -type l -${CLEANUP_DRYRUN} || find -L ${FTP_BASE}/ -type l -delete +find -L "${FTP_BASE}/" -type l +"${CLEANUP_DRYRUN}" || find -L "${FTP_BASE}/" -type l -delete exit $? diff --git a/db-functions b/db-functions index 6b49e6a..1384080 100644 --- a/db-functions +++ b/db-functions @@ -12,7 +12,7 @@ set_umask () { } restore_umask () { - umask $UMASK >/dev/null + umask "$UMASK" >/dev/null } # just like mv -f, but we touch the file and then copy the content so @@ -75,7 +75,7 @@ in_array() { [[ -z $1 ]] && return 1 # Not Found local item for item in "$@"; do - [[ $item = $needle ]] && return 0 # Found + [[ $item = "$needle" ]] && return 0 # Found done return 1 # Not Found } @@ -87,16 +87,16 @@ in_array() { get_full_version() { if [[ $1 -eq 0 ]]; then # zero epoch case, don't include it in version - echo $2-$3 + echo "$2-$3" else - echo $1:$2-$3 + echo "$1:$2-$3" fi } script_lock() { local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}" if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then - local _owner="$(/usr/bin/stat -c %U $LOCKDIR)" + local _owner="$(/usr/bin/stat -c %U "$LOCKDIR")" error "Script ${0##*/} is already locked by $_owner." exit 1 else @@ -129,7 +129,7 @@ cleanup() { arch=${l#*.} if [ -d "$TMPDIR/.repolock.$repo.$arch" ]; then msg "Removing left over lock from [${repo}] (${arch})" - repo_unlock $repo $arch + repo_unlock "$repo" "$arch" fi done if [ -d "$TMPDIR/.scriptlock.${0##*/}" ]; then @@ -137,7 +137,7 @@ cleanup() { script_unlock fi rm -rf "$WORKDIR" - [ "$1" ] && exit $1 + [ "$1" ] && exit "$1" } abort() { @@ -167,11 +167,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 [${1}] (${2}) is already locked by repo-{add,remove} process $(cat "$DBLOCKFILE")" return 1 fi if [ -f "${FILESLOCKFILE}" ]; then - error "Repo [${1}] (${2}) is already locked by repo-{add,remove} process $(cat ${FILESLOCKFILE})" + error "Repo [${1}] (${2}) is already locked by repo-{add,remove} process $(cat "$FILESLOCKFILE")" return 1 fi @@ -185,17 +185,17 @@ repo_lock () { fi _count=0 - while [ $_count -le $_trial ] || $_lockblock ; do + while [ "$_count" -le "$_trial" ] || "$_lockblock" ; do if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then - _owner="$(/usr/bin/stat -c %U $LOCKDIR)" + _owner="$(/usr/bin/stat -c %U "$LOCKDIR")" warning "Repo [${1}] (${2}) is already locked by $_owner. " msg2 "Retrying in $LOCK_DELAY seconds..." else - LOCKS[${#LOCKS[*]}]="$1.$2" + LOCKS+=("$1.$2") set_umask return 0 fi - sleep $LOCK_DELAY + sleep "$LOCK_DELAY" let _count=$_count+1 done @@ -293,7 +293,7 @@ getpkgfile() { elif [ ! -f "${1}" ]; then error "Package ${1} not found!" exit 1 - elif ${REQUIRE_SIGNATURE} && [ ! -f "${1}.sig" ]; then + elif "${REQUIRE_SIGNATURE}" && [ ! -f "${1}.sig" ]; then error "Package signature ${1}.sig not found!" exit 1 fi @@ -303,7 +303,7 @@ getpkgfile() { getpkgfiles() { local f - if [ ! -z "$(echo ${@%\.*} | sed "s/ /\n/g" | sort | uniq -D)" ]; then + if [ ! -z "$(printf '%s\n' "${@%\.*}" | sort | uniq -D)" ]; then error 'Duplicate packages found!' exit 1 fi @@ -312,7 +312,7 @@ getpkgfiles() { if [ ! -f "${f}" ]; then error "Package ${f} not found!" exit 1 - elif ${REQUIRE_SIGNATURE} && [ ! -f "${f}.sig" ]; then + elif "${REQUIRE_SIGNATURE}" && [ ! -f "${f}.sig" ]; then error "Package signature ${f}.sig not found!" exit 1 fi @@ -324,11 +324,11 @@ getpkgfiles() { check_pkgfile() { local pkgfile=$1 - local pkgname="$(getpkgname ${pkgfile})" + local pkgname="$(getpkgname "${pkgfile}")" [ $? -ge 1 ] && return 1 - local pkgver="$(getpkgver ${pkgfile})" + local pkgver="$(getpkgver "${pkgfile}")" [ $? -ge 1 ] && return 1 - local pkgarch="$(getpkgarch ${pkgfile})" + local pkgarch="$(getpkgarch "${pkgfile}")" [ $? -ge 1 ] && return 1 in_array "${pkgarch}" "${ARCHES[@]}" 'any' || return 1 @@ -342,13 +342,13 @@ check_pkgfile() { check_pkgsvn() { local pkgfile="${1}" - local _pkgbase="$(getpkgbase ${pkgfile})" + local _pkgbase="$(getpkgbase "${pkgfile}")" [ $? -ge 1 ] && return 1 - local _pkgname="$(getpkgname ${pkgfile})" + local _pkgname="$(getpkgname "${pkgfile}")" [ $? -ge 1 ] && return 1 - local _pkgver="$(getpkgver ${pkgfile})" + local _pkgver="$(getpkgver "${pkgfile}")" [ $? -ge 1 ] && return 1 - local _pkgarch="$(getpkgarch ${pkgfile})" + local _pkgarch="$(getpkgarch "${pkgfile}")" [ $? -ge 1 ] && return 1 local repo="${2}" @@ -361,10 +361,10 @@ check_pkgsvn() { [ $? -ge 1 ] && return 1 fi - local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) )" + local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; get_full_version "${epoch:-0}" "${pkgver}" "${pkgrel}")" [ "${svnver}" == "${_pkgver}" ] || return 1 - local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]})) + local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo "${pkgname[@]}")) in_array "${_pkgname}" "${svnnames[@]}" || return 1 return 0 @@ -383,19 +383,19 @@ check_splitpkgs() { for pkgfile in "${pkgfiles[@]}"; do issplitpkg "${pkgfile}" || continue - local _pkgbase="$(getpkgbase ${pkgfile})" + local _pkgbase="$(getpkgbase "${pkgfile}")" msg2 "Checking $_pkgbase" - local _pkgname="$(getpkgname ${pkgfile})" - local _pkgarch="$(getpkgarch ${pkgfile})" + local _pkgname="$(getpkgname "${pkgfile}")" + local _pkgarch="$(getpkgarch "${pkgfile}")" mkdir -p "${repo}/${_pkgarch}/${_pkgbase}" echo "${_pkgname}" >> "${repo}/${_pkgarch}/${_pkgbase}/staging" if [ ! -f "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" ]; then mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}" - cp -r ${SVNREPO}/$repo/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \ - cp -r ${SVNREPO}/libre/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \ - cp -r ${SVNREPO}/libre-testing/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/$_pkgbase">/dev/null 2>&1 + cp -r "${SVNREPO}/$repo/$_pkgbase/PKGBUILD" "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \ + cp -r "${SVNREPO}/libre/$_pkgbase/PKGBUILD" "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \ + cp -r "${SVNREPO}/libre-testing/$_pkgbase/PKGBUILD" "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/$_pkgbase">/dev/null 2>&1 [[ $? -ge 1 ]] && { echo "Failed $_pkgbase-$_pkgver-$_pkgarch" @@ -403,7 +403,7 @@ check_splitpkgs() { } fi - local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]})) + local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo "${pkgname[@]}")) for svnname in "${svnnames[@]}"; do echo "${svnname}" >> "${repo}/${_pkgarch}/${_pkgbase}/svn" done @@ -475,8 +475,8 @@ check_repo_permission() { for arch in ${ARCHES}; do local dir="${FTP_BASE}/${repo}/os/${arch}/" [ -w "${dir}" ] || return 1 - [ -f "${dir}"${repo}${DBEXT} -a ! -w "${dir}"${repo}${DBEXT} ] && return 1 - [ -f "${dir}"${repo}${FILESEXT} -a ! -w "${dir}"${repo}${FILESEXT} ] && return 1 + [ -f "${dir}${repo}"${DBEXT} -a ! -w "${dir}${repo}"${DBEXT} ] && return 1 + [ -f "${dir}${repo}"${FILESEXT} -a ! -w "${dir}${repo}"${FILESEXT} ] && return 1 done return 0 @@ -490,9 +490,9 @@ 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}" + 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}" else error "You don't have permission to change ${dbfile}" diff --git a/db-move b/db-move index f1c3dea..53543bc 100755 --- a/db-move +++ b/db-move @@ -14,14 +14,14 @@ repo_to="${args[1]}" 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 +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}" fi # TODO: this might lock too much (architectures) for pkgarch in "${ARCHES[@]}"; do - repo_lock ${repo_to} ${pkgarch} || exit 1 - repo_lock ${repo_from} ${pkgarch} || exit 1 + repo_lock "${repo_to}" "${pkgarch}" || exit 1 + repo_lock "${repo_from}" "${pkgarch}" || exit 1 done # First loop is to check that all necessary files exist @@ -29,12 +29,12 @@ for pkgbase in "${args[@]:2}"; do for pkgarch in "${ARCHES[@]}" 'any'; do svnrepo_from="${SVNREPO}/${repo_from}/${pkgbase}" if [ -r "${svnrepo_from}/PKGBUILD" ]; then - pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]})) + pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo "${pkgname[@]}")) if [ ${#pkgnames[@]} -lt 1 ]; then die "Could not read pkgname" fi - pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel})) + pkgver=$(. "${svnrepo_from}/PKGBUILD"; get_full_version "${epoch:-0}" "${pkgver}" "${pkgrel}") if [ -z "${pkgver}" ]; then die "Could not read pkgver" fi @@ -47,7 +47,7 @@ for pkgbase in "${args[@]:2}"; do for pkgname in "${pkgnames[@]}"; do for tarch in "${tarches[@]}"; do - getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT} >/dev/null + getpkgfile "${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} >/dev/null done done continue 2 @@ -71,22 +71,22 @@ for pkgbase in "${args[@]:2}"; do tarches=("${pkgarch}") fi msg2 "${pkgbase} (${tarches[*]})" - pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]})) - pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel})) + pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo "${pkgname[@]}")) + pkgver=$(. "${svnrepo_from}/PKGBUILD"; get_full_version "${epoch:-0}" "${pkgver}" "${pkgrel}") for pkgname in "${pkgnames[@]}"; do for tarch in "${tarches[@]}"; do - pkgpath=$(getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT}) + pkgpath=$(getpkgfile "${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}) pkgfile="${pkgpath##*/}" # copy package to pool if needed # TODO: can be removed once every package has been moved to the package pool - if [ ! -f ${FTP_BASE}/${PKGPOOL}/${pkgfile} ]; then - cp ${pkgpath} ${FTP_BASE}/${PKGPOOL} + if [ ! -f "${FTP_BASE}/${PKGPOOL}/${pkgfile}" ]; then + cp "${pkgpath}" "${FTP_BASE}/${PKGPOOL}" fi - ln -s "../../../${PKGPOOL}/${pkgfile}" ${ftppath_to}/${tarch}/ - if [ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile}.sig ]; then - ln -s "../../../${PKGPOOL}/${pkgfile}.sig" ${ftppath_to}/${tarch}/ + ln -s "../../../${PKGPOOL}/${pkgfile}" "${ftppath_to}/${tarch}/" + if [ -f "${FTP_BASE}/${PKGPOOL}/${pkgfile}.sig" ]; then + ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "${ftppath_to}/${tarch}/" fi add_pkgs[${tarch}]+="${FTP_BASE}/${PKGPOOL}/${pkgfile} " remove_pkgs[${tarch}]+="${pkgname} " @@ -104,6 +104,6 @@ for tarch in "${ARCHES[@]}"; do done for pkgarch in "${ARCHES[@]}"; do - repo_unlock ${repo_from} ${pkgarch} - repo_unlock ${repo_to} ${pkgarch} + repo_unlock "${repo_from}" "${pkgarch}" + repo_unlock "${repo_to}" "${pkgarch}" done diff --git a/db-remove b/db-remove index 46585ad..b0ed9bd 100755 --- a/db-remove +++ b/db-remove @@ -12,7 +12,7 @@ repo="$1" arch="$2" pkgbases=("${@:3}") -if ! check_repo_permission $repo; then +if ! check_repo_permission "$repo"; then die "You don't have permission to remove packages from ${repo}" fi @@ -23,7 +23,7 @@ else fi for tarch in "${tarches[@]}"; do - repo_lock $repo $tarch || exit 1 + repo_lock "$repo" "$tarch" || exit 1 done remove_pkgs=() @@ -31,7 +31,7 @@ for pkgbase in "${pkgbases[@]}"; do msg "Removing $pkgbase from [$repo]..." if [ -d "${SVNREPO}/$repo/$pkgbase" ]; then - remove_pkgs=($(. "${SVNREPO}/$repo/$pkgbase/PKGBUILD"; echo ${pkgname[@]})) + remove_pkgs=($(. "${SVNREPO}/$repo/$pkgbase/PKGBUILD"; echo "${pkgname[@]}")) else warning "$pkgbase not found in ABS(libre)" warning "Removing only $pkgbase from the repo" @@ -42,5 +42,5 @@ done for tarch in "${tarches[@]}"; do arch_repo_remove "${repo}" "${tarch}" "${remove_pkgs[@]}" - repo_unlock $repo $tarch + repo_unlock "$repo" "$tarch" done diff --git a/db-repo-add b/db-repo-add index a6355a1..92be22e 100755 --- a/db-repo-add +++ b/db-repo-add @@ -10,32 +10,32 @@ fi repo="$1" arch="$2" -pkgfiles=(${@:3}) +pkgfiles=("${@:3}") ftppath="$FTP_BASE/$repo/os" -if ! check_repo_permission $repo; then +if ! check_repo_permission "$repo"; then die "You don't have permission to add packages to ${repo}" fi if [ "$arch" == "any" ]; then - tarches=(${ARCHES[@]}) + tarches=("${ARCHES[@]}") else tarches=("$arch") fi -for tarch in ${tarches[@]}; do - repo_lock $repo $tarch || exit 1 +for tarch in "${tarches[@]}"; do + repo_lock "$repo" "$tarch" || exit 1 done -for tarch in ${tarches[@]}; do - for pkgfile in ${pkgfiles[@]}; do +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}/" else msg "Adding $pkgfile to [$repo]..." fi done - arch_repo_add "${repo}" "${tarch}" ${pkgfiles[@]} - repo_unlock $repo $tarch + arch_repo_add "${repo}" "${tarch}" "${pkgfiles[@]}" + repo_unlock "$repo" "$tarch" done diff --git a/db-repo-remove b/db-repo-remove index 7077d62..487abd8 100755 --- a/db-repo-remove +++ b/db-repo-remove @@ -10,28 +10,28 @@ fi repo="$1" arch="$2" -pkgnames=(${@:3}) +pkgnames=("${@:3}") ftppath="$FTP_BASE/$repo/os" -if ! check_repo_permission $repo; then +if ! check_repo_permission "$repo"; then die "You don't have permission to remove packages from ${repo}" fi if [ "$arch" == "any" ]; then - tarches=(${ARCHES[@]}) + tarches=("${ARCHES[@]}") else tarches=("$arch") fi -for tarch in ${tarches[@]}; do - repo_lock $repo $tarch || exit 1 +for tarch in "${tarches[@]}"; do + repo_lock "$repo" "$tarch" || exit 1 done -for tarch in ${tarches[@]}; do - for pkgname in ${pkgnames[@]}; do +for tarch in "${tarches[@]}"; do + for pkgname in "${pkgnames[@]}"; do msg "Removing $pkgname from [$repo]..." done - arch_repo_remove "${repo}" "${tarch}" ${pkgnames[@]} - repo_unlock $repo $tarch + arch_repo_remove "${repo}" "${tarch}" "${pkgnames[@]}" + repo_unlock "$repo" "$tarch" done diff --git a/db-sync b/db-sync index 138328b..9b90219 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 } @@ -68,12 +69,12 @@ init() { get_repos # Traverse all repo-arch pairs - for _repo in ${ARCHREPOS[@]}; do - for _arch in ${ARCHARCHES[@]}; do + for _repo in "${ARCHREPOS[@]}"; do + for _arch in "${ARCHARCHES[@]}"; do msg "Processing ${_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" # 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}/ + "${WORKDIR}/${_repo}/os/${_arch}/" \ + "${FTP_BASE}/${_repo}/os/${_arch}/" # Cleanup unset db @@ -136,7 +137,7 @@ 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" @@ -144,14 +145,14 @@ init() { # *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 @@ -191,14 +192,13 @@ source "$(dirname "$(readlink -e "$0")")/libremessages" # 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}" 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/db-update b/db-update index 186ed55..18162db 100755 --- a/db-update +++ b/db-update @@ -19,7 +19,7 @@ fi # TODO: this might lock too much (architectures) for repo in "${repos[@]}"; do for pkgarch in "${ARCHES[@]}"; do - repo_lock ${repo} ${pkgarch} || exit 1 + repo_lock "${repo}" "${pkgarch}" || exit 1 done done @@ -55,7 +55,7 @@ for repo in "${repos[@]}"; do 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)) + arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-"${pkgarch}"${PKGEXT} 2>/dev/null)) for pkg in "${arch_pkgs[@]}" "${any_pkgs[@]}"; do pkgfile="${pkg##*/}" msg2 "${pkgfile} (${pkgarch})" @@ -81,7 +81,7 @@ done for repo in "${repos[@]}"; do for pkgarch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${pkgarch} + repo_unlock "${repo}" "${pkgarch}" done done diff --git a/testing2x b/testing2x index b6828fc..37c4395 100755 --- a/testing2x +++ b/testing2x @@ -11,28 +11,28 @@ fi # Lock everything to reduce possibility of interfering task between the different repo-updates script_lock for repo in 'core' 'extra' 'testing'; do - for pkgarch in ${ARCHES[@]}; do - repo_lock ${repo} ${pkgarch} || exit 1 + 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 /usr/bin/svn export -q "${SVNREPO}/${pkgbase}/repos" "${WORKDIR}/${pkgbase}" >/dev/null found_source=false - for pkgarch in ${ARCHES[@]} 'any'; do + for pkgarch in "${ARCHES[@]}" 'any'; do svnrepo_from="${WORKDIR}/${pkgbase}/testing-${pkgarch}" if [ -r "${svnrepo_from}/PKGBUILD" ]; then found_source=true break fi done - ${found_source} || die "${pkgbase} not found in [testing]" + "${found_source}" || die "${pkgbase} not found in [testing]" found_target=false - for pkgarch in ${ARCHES[@]} 'any'; do + for pkgarch in "${ARCHES[@]}" 'any'; do for repo in 'core' 'extra'; do svnrepo_to="${WORKDIR}/${pkgbase}/${repo}-${pkgarch}" if [ -r "${svnrepo_to}/PKGBUILD" ]; then @@ -42,16 +42,16 @@ for pkgbase in $*; do fi done done - ${found_target} || die "${pkgbase} neither found in [core] nor [extra]" + "${found_target}" || die "${pkgbase} neither found in [core] nor [extra]" fi done -for pkgarch in ${ARCHES[@]}; do - repo_unlock 'testing' ${pkgarch} +for pkgarch in "${ARCHES[@]}"; do + repo_unlock 'testing' "${pkgarch}" done for repo in 'core' 'extra'; do - for pkgarch in ${ARCHES[@]}; do - repo_unlock ${repo} ${pkgarch} + for pkgarch in "${ARCHES[@]}"; do + repo_unlock "${repo}" "${pkgarch}" done if [ -n "${pkgs[${repo}]}" ]; then "$(dirname "$(readlink -e "$0")")/db-move" 'testing' "${repo}" ${pkgs[${repo}]} -- 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(-) 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 +++---- create-repo | 8 +++---- cron-jobs/ftpdir-cleanup | 12 +++++----- cron-jobs/integrity-check | 2 +- cron-jobs/repo-sanity-check | 4 ++-- cron-jobs/sourceballs | 12 +++++----- cron-jobs/sourceballs2 | 4 ++-- db-check-nonfree | 6 ++--- db-cleanup | 4 ++-- db-functions | 58 ++++++++++++++++++++++----------------------- db-list-unsigned-packages | 2 +- db-move | 10 ++++---- db-remove | 10 ++++---- db-repo-add | 8 +++---- db-repo-remove | 6 ++--- db-sync | 8 +++---- db-update | 20 ++++++++-------- testing2x | 6 ++--- 18 files changed, 94 insertions(+), 94 deletions(-) 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..." diff --git a/create-repo b/create-repo index cfdbc23..b218832 100755 --- a/create-repo +++ b/create-repo @@ -5,20 +5,20 @@ . "$(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}]" + msg2 "Creating [%s]" "${_repo}" mkdir -p "${FTP_BASE}/staging/${_repo}" || \ error "Failed creating staging dir" 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 d5a277b..04ca6c9 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -36,17 +36,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 @@ -62,7 +62,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 @@ -71,7 +71,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 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##*/} " + die "usage: %s " "${0##*/}" fi mailto=$1 diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 105bac4..012b544 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=($( @@ -30,7 +30,7 @@ for _repo in "${PKGREPOS[@]}"; do # quit if abs is empty if [ ${#on_abs[*]} -eq 0 ]; then - warning "[${_repo}]'s ABS tree is empty, skipping" + warning "[%s]'s ABS tree is empty, skipping" "${_repo}" break fi diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 9c07c22..5ce7cfd 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -108,15 +108,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 @@ -130,7 +130,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 "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" @@ -142,7 +142,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 f7b3779..c431e9f 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 cae4a14..c1673c3 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" + warning "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-cleanup b/db-cleanup index b2f2e08..6ac9747 100755 --- a/db-cleanup +++ b/db-cleanup @@ -30,7 +30,7 @@ EXTRAFLAGS=() for _repo in "${PKGREPOS[@]}"; do for _arch in "${ARCHES[@]}"; do - msg "Getting ${_repo}-${_arch} database" + msg "Getting %s-%s database" "${_repo}" "${_arch}" dbfile="${FTP_BASE}/${_repo}/os/${_arch}/${_repo}${DBEXT}" @@ -51,7 +51,7 @@ done msg "Removing old files:" for POOL in "${PKGPOOLS[@]}" "${SRCPOOLS[@]}"; do - msg2 "${POOL}" + msg2 '%s' "${POOL}" rsync "${EXTRAFLAGS[@]}" -va --delete-excluded \ --include-from="/tmp/${0##*/}.$$.filter" \ diff --git a/db-functions b/db-functions index 1384080..51fc1bd 100644 --- a/db-functions +++ b/db-functions @@ -97,7 +97,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 @@ -108,7 +108,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 @@ -128,12 +128,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" @@ -146,7 +146,7 @@ abort() { } die() { - error "$*" + error "$@" cleanup 1 } @@ -167,11 +167,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" "$2" "$2" "$(<"$FILESLOCKFILE")" return 1 fi @@ -188,8 +188,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+=("$1.$2") set_umask @@ -199,14 +199,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 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 @@ -254,7 +254,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 @@ -267,7 +267,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 @@ -279,7 +279,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 @@ -291,10 +291,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 @@ -310,10 +310,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 @@ -384,7 +384,7 @@ check_splitpkgs() { for pkgfile in "${pkgfiles[@]}"; do issplitpkg "${pkgfile}" || continue local _pkgbase="$(getpkgbase "${pkgfile}")" - msg2 "Checking $_pkgbase" + msg2 "Checking %s" "$_pkgbase" local _pkgname="$(getpkgname "${pkgfile}")" local _pkgarch="$(getpkgarch "${pkgfile}")" mkdir -p "${repo}/${_pkgarch}/${_pkgbase}" @@ -490,12 +490,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 } @@ -507,9 +507,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[@]}" >/dev/null \ - || 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}" } @@ -522,12 +522,12 @@ 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[@]}" >/dev/null \ - || 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}" } 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##*/} " + msg "usage: %s " "${0##*/}" exit 1 fi diff --git a/db-move b/db-move index 53543bc..b057d28 100755 --- a/db-move +++ b/db-move @@ -4,7 +4,7 @@ . "$(dirname "$(readlink -e "$0")")/db-functions" if [ $# -lt 3 ]; then - msg "usage: ${0##*/} ..." + msg "usage: %s ..." "${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) @@ -53,10 +53,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 @@ -70,7 +70,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 b0ed9bd..8fff9db 100755 --- a/db-remove +++ b/db-remove @@ -4,7 +4,7 @@ . "$(dirname "$(readlink -e "$0")")/db-functions" if [ $# -lt 3 ]; then - msg "usage: ${0##*/} ..." + msg "usage: %s ..." "${0##*/}" exit 1 fi @@ -13,7 +13,7 @@ arch="$2" pkgbases=("${@:3}") 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 @@ -28,13 +28,13 @@ done remove_pkgs=() for pkgbase in "${pkgbases[@]}"; do - msg "Removing $pkgbase from [$repo]..." + msg "Removing %s from [%s]..." "$pkgbase" "$repo" if [ -d "${SVNREPO}/$repo/$pkgbase" ]; then remove_pkgs=($(. "${SVNREPO}/$repo/$pkgbase/PKGBUILD"; echo "${pkgname[@]}")) else - warning "$pkgbase not found in ABS(libre)" - warning "Removing only $pkgbase from the repo" + warning "%s not found in ABS(libre)" "$pkgbase" + warning "Removing only %s from the repo" "$pkgbase" warning "If it was a split package you have to remove the others yourself!" remove_pkgs+=("$pkgbase") fi diff --git a/db-repo-add b/db-repo-add index 92be22e..4611bdf 100755 --- a/db-repo-add +++ b/db-repo-add @@ -4,7 +4,7 @@ . "$(dirname "$(readlink -e "$0")")/db-functions" if [ $# -lt 3 ]; then - msg "usage: ${0##*/} ..." + msg "usage: %s ..." "${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 487abd8..aadc4ce 100755 --- a/db-repo-remove +++ b/db-repo-remove @@ -4,7 +4,7 @@ . "$(dirname "$(readlink -e "$0")")/db-functions" if [ $# -lt 3 ]; then - msg "usage: ${0##*/} ..." + msg "usage: %s ..." "${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-sync b/db-sync index 9b90219..58e211d 100755 --- a/db-sync +++ b/db-sync @@ -71,7 +71,7 @@ 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} @@ -106,7 +106,7 @@ init() { # pass through 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 @@ -139,7 +139,7 @@ init() { # Concatenate all whitelists, check for single *s just in case 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 @@ -192,7 +192,7 @@ source "$(dirname "$(readlink -e "$0")")/libremessages" # 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 diff --git a/db-update b/db-update index 18162db..ced673e 100755 --- a/db-update +++ b/db-update @@ -6,14 +6,14 @@ shopt -s nullglob 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 repos=($(find "${STAGING}" -mindepth 1 -maxdepth 1 -type d ! -empty -printf '%f ' 2>/dev/null)) if [ $? -ge 1 ]; then - die "Could not read ${STAGING}" + die "Could not read %s" "${STAGING}" fi # TODO: this might lock too much (architectures) @@ -28,37 +28,37 @@ for repo in "${repos[@]}"; do pkgs=($(getpkgfiles "${STAGING}/${repo}/"*${PKGEXT})) if [ $? -eq 0 ]; then if [ ${#pkgs[@]} -gt 0 ] && ! 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 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 ! check_pkgrepos "${pkg}"; then - die "Package ${repo}/${pkg##*/} already exists in another repository" + die "Package %s already exists in another repository" "${repo}/${pkg##*/}" fi done # This is fucking obnoxious #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 37c4395..0c5c8d7 100755 --- a/testing2x +++ b/testing2x @@ -4,7 +4,7 @@ . "$(dirname "$(readlink -e "$0")")/db-functions" if [ $# -lt 1 ]; then - msg "usage: ${0##*/} ..." + msg "usage: %s ..." "${0##*/}" exit 1 fi @@ -30,7 +30,7 @@ for pkgbase in "$@"; do break fi done - "${found_source}" || die "${pkgbase} not found in [testing]" + "${found_source}" || die "%s not found in [testing]" "${pkgbase}" found_target=false for pkgarch in "${ARCHES[@]}" 'any'; do for repo in 'core' 'extra'; do @@ -42,7 +42,7 @@ for pkgbase in "$@"; do fi done done - "${found_target}" || die "${pkgbase} neither found in [core] nor [extra]" + "${found_target}" || die "%s neither found in [core] nor [extra]" "${pkgbase}" fi done -- cgit v1.2.3-2-g168b From 3abd3eaf4b3e6495d4603a8eb478e0f603ad51d9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 13:46:25 -0400 Subject: create-repo: get rid of old staging logic --- create-repo | 3 --- 1 file changed, 3 deletions(-) diff --git a/create-repo b/create-repo index b218832..3feb098 100755 --- a/create-repo +++ b/create-repo @@ -12,9 +12,6 @@ fi msg "Creating repos..." for _repo in "$@"; do msg2 "Creating [%s]" "${_repo}" - mkdir -p "${FTP_BASE}/staging/${_repo}" || \ - error "Failed creating staging dir" - for _arch in "${ARCHES[@]}"; do mkdir -p "${FTP_BASE}/${_repo}/os/${_arch}" || \ error "Failed creating %s dir" "${_arch}" -- cgit v1.2.3-2-g168b