From 30a128a864bdbfc294b6ba6a49c9264570bb3c58 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 21 Nov 2010 13:23:09 +0100 Subject: sourceballs: Don't write any log This is consistent with the other dbscripts. The output will be send to the mailinglist. --- config | 1 - cron-jobs/sourceballs | 11 +++-------- misc-scripts/make-sourceball | 15 +++++++-------- misc-scripts/sourceballs-cleanup | 17 +++++------------ test/lib/common.inc | 2 -- test/runTest | 13 ------------- 6 files changed, 15 insertions(+), 44 deletions(-) diff --git a/config b/config index 4b89f2d..01956ba 100644 --- a/config +++ b/config @@ -13,7 +13,6 @@ LOCK_TIMEOUT=300 STAGING="$HOME/staging" TMPDIR="/srv/tmp" -LOGDIR="/var/log/dbscripts" ARCHES=(i686 x86_64) DBEXT=".db.tar.gz" PKGEXT=".pkg.tar.*" diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 351b06d..23e8421 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -9,16 +9,12 @@ set_umask dirname="$(/bin/readlink -f $(/usr/bin/dirname $0))" -[ ! -d "${LOGDIR}/sourceballs" ] && mkdir -p "${LOGDIR}/sourceballs" -[ -e "${LOGDIR}/sourceballs/errors.txt" ] && /bin/mv "${LOGDIR}/sourceballs/errors.txt" "${LOGDIR}/sourceballs/errors.txt.old" -[ -e "${LOGDIR}/sourceballs/failed.txt" ] && /bin/mv "${LOGDIR}/sourceballs/failed.txt" "${LOGDIR}/sourceballs/failed.txt.old" - for repo in ${PKGREPOS[@]}; do for arch in ${ARCHES[@]}; do ftppath="${FTP_BASE}/$repo/os/$arch" dbfile="${ftppath}/${repo}${DBEXT}" if [ ! -r "${dbfile}" ]; then - warning "DB file does not exist: ${dbfile}" + warning "${dbfile} not found, skipping" continue fi @@ -48,9 +44,8 @@ for repo in ${PKGREPOS[@]}; do fi if [ ! -f "${FTP_BASE}/${SRCPOOL}/$srcpkg" ]; then - if ! $dirname/../misc-scripts/make-sourceball $force \ - $pkgbase $repo $arch 2>>"${LOGDIR}/sourceballs/errors.txt"; then - echo "$pkgbase" >> "${LOGDIR}/sourceballs/failed.txt" + if ! $dirname/../misc-scripts/make-sourceball $force $pkgbase $repo $arch; then + error "Failed to download sources for $pkgbase" fi fi done diff --git a/misc-scripts/make-sourceball b/misc-scripts/make-sourceball index 66d3dad..fccc4b5 100755 --- a/misc-scripts/make-sourceball +++ b/misc-scripts/make-sourceball @@ -47,17 +47,17 @@ create_srcpackage() { msg "Creating source tarball for $packagename-$pkgver-$pkgrel" fi - local logfile="${LOGDIR}/sourceballs/$packagename" - if ! /usr/bin/makepkg --allsource --ignorearch >"$logfile" 2>&1; then + /usr/bin/makepkg --allsource --ignorearch > "$WORKDIR/makepkg.log" 2>&1 + if [ $? -ne 0 ]; then error "Failed to download source for $packagename-$pkgver-$pkgrel ($reponame-$arch)" - popd >/dev/null + local line + while read line; do + msg2 "${line}" + done < "$WORKDIR/makepkg.log" return 1 fi - /bin/rm -f "$logfile" - - local pkg_file="${packagename}-${pkgver}-${pkgrel}${SRCEXT}" - mv "$pkg_file" "${FTP_BASE}/${SRCPOOL}" + mv "${packagename}-${pkgver}-${pkgrel}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}" popd >/dev/null @@ -68,7 +68,6 @@ create_srcpackage() { } set_umask -[ ! -d "${LOGDIR}/sourceballs" ] && mkdir -p "${LOGDIR}/sourceballs" cd "$WORKDIR" failed=0 diff --git a/misc-scripts/sourceballs-cleanup b/misc-scripts/sourceballs-cleanup index 450d137..fdb1355 100755 --- a/misc-scripts/sourceballs-cleanup +++ b/misc-scripts/sourceballs-cleanup @@ -3,9 +3,6 @@ . "$(dirname $0)/../db-functions" . "$(dirname $0)/../config" -[ ! -d "${LOGDIR}/sourceballs" ] && mkdir -p "${LOGDIR}/sourceballs" -logfile="${LOGDIR}/sourceballs/cleanup.txt" - script_lock ${CLEANUP_DRYRUN} && warning 'dry run mode is active' @@ -53,10 +50,6 @@ remove_old() { set_umask cd "$WORKDIR" - -[ -e "$logfile" ] && /bin/mv "$logfile" "$logfile.old" -echo "Orphaned sourceballs:" > "$logfile" - for sourceball in "${FTP_BASE}/${SRCPOOL}"/*$SRCEXT; do [ -f "$sourceball" ] || continue packagename=$(basename $sourceball) @@ -64,16 +57,16 @@ for sourceball in "${FTP_BASE}/${SRCPOOL}"/*$SRCEXT; do if ! /usr/bin/svn export -q --force "$SVNREPO/$packagename" "$packagename" >/dev/null 2>&1; then if [ $? -ne 1 ]; then - echo "$packagename : svn died during export. Skipping sourceball." >> "$logfile" + error "$packagename : svn died during export. Skipping sourceball." else - echo "$packagename : no longer in svn. Removing sourceball." >> "$logfile" + msg "$packagename : no longer in svn. Removing sourceball." ${CLEANUP_DRYRUN} || mv $sourceball $SOURCE_CLEANUP_DESTDIR fi elif [ -z "$(ls -A "$packagename/repos")" ]; then - echo "$packagename : no longer in repos but trunk is still in svn. Removing sourceball." >> "$logfile" + warning "$packagename : no longer in repos but trunk is still in svn. Removing sourceball." ${CLEANUP_DRYRUN} || mv $sourceball $SOURCE_CLEANUP_DESTDIR - elif ! source "$packagename/trunk/PKGBUILD" && chk_license ${license[@]}; then - echo "$packagename : source hosting no longer required by license. Removing sourceball." >> "$logfile" + elif ! chk_license $(. "$packagename/trunk/PKGBUILD"; echo ${license[@]}); then + msg "$packagename : source hosting no longer required by license. Removing sourceball." ${CLEANUP_DRYRUN} || mv $sourceball $SOURCE_CLEANUP_DESTDIR else remove_old "$packagename/repos/" diff --git a/test/lib/common.inc b/test/lib/common.inc index e47ae2d..6619c0a 100644 --- a/test/lib/common.inc +++ b/test/lib/common.inc @@ -45,7 +45,6 @@ setUp() { done mkdir -p "${TMP}/ftp/${PKGPOOL}" mkdir -p "${TMP}/ftp/${SRCPOOL}" - mkdir -p "${TMP}/log" msg 'Creating svn repository...' svnadmin create "${TMP}/svn-packages-repo" @@ -68,7 +67,6 @@ setUp() { SOURCE_CLEANUP_DESTDIR="${TMP}/source-cleanup" STAGING="${TMP}/staging" TMPDIR="${TMP}/tmp" - LOGDIR="${TMP}/log" CLEANUP_DRYRUN=false eot . "${curdir}/../config" diff --git a/test/runTest b/test/runTest index d3e2eff..6c60ddc 100755 --- a/test/runTest +++ b/test/runTest @@ -553,13 +553,6 @@ testSourceballs() { ../db-update ../cron-jobs/sourceballs - - for log in errors failed; do - if [ -s "${LOGDIR}/sourceballs/${log}.txt" ]; then - fail "${LOGDIR}/sourceballs/${log}.txt includes the following errors:" - cat "${LOGDIR}/sourceballs/${log}.txt" - fi - done for pkgbase in ${pkgs[@]}; do [ ! -r ${FTP_BASE}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" done @@ -585,12 +578,6 @@ testSourceballsCleanup() { ../cron-jobs/ftpdir-cleanup >/dev/null ../cron-jobs/sourceballs - for log in errors failed; do - if [ -s "${LOGDIR}/sourceballs/${log}.txt" ]; then - fail "${LOGDIR}/sourceballs/${log}.txt includes the following errors:" - cat "${LOGDIR}/sourceballs/${log}.txt" - fi - done [ -r ${FTP_BASE}/${SRCPOOL}/pkg-simple-a-*${SRCEXT} ] && fail "source package was not removed!" [ ! -r ${FTP_BASE}/${SRCPOOL}/pkg-simple-b-*${SRCEXT} ] && fail "source package not found!" } -- cgit v1.2.3-24-g4f1b