scripts/repocheck/commit-checker
changeset 2294 abf880d78522
child 2295 e464aaa8cdd7
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/repocheck/commit-checker	Wed Nov 08 23:28:14 2006 +0000
     1.3 @@ -0,0 +1,113 @@
     1.4 +#!/bin/bash
     1.5 +
     1.6 +ROOT=$PWD
     1.7 +REV=$1
     1.8 +LOGFILE=${ROOT}/logs/${REV}.log
     1.9 +
    1.10 +function im-not-the-next() {
    1.11 +    for i in `ls queue`
    1.12 +    do
    1.13 +	if [ $i -lt $REV ]; then
    1.14 +	    true
    1.15 +	    return
    1.16 +	fi
    1.17 +    done
    1.18 +    false
    1.19 +}
    1.20 +
    1.21 +function make-dir () {
    1.22 +    if [ ! -d $1 ]; then
    1.23 +	mkdir $1
    1.24 +    fi
    1.25 +}
    1.26 +
    1.27 +function makecheck () {
    1.28 +    if [ `which $(echo $CXX|cut -f1 -d' ' )` ]; then
    1.29 +	make-dir $ODIR &&
    1.30 +	cd $ODIR &&
    1.31 +	time ../trunk/configure $* &&
    1.32 +	time make check &&
    1.33 +	cd .. 
    1.34 +    else
    1.35 +	echo
    1.36 +	echo '***************************************************************'
    1.37 +	echo "  COMPILER $CXX CANNOT BE FOUND"
    1.38 +	echo '***************************************************************'
    1.39 +	echo
    1.40 +    fi
    1.41 +}
    1.42 +
    1.43 +function check-compilers() {
    1.44 +cd trunk &&
    1.45 +autoreconf -vi &&
    1.46 +cd .. &&
    1.47 +# ODIR=gcc-3.3 CXX=g++-3.3 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark &&
    1.48 +# ODIR=gcc-3.4 CXX=g++-3.4 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark &&
    1.49 +# ODIR=gcc-4.0 CXX=g++-4.0 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark &&
    1.50 +ODIR=gcc-4.1 CXX=g++-4.1 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark &&
    1.51 +# # ODIR=icc-8.0 CXX=icpc-8.0 CXXFLAGS='-Werror' makecheck --enable-demo --enable-benchmark &&
    1.52 +# ODIR=icc-9.0 CXX='icpc-9.0' CXXFLAGS='-Werror' makecheck --enable-demo --enable-benchmark &&
    1.53 +# ODIR=mingw CXX='g++' makecheck --with-msw --target=i586-mingw32msvc --host=i586-mingw32msvc --build=i386-linux --without-glpk &&
    1.54 +echo &&
    1.55 +echo '**********************************************************************' &&
    1.56 +echo '   REPOSITORY SEEMS OK' &&
    1.57 +echo '**********************************************************************' &&
    1.58 +echo
    1.59 +}
    1.60 +
    1.61 +if [ $# -eq 0 ]; then
    1.62 +    echo 'Usage:'
    1.63 +    echo '   commit-checker --init'
    1.64 +    echo '   commit-checker revision'
    1.65 +    exit 1
    1.66 +elif [ $1 = '--init' ]; then
    1.67 +    rm -rf queue
    1.68 +    mkdir queue
    1.69 +    make-dir logs
    1.70 +    rm -rf trunk
    1.71 +    svn co https://lemon.cs.elte.hu/svn/hugo/trunk
    1.72 +    exit 0
    1.73 +fi
    1.74 +
    1.75 +touch queue/$REV
    1.76 +
    1.77 +while im-not-the-next; do
    1.78 +    sleep 10
    1.79 +done
    1.80 +
    1.81 +echo RUN $REV
    1.82 +
    1.83 +svn up -r$REV trunk >${LOGFILE} 2>&1
    1.84 +
    1.85 +AUTHOR=`svn info trunk|grep 'Last Changed Author:'|cut -d ' ' -f 4`
    1.86 +EMAIL=`awk '$1=="'${AUTHOR}'" {print $2}' <${ROOT}/e-mails`
    1.87 +
    1.88 +echo '
    1.89 +
    1.90 +*************************************************************
    1.91 +Check revision '${REV}' of '${AUTHOR}' ('${EMAIL}')
    1.92 +*************************************************************
    1.93 +
    1.94 +'>>${LOGFILE} 2>&1
    1.95 +
    1.96 +if check-compilers >>${LOGFILE} 2>&1
    1.97 +then
    1.98 +    echo -n
    1.99 +    echo OK $AUTHOR $EMAIL $REV
   1.100 +else
   1.101 +    echo NEMOK $AUTHOR $EMAIL $REV
   1.102 +    echo 'Dear '${AUTHOR}',
   1.103 +Your svn commit -r'${REV}' made the repository broken.
   1.104 +The compilation log is attached.
   1.105 +Please fix the problem as soon as possible.
   1.106 +
   1.107 +Best regards,
   1.108 +LEMON Commit Checking Service
   1.109 +'|
   1.110 +    mail -a ${LOGFILE} -s '[LEMON-SVN] WARNING: Broken repository' \
   1.111 +	alpar@cs.elte.hu
   1.112 +fi
   1.113 +    
   1.114 +#    rm ${LOGFILE}
   1.115 +rm queue/$REV
   1.116 +