From: Jan-Benedict G. <jb...@us...> - 2006-03-19 14:51:13
|
Update of /cvsroot/linux-vax/toolchain/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19467 Modified Files: run_test_build.sh Log Message: - Implement log rotation. - Mention if checking was done in the `Subject:' line Index: run_test_build.sh =================================================================== RCS file: /cvsroot/linux-vax/toolchain/scripts/run_test_build.sh,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- run_test_build.sh 15 Mar 2006 07:42:15 -0000 1.22 +++ run_test_build.sh 19 Mar 2006 14:51:10 -0000 1.23 @@ -22,6 +22,7 @@ BUILD_BAD="${6}" LOCKFILE="${7}" TESTRESULT_DIR="${8}" +# LOGROTATE comes from the vax_toolchain_config file I_AM="Nemo" VERSION="$Revision$" @@ -30,9 +31,11 @@ if [ -d "${TESTRESULT_DIR}" ]; then RUN_TEST=YesPlease OMIT_CHECKS="" + SUBJECT_ADDON=" (incl. checking)" else RUN_TEST="" OMIT_CHECKS="--omit-checks" + SUBJECT_ADDON="" fi # @@ -73,6 +76,20 @@ fi } +function rotate_logs() { + local new_number + + [ ! -r "${1}" ] && return + [ -z "${LOGROTATE}" -o "${LOGROTATE}" -eq 0 ] && return + + for i in `seq ${LOGROTATE} -1 1`; do + new_number=$(( ${i} + 1 )) + [ -r "${1}.${i}" ] && mv -- "${1}.${i}" "${1}.${new_number}" + done + + mv -- "${1}" "${1}.1" +} + function unlock() { if [ -n "${RUN_TEST}" ]; then if ls ${BUILD_DIRECTORY}/*.sh > /dev/null 2>&1; then @@ -128,7 +145,8 @@ echo "Have a nice day," echo " Your ${I_AM}" echo - ) | send_stdin "Successful build for ${TARGET}" + ) | send_stdin "Successful build for ${TARGET}${SUBJECT_ADDON}" + rotate_logs "${BUILD_OKAY}" mv "${BUILD_DIRECTORY}/build.log" "${BUILD_OKAY}" unlock exit 0 @@ -152,7 +170,8 @@ echo "Have a nice day," echo " Your ${I_AM}" echo - ) | send_stdin "Failed build for ${TARGET}" + ) | send_stdin "Failed build for ${TARGET}${SUBJECT_ADDON}" + rotate_logs "${BUILD_BAD}" mv "${BUILD_DIRECTORY}/build.log" "${BUILD_BAD}" unlock exit 1 |