scripts/server-services/repocheck/commit-checker
author kpeter
Fri, 06 Feb 2009 21:52:34 +0000
changeset 2634 e98bbe64cca4
parent 2327 596e48d6e77b
permissions -rwxr-xr-x
Rework Network Simplex
Use simpler and faster graph implementation instead of SmartGraph
alpar@2317
     1
#!/bin/bash
alpar@2317
     2
alpar@2317
     3
ROOT=$PWD
alpar@2317
     4
REV=$1
alpar@2317
     5
LOGFILE=${ROOT}/logs/${REV}.log
alpar@2317
     6
alpar@2317
     7
function im-not-the-next() {
alpar@2317
     8
    for i in `ls queue`
alpar@2317
     9
    do
alpar@2317
    10
	if [ $i -lt $REV ]; then
alpar@2317
    11
	    true
alpar@2317
    12
	    return
alpar@2317
    13
	fi
alpar@2317
    14
    done
alpar@2317
    15
    false
alpar@2317
    16
}
alpar@2317
    17
alpar@2317
    18
function make-dir () {
alpar@2317
    19
    if [ ! -d $1 ]; then
alpar@2317
    20
	mkdir $1
alpar@2317
    21
    fi
alpar@2317
    22
}
alpar@2317
    23
alpar@2317
    24
function makecheck () {
alpar@2317
    25
    if [ `which $(echo $CXX|cut -f1 -d' ' )` ]; then
alpar@2317
    26
	make-dir $ODIR &&
alpar@2317
    27
	cd $ODIR &&
alpar@2317
    28
	time ../trunk/configure $* &&
alpar@2317
    29
	time make check &&
alpar@2317
    30
	cd .. 
alpar@2317
    31
    else
alpar@2317
    32
	echo
alpar@2317
    33
	echo '***************************************************************'
alpar@2317
    34
	echo "  COMPILER $CXX CANNOT BE FOUND"
alpar@2317
    35
	echo '***************************************************************'
alpar@2317
    36
	echo
alpar@2317
    37
    fi
alpar@2317
    38
}
alpar@2317
    39
alpar@2317
    40
function check-compilers() {
alpar@2317
    41
cd trunk &&
alpar@2317
    42
autoreconf -vi &&
alpar@2317
    43
cd .. &&
alpar@2365
    44
ODIR=gcc-3.3 CXX=g++-3.3 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark --with-soplex=/usr/local/soplex &&
alpar@2365
    45
ODIR=gcc-3.4 CXX=g++-3.4 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark --with-soplex=/usr/local/soplex &&
alpar@2365
    46
ODIR=gcc-4.0 CXX=g++-4.0 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark --with-soplex=/usr/local/soplex &&
alpar@2365
    47
ODIR=gcc-4.1 CXX=g++-4.1 CXXFLAGS='-W -Wall -Werror' makecheck --enable-demo --enable-benchmark --with-soplex=/usr/local/soplex &&
alpar@2317
    48
# # ODIR=icc-8.0 CXX=icpc-8.0 CXXFLAGS='-Werror' makecheck --enable-demo --enable-benchmark &&
alpar@2317
    49
# ODIR=icc-9.0 CXX='icpc-9.0' CXXFLAGS='-Werror' makecheck --enable-demo --enable-benchmark &&
alpar@2317
    50
# ODIR=mingw CXX='g++' makecheck --with-msw --target=i586-mingw32msvc --host=i586-mingw32msvc --build=i386-linux --without-glpk &&
alpar@2317
    51
echo &&
alpar@2317
    52
echo '**********************************************************************' &&
alpar@2317
    53
echo '   REPOSITORY SEEMS OK' &&
alpar@2317
    54
echo '**********************************************************************' &&
alpar@2317
    55
echo
alpar@2317
    56
}
alpar@2317
    57
alpar@2317
    58
if [ $# -eq 0 ]; then
alpar@2317
    59
    echo 'Usage:'
alpar@2317
    60
    echo '   commit-checker --init'
alpar@2317
    61
    echo '   commit-checker revision'
alpar@2317
    62
    exit 1
alpar@2317
    63
elif [ $1 = '--init' ]; then
alpar@2317
    64
    rm -rf queue
alpar@2317
    65
    mkdir queue
alpar@2317
    66
    make-dir logs
alpar@2317
    67
    rm -rf trunk
alpar@2317
    68
    svn co https://lemon.cs.elte.hu/svn/hugo/trunk
alpar@2317
    69
    exit 0
alpar@2317
    70
fi
alpar@2317
    71
alpar@2317
    72
touch ${ROOT}/queue/$REV
alpar@2317
    73
alpar@2317
    74
while im-not-the-next; do
alpar@2317
    75
    sleep 10
alpar@2317
    76
done
alpar@2317
    77
alpar@2317
    78
# echo RUN $REV
alpar@2317
    79
alpar@2317
    80
svn up -r$REV trunk >${LOGFILE} 2>&1
alpar@2317
    81
alpar@2317
    82
AUTHOR=`svn info trunk|grep 'Last Changed Author:'|cut -d ' ' -f 4`
alpar@2317
    83
EMAIL=`awk '$1=="'${AUTHOR}'" {print $2}' <${ROOT}/e-mails`
alpar@2317
    84
alpar@2317
    85
echo '
alpar@2317
    86
alpar@2317
    87
*************************************************************
alpar@2317
    88
Check revision '${REV}' of '${AUTHOR}' ('${EMAIL}')
alpar@2317
    89
*************************************************************
alpar@2317
    90
alpar@2317
    91
'>>${LOGFILE} 2>&1
alpar@2317
    92
alpar@2317
    93
if check-compilers >>${LOGFILE} 2>&1
alpar@2317
    94
then
alpar@2317
    95
    echo -n
alpar@2317
    96
else
alpar@2317
    97
    echo 'Dear '${AUTHOR}',
alpar@2327
    98
Your svn commit -r'${REV}' made the repository broken, or at least
alpar@2327
    99
the compiler emits warnings during the build process.
alpar@2317
   100
The compilation log is attached.
alpar@2317
   101
Please fix the problem as soon as possible.
alpar@2317
   102
alpar@2317
   103
Best regards,
alpar@2317
   104
LEMON Commit Checking Service
alpar@2317
   105
'|
alpar@2319
   106
    mail -a ${LOGFILE} -s '[LEMON-SVN] WARNING: Revision '${REV}' is broken' \
alpar@2318
   107
	${EMAIL} alpar@cs.elte.hu
alpar@2318
   108
alpar@2327
   109
    echo 'Commit -r'${REV}' made the repository broken, or at least
alpar@2327
   110
the compiler emits warnings during the build process.
alpar@2318
   111
Do not update until this bug is fixed, unless you really need it.
alpar@2318
   112
alpar@2318
   113
Best regards,
alpar@2318
   114
LEMON Commit Checking Service
alpar@2318
   115
'|
alpar@2319
   116
    mail -s 'WARNING: Revision '${REV}' is broken' \
alpar@2318
   117
	${EMAIL} lemon-commits@lemon.cs.elte.hu
alpar@2317
   118
fi
alpar@2317
   119
    
alpar@2317
   120
#    rm ${LOGFILE}
alpar@2317
   121
rm ${ROOT}/queue/$REV
alpar@2317
   122