scripts/repocheck/commit-checker
author alpar
Thu, 09 Nov 2006 00:23:26 +0000
changeset 2298 d77ddf9e592f
parent 2294 abf880d78522
child 2299 227ea098a6b6
permissions -rwxr-xr-x
Test the automatic compilation checker 3/3: fix repo again
alpar@2294
     1
#!/bin/bash
alpar@2294
     2
alpar@2294
     3
ROOT=$PWD
alpar@2294
     4
REV=$1
alpar@2294
     5
LOGFILE=${ROOT}/logs/${REV}.log
alpar@2294
     6
alpar@2294
     7
function im-not-the-next() {
alpar@2294
     8
    for i in `ls queue`
alpar@2294
     9
    do
alpar@2294
    10
	if [ $i -lt $REV ]; then
alpar@2294
    11
	    true
alpar@2294
    12
	    return
alpar@2294
    13
	fi
alpar@2294
    14
    done
alpar@2294
    15
    false
alpar@2294
    16
}
alpar@2294
    17
alpar@2294
    18
function make-dir () {
alpar@2294
    19
    if [ ! -d $1 ]; then
alpar@2294
    20
	mkdir $1
alpar@2294
    21
    fi
alpar@2294
    22
}
alpar@2294
    23
alpar@2294
    24
function makecheck () {
alpar@2294
    25
    if [ `which $(echo $CXX|cut -f1 -d' ' )` ]; then
alpar@2294
    26
	make-dir $ODIR &&
alpar@2294
    27
	cd $ODIR &&
alpar@2294
    28
	time ../trunk/configure $* &&
alpar@2294
    29
	time make check &&
alpar@2294
    30
	cd .. 
alpar@2294
    31
    else
alpar@2294
    32
	echo
alpar@2294
    33
	echo '***************************************************************'
alpar@2294
    34
	echo "  COMPILER $CXX CANNOT BE FOUND"
alpar@2294
    35
	echo '***************************************************************'
alpar@2294
    36
	echo
alpar@2294
    37
    fi
alpar@2294
    38
}
alpar@2294
    39
alpar@2294
    40
function check-compilers() {
alpar@2294
    41
cd trunk &&
alpar@2294
    42
autoreconf -vi &&
alpar@2294
    43
cd .. &&
alpar@2294
    44
# ODIR=gcc-3.3 CXX=g++-3.3 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark &&
alpar@2294
    45
# ODIR=gcc-3.4 CXX=g++-3.4 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark &&
alpar@2294
    46
# ODIR=gcc-4.0 CXX=g++-4.0 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark &&
alpar@2294
    47
ODIR=gcc-4.1 CXX=g++-4.1 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark &&
alpar@2294
    48
# # ODIR=icc-8.0 CXX=icpc-8.0 CXXFLAGS='-Werror' makecheck --enable-demo --enable-benchmark &&
alpar@2294
    49
# ODIR=icc-9.0 CXX='icpc-9.0' CXXFLAGS='-Werror' makecheck --enable-demo --enable-benchmark &&
alpar@2294
    50
# ODIR=mingw CXX='g++' makecheck --with-msw --target=i586-mingw32msvc --host=i586-mingw32msvc --build=i386-linux --without-glpk &&
alpar@2294
    51
echo &&
alpar@2294
    52
echo '**********************************************************************' &&
alpar@2294
    53
echo '   REPOSITORY SEEMS OK' &&
alpar@2294
    54
echo '**********************************************************************' &&
alpar@2294
    55
echo
alpar@2294
    56
}
alpar@2294
    57
alpar@2294
    58
if [ $# -eq 0 ]; then
alpar@2294
    59
    echo 'Usage:'
alpar@2294
    60
    echo '   commit-checker --init'
alpar@2294
    61
    echo '   commit-checker revision'
alpar@2294
    62
    exit 1
alpar@2294
    63
elif [ $1 = '--init' ]; then
alpar@2294
    64
    rm -rf queue
alpar@2294
    65
    mkdir queue
alpar@2294
    66
    make-dir logs
alpar@2294
    67
    rm -rf trunk
alpar@2294
    68
    svn co https://lemon.cs.elte.hu/svn/hugo/trunk
alpar@2294
    69
    exit 0
alpar@2294
    70
fi
alpar@2294
    71
alpar@2294
    72
touch queue/$REV
alpar@2294
    73
alpar@2294
    74
while im-not-the-next; do
alpar@2294
    75
    sleep 10
alpar@2294
    76
done
alpar@2294
    77
alpar@2294
    78
echo RUN $REV
alpar@2294
    79
alpar@2294
    80
svn up -r$REV trunk >${LOGFILE} 2>&1
alpar@2294
    81
alpar@2294
    82
AUTHOR=`svn info trunk|grep 'Last Changed Author:'|cut -d ' ' -f 4`
alpar@2294
    83
EMAIL=`awk '$1=="'${AUTHOR}'" {print $2}' <${ROOT}/e-mails`
alpar@2294
    84
alpar@2294
    85
echo '
alpar@2294
    86
alpar@2294
    87
*************************************************************
alpar@2294
    88
Check revision '${REV}' of '${AUTHOR}' ('${EMAIL}')
alpar@2294
    89
*************************************************************
alpar@2294
    90
alpar@2294
    91
'>>${LOGFILE} 2>&1
alpar@2294
    92
alpar@2294
    93
if check-compilers >>${LOGFILE} 2>&1
alpar@2294
    94
then
alpar@2294
    95
    echo -n
alpar@2294
    96
    echo OK $AUTHOR $EMAIL $REV
alpar@2294
    97
else
alpar@2294
    98
    echo NEMOK $AUTHOR $EMAIL $REV
alpar@2294
    99
    echo 'Dear '${AUTHOR}',
alpar@2294
   100
Your svn commit -r'${REV}' made the repository broken.
alpar@2294
   101
The compilation log is attached.
alpar@2294
   102
Please fix the problem as soon as possible.
alpar@2294
   103
alpar@2294
   104
Best regards,
alpar@2294
   105
LEMON Commit Checking Service
alpar@2294
   106
'|
alpar@2294
   107
    mail -a ${LOGFILE} -s '[LEMON-SVN] WARNING: Broken repository' \
alpar@2295
   108
	${EMAIL} alpar@cs.elte.hu
alpar@2294
   109
fi
alpar@2294
   110
    
alpar@2294
   111
#    rm ${LOGFILE}
alpar@2294
   112
rm queue/$REV
alpar@2294
   113