forked from adam-stokes/deprecated-matahari-bm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autobuild.sh
executable file
·145 lines (113 loc) · 4.49 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
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
#
# Copyright (C) 2008 Andrew Beekhof
# Copyrigh (C) 2011, Russell Bryant <rbryant@redhat.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
set -x
PACKAGE=matahari
VERSION=`cat .version`
FEDORA=`rpm --eval %{fedora}`
MOCK=/usr/bin/mock
: ${AUTO_BUILD_COUNTER:="custom"}
: ${AUTOBUILD_SOURCE_ROOT:=`pwd`}
: ${AUTOBUILD_INSTALL_ROOT:=`pwd`}
: ${AUTOBUILD_PACKAGE_ROOT:=`pwd`}
function make_srpm() {
VARIANT=$1
PACKAGE=matahari
TAG=`git show --pretty="format:%h" --abbrev-commit | head -n 1`
TARPREFIX=${PACKAGE}-${PACKAGE}-${TAG}
TARFILE=${TARPREFIX}.tgz
make ${VARIANT}matahari.spec VARIANT=${VARIANT}
rm -f ${TARFILE}
git archive --prefix=${TARPREFIX}/ ${TAG} | gzip > ${TARFILE}
echo `date`: Rebuilt ${TARFILE} from ${TAG}
rm -f *.src.rpm
rpmbuild -bs --define "_sourcedir ${PWD}" \
--define "_specdir ${PWD}" \
--define "_srcrpmdir ${PWD}" ${VARIANT}matahari.spec
}
check_result() {
RC=$1
RESULTS=$2
PLATFORM=$3
STEP=$4
if [ ${RC} != 0 ]; then
cat $results/build.log
echo "=::=::=::= ${PLATFORM} Build Failed (${STEP}) =::=::=::= "
echo "=::=::=::= `date` =::=::=::= "
exit ${RC}
fi
}
env
build_target=`rpm --eval fedora-%{fedora}-%{_arch}`
#build_target=`rpm --eval fedora-rawhide-%{_arch}`
echo "=::=::=::= `date` =::=::=::= "
echo "=::=::=::= Beginning Linux Build =::=::=::= "
make_srpm
results=$AUTOBUILD_PACKAGE_ROOT/rpm/RPMS/`rpm --eval %{_arch}`
rm -f $results/build.log $results/*.rpm
${MOCK} -v --root=$build_target --resultdir=$results --init
${MOCK} -v --root=$build_target --resultdir=$results \
--define="run_unit_tests 1" --no-clean --no-cleanup-after \
--rebuild ${PWD}/*.src.rpm
check_result $? ${results} "Linux" "build"
if [ "${FEDORA}" = "16" ] ; then
${MOCK} -v --root=$build_target --resultdir=$results \
--install $(ls $results/*.rpm | grep -v vios-proxy)
check_result $? ${results} "Linux" "install"
else
${MOCK} -v --root=$build_target --resultdir=$results \
--install $results/*.rpm
check_result $? ${results} "Linux" "install"
fi
. src/tests/deps.sh
${MOCK} -v --root=$build_target --resultdir=$results \
--install ${MH_TESTS_DEPS}
check_result $? ${results} "Linux" "install test deps"
${MOCK} -v --root=$build_target --resultdir=$results \
--copyin src/tests /matahari-tests
check_result $? ${results} "Linux" "copy in tests"
${MOCK} -v --root=$build_target --resultdir=$results \
--shell "nosetests -v /matahari-tests/test_host_api.py"
check_result $? ${results} "Linux" "Host API tests"
${MOCK} -v --root=$build_target --resultdir=$results \
--shell "nosetests -v /matahari-tests/test_sysconfig_api.py"
check_result $? ${results} "Linux" "Sysconfig API tests"
${MOCK} -v --root=$build_target --resultdir=$results \
--shell "nosetests -v /matahari-tests/test_resource_api.py"
check_result $? ${results} "Linux" "Resources API tests"
${MOCK} -v --root=$build_target --resultdir=$results \
--shell "nosetests -v /matahari-tests/test_service_api_minimal.py"
check_result $? ${results} "Linux" "Services API tests"
${MOCK} -v --root=$build_target --resultdir=$results \
--shell "nosetests -v /matahari-tests/test_network_api_minimal.py"
check_result $? ${results} "Linux" "Network API tests"
# Packages get copied to:
# /home/builder/matahari/public_html/dist/rpm/
ls $results
# Disabled windows builds for now. The mingw toolchain is busted.
exit 0
echo "=::=::=::= `date` =::=::=::= "
echo "=::=::=::= Beginning Windows Build =::=::=::= "
build_target=`rpm --eval fedora-%{fedora}-%{_arch}`
#build_target=`rpm --eval fedora-rawhide-%{_arch}`
make_srpm mingw32-
results=$AUTOBUILD_PACKAGE_ROOT/rpm/RPMS/noarch
rm -f $results/build.log $results/*.rpm
/usr/bin/mock --root=$build_target --resultdir=$results --rebuild ${PWD}/*.src.rpm
check_result $? $results "Windows" "build"