summaryrefslogtreecommitdiff
path: root/cron-jobs
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-17 23:11:44 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-06-17 23:11:44 -0400
commitb1ac233691ac28645cb729d7d5e7c7b51fc899bd (patch)
tree181116399ba1c1d1700f1815ae2d1c6411e6b9de /cron-jobs
parenta50725c2b9a94ce28e486dadd17886a61d4dcff4 (diff)
cron-jobs/repo-sanity-check: clean up
Diffstat (limited to 'cron-jobs')
-rwxr-xr-xcron-jobs/repo-sanity-check95
1 files changed, 46 insertions, 49 deletions
diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check
index 8b0758f..73ec171 100755
--- a/cron-jobs/repo-sanity-check
+++ b/cron-jobs/repo-sanity-check
@@ -1,57 +1,54 @@
#!/bin/bash
-# Solves issue165
+# Solves issue165... on the old flyspray install. I have no idea what issue that was.
. "$(dirname "$(readlink -e "$0")")/../config"
. "$(dirname "$(readlink -e "$0")")/../db-functions"
# 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 \
- <(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 \;
-
- 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
+ printf '%q ' "${pkgname[@]}"
+ done
+ ))
+
+ # quit if abs is empty
+ if [ ${#on_abs[*]} -eq 0 ]; then
+ warning "[%s]'s ABS tree is empty, skipping" "${_repo}"
+ 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 \
+ <(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
+
+ msg2 "Removed the following packages:"
+ plain '%s' "${remove[@]}"
done
-
-exit $?