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 /misc-scripts | |
parent | a1ba979a0e3c763449d91fc787333f4058e89aa8 (diff) | |
download | dbscripts-cb2dcc6ee207e9c5ba4b875d70e387e6347591ed.tar.gz dbscripts-cb2dcc6ee207e9c5ba4b875d70e387e6347591ed.tar.xz |
Fix sourceballs cron job
* add unit test for sourceballs and cleanup
* introduce SRCPOOL and LOGDIR variables in config
Diffstat (limited to 'misc-scripts')
-rwxr-xr-x | misc-scripts/make-sourceball | 13 | ||||
-rwxr-xr-x | misc-scripts/sourceballs-cleanup | 9 |
2 files changed, 9 insertions, 13 deletions
diff --git a/misc-scripts/make-sourceball b/misc-scripts/make-sourceball index 5bd155f..221d0ce 100755 --- a/misc-scripts/make-sourceball +++ b/misc-scripts/make-sourceball @@ -19,9 +19,6 @@ packagename="$1" reponame="$2" arch="$3" -srcpath="$FTP_BASE/sources/" -logpath="/var/log/sourceballs/" - script_lock create_srcpackage() { @@ -29,6 +26,7 @@ create_srcpackage() { pushd "$1" >/dev/null pkgver=$(. PKGBUILD; echo ${pkgver}) pkgrel=$(. PKGBUILD; echo ${pkgrel}) + license=($(. PKGBUILD; echo ${license[@]})) if ! [ $FORCE == 1 ] && ! chk_license ${license[@]} ; then #Removed so as not to clutter failed.txt #warning "$packagename license (${license[@]}) does not require source tarballs" @@ -37,7 +35,7 @@ create_srcpackage() { msg "Creating source tarball for $packagename-$pkgver-$pkgrel" fi - local logfile="$logpath/$packagename" + local logfile="${LOGDIR}/sourceballs/$packagename" if ! /usr/bin/makepkg --allsource --ignorearch >"$logfile" 2>&1; then popd >/dev/null /bin/gzip -f -9 "$logfile" @@ -47,10 +45,7 @@ create_srcpackage() { local pkg_file="${packagename}-${pkgver}-${pkgrel}${SRCEXT}" - if [ ! -d "$srcpath" ]; then - mkdir -p "$srcpath" - fi - cp "$pkg_file" "$srcpath" + cp "$pkg_file" "${FTP_BASE}/${SRCPOOL}" popd >/dev/null @@ -59,7 +54,7 @@ create_srcpackage() { } set_umask -/bin/mkdir -p "$logpath" +[ ! -d "${LOGDIR}/sourceballs" ] && mkdir -p "${LOGDIR}/sourceballs" cd "$WORKDIR" if [[ "$reponame" = "community" || "$reponame" = "community-testing" ]]; then 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} |