diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-11-20 16:11:59 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-11-20 16:11:59 +0100 |
commit | cb2dcc6ee207e9c5ba4b875d70e387e6347591ed (patch) | |
tree | 5874d805bb6fdca2011417fc23f34a09a943d458 /cron-jobs | |
parent | a1ba979a0e3c763449d91fc787333f4058e89aa8 (diff) |
Fix sourceballs cron job
* add unit test for sourceballs and cleanup
* introduce SRCPOOL and LOGDIR variables in config
Diffstat (limited to 'cron-jobs')
-rwxr-xr-x | cron-jobs/sourceballs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 0b01321..4fc194f 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -3,9 +3,6 @@ . "$(dirname $0)/../db-functions" . "$(dirname $0)/../config" -ftpbase="${FTP_BASE}" -srcbase="${FTP_BASE}/sources" - script_lock set_umask @@ -14,12 +11,12 @@ dirname="$(/bin/readlink -f $(/usr/bin/dirname $0))" FAILED_PKGS="" -[ -e "$srcbase/errors.txt" ] && /bin/mv "$srcbase/errors.txt" "$srcbase/errors.txt.old" -echo "Errors occured during run:" > "$srcbase/errors.txt" +[ ! -d "${LOGDIR}/sourceballs" ] && mkdir -p "${LOGDIR}/sourceballs" +[ -e "${LOGDIR}/sourceballs/errors.txt" ] && /bin/mv "${LOGDIR}/sourceballs/errors.txt" "${LOGDIR}/sourceballs/errors.txt.old" for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]} any; do - ftppath="$ftpbase/$repo/os/$arch" + for arch in ${ARCHES[@]}; do + ftppath="${FTP_BASE}/$repo/os/$arch" if [ ! -d "$ftppath" ]; then error "FTP path does not exist: $ftppath" continue @@ -28,7 +25,6 @@ for repo in ${PKGREPOS[@]}; do for pkg in *$PKGEXT; do [ -f "$pkg" ] || continue pkgbase=$(getpkgbase $pkg) - srcpath="$srcbase/" srcpkg="${pkg//$PKGEXT/$SRCEXT}" srcpkg="${srcpkg//-$arch/}" srcpkgname="${srcpkg%-*-*$SRCEXT}" @@ -51,9 +47,9 @@ for repo in ${PKGREPOS[@]}; do force="-f" fi - if [ ! \( -f "$srcpath$srcpkg" -o -f "$srcpath$srcpkgbase" \) ]; then + if [ ! \( -f "${FTP_BASE}/${SRCPOOL}/$srcpkg" -o -f "${FTP_BASE}/${SRCPOOL}/$srcpkgbase" \) ]; then if ! $dirname/../misc-scripts/make-sourceball $force \ - $pkgbase $repo $arch 2>>"$srcbase/errors.txt"; then + $pkgbase $repo $arch 2>>"${LOGDIR}/sourceballs/errors.txt"; then FAILED_PKGS="$FAILED_PKGS $pkgbase" fi fi @@ -62,9 +58,8 @@ for repo in ${PKGREPOS[@]}; do done if [ -n "$FAILED_PKGS" ]; then - [ -e "$srcbase/failed.txt" ] && /bin/mv "$srcbase/failed.txt" "$srcbase/failed.txt.old" - echo "The following package bases failed:" > "$srcbase/failed.txt" - echo -e $FAILED_PKGS | sed "s| |\n|g" | sort -u >> "$srcbase/failed.txt" + [ -e "${LOGDIR}/sourceballs/failed.txt" ] && /bin/mv "${LOGDIR}/sourceballs/failed.txt" "${LOGDIR}/sourceballs/failed.txt.old" + echo -e $FAILED_PKGS | sed "s| |\n|g" | sort -u >> "${LOGDIR}/sourceballs/failed.txt" fi $dirname/../misc-scripts/sourceballs-cleanup |