From cb2dcc6ee207e9c5ba4b875d70e387e6347591ed Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 20 Nov 2010 16:11:59 +0100 Subject: Fix sourceballs cron job * add unit test for sourceballs and cleanup * introduce SRCPOOL and LOGDIR variables in config --- misc-scripts/sourceballs-cleanup | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'misc-scripts/sourceballs-cleanup') diff --git a/misc-scripts/sourceballs-cleanup b/misc-scripts/sourceballs-cleanup index e407989..788cc98 100755 --- a/misc-scripts/sourceballs-cleanup +++ b/misc-scripts/sourceballs-cleanup @@ -3,8 +3,8 @@ . "$(dirname $0)/../db-functions" . "$(dirname $0)/../config" -srcpath="$FTP_BASE/sources/" -logfile="$srcpath/cleanup.txt" +[ ! -d "${LOGDIR}/sourceballs" ] && mkdir -p "${LOGDIR}/sourceballs" +logfile="${LOGDIR}/sourceballs/cleanup.txt" script_lock @@ -20,7 +20,7 @@ remove_old() { cd .. done - for srcpkg in "$srcpath/$packagename-"*; do + for srcpkg in "${FTP_BASE}/${SRCPOOL}/$packagename-"*; do [ -f "$srcpkg" ] || continue if [ "$(pkgname_from_src $srcpkg)" == "$packagename" ]; then skip=0 @@ -47,10 +47,11 @@ remove_old() { set_umask cd "$WORKDIR" + [ -e "$logfile" ] && /bin/mv "$logfile" "$logfile.old" echo "Orphaned sourceballs:" > "$logfile" -for sourceball in "$srcpath"/*$SRCEXT; do +for sourceball in "${FTP_BASE}/${SRCPOOL}"/*$SRCEXT; do packagename=$(basename $sourceball) packagename=${packagename%-*-*$SRCEXT} -- cgit v1.2.3-24-g4f1b