-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautobuild.sh
executable file
·134 lines (115 loc) · 2.33 KB
/
autobuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/sh
#
# This script is called by buildbot to test
# corosync. It is run continously to help catch regressions.
#
# ENVIRONMENT variables that affect it's behaviour:
#
# TEST_NODES - the hostnames of the nodes to be tested
# TARGET - this is used by mock so look in /etc/mock for
# possible options.
# COROSYNC_DIR path to corosync dir
# COROSYNC_CTS_DIR path to corosync-flatiron-cts dir
#
LOG="echo CTS: "
# required packages
which mock >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo 'please install mock (yum install mock).'
exit 1
fi
MOCK=/usr/bin/mock
if [ -z "$TARGET" ]
then
TARGET=rhel-6-x86_64-core
fi
RPM_DIR=/var/lib/mock/$TARGET/result
if [ ! -d $RPM_DIR ]
then
$MOCK -v -r $TARGET --init
else
rm -f $RPM_DIR/corosync*.rpm
fi
if [ -z "$COROSYNC_CTS_DIR" ]
then
COROSYNC_CTS_DIR=$(pwd)/../corosync-flatiron-cts
fi
if [ -z "$COROSYNC_DIR" ]
then
COROSYNC_DIR=$(pwd)
fi
echo COROSYNC_CTS_DIR is $COROSYNC_CTS_DIR
echo COROSYNC_DIR is $COROSYNC_DIR
if [ ! -d $COROSYNC_CTS_DIR ]
then
git clone git://corosync.org/corosync-flatiron-cts.git $COROSYNC_CTS_DIR
cd $COROSYNC_CTS_DIR
else
cd $COROSYNC_CTS_DIR
git checkout -f
git clean -dfx
git pull
fi
cd -
set -e
for d in $COROSYNC_DIR $COROSYNC_CTS_DIR
do
cd $d
$LOG "in dir $d"
git clean -dfx
$LOG 'running autogen ...'
./autogen.sh
$LOG 'running configure ...'
./configure
$LOG 'building source rpm'
rm -f *.src.rpm
make srpm
SRPM=$(ls *src.rpm)
if [ ! -f $SRPM ]
then
$LOG no source rpm to build from!
exit 1
fi
$LOG "running mock rebuild ($SRPM)"
$MOCK -v --no-clean -r $TARGET --rebuild $SRPM
cd -
done
if [ -z "$TEST_NODES" ]
then
$LOG no test nodes, exiting without running cts.
exit 0
else
# start the VMs, or leave them running?
true
fi
RPM_LIST=
for r in $RPM_DIR/corosync*.rpm
do
case $r in
*src.rpm)
;;
*-devel-*)
;;
*)
RPM_LIST="$RPM_LIST $r"
;;
esac
done
$LOG installing $RPM_LIST
$LOG onto the test nodes $TEST_NODES
# load and install rpm(s) onto the nodes
for n in $TEST_NODES
do
$LOG "Installing onto $n"
ssh $n "rm -rf /tmp/corosync*.rpm"
scp $RPM_LIST $n:/tmp/
ssh $n "rpm --nodeps --force -Uvf /tmp/corosync*.rpm"
done
cd $COROSYNC_CTS_DIR
$LOG 'running CTS ...'
CTS_LOG=$(pwd)/cts.log
rm -f $CTS_LOG
cd cts
# needs sudo to read /var/log/messages
sudo -n ./corolab.py --nodes "$TEST_NODES" --outputfile $CTS_LOG