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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
#!/bin/bash
# Set defaults
if test x"${debug}" = x"true"; then
export CONFIG_SHELL="/bin/bash -x"
else
export CONFIG_SHELL="/bin/bash"
fi
target=""
tarsrc=""
tarbin=""
check=""
ref="snapshots-ref"
nocheck="no"
fileserver="148.251.136.42"
extra=
user_workspace="${WORKSPACE:-/home/${USER:-buildslave}/workspace}"
OPTS="`getopt -o e:r:t:f:d:bs:w:nh -l target:,ref:,date:,fileserver:,tarbin:,tarsrc:,workspace:,extra:,help`"
while test $# -gt 0; do
echo 1 = "$1"
case $1 in
-w|--workspace) user_workspace=$2 ;;
-s|--tarsrc) tarsrc=yes ;;
-b|--tarbin) tarbin=yes ;;
-t|--target) target=$2 ;;
-d|--date) date=$2 ;;
-r|--ref) ref=$2 ;;
-e|--extra) extra=$2 ;;
-f|--fileserver) fileserver=$2 ;;
-n|--nocheck) nocheck=yes ;;
-h|--help) usage ;;
--) break ;;
esac
shift
done
if test x"${target}" != x"native" -a x"${target}" != x; then
platform="--target ${target}"
fi
shared="/home/buildslave/workspace/shared/"
abe_dir="$(dirname $0)/.."
user_snapshots="${user_workspace}/snapshots"
if test -e ${user_workspace}; then
cat << EOF > ${user_workspace}/BUILD-INFO.txt
Format-Version: 0.5
Files-Pattern: *
License-Type: open
EOF
fi
# Create a build directory
if test ! -d ${user_workspace}/_build; then
mkdir -p ${user_workspace}/_build
else
rm -fr ${user_workspace}/_build/* ${user_workspace}/_build/sysroots/*
fi
# By default, always update all sources
update=""
if test x"${extra}" != x; then
extra="--extraconfigdir ${extra}"
fi
if test x"${runtests}" = xtrue; then
chroot="--enable-schroot-test"
fi
guess="`${abe_dir}/config.guess`"
machine="`gcc -dumpmachine`"
if test x"${guess}" != x"${machine}"; then
arch="`echo ${machine} | cut -d '-' -f 1`"
CONFIG_SHELL="setarch ${arch} ${CONFIG_SHELL}"
fi
# Use the newly created build directory
cd ${user_workspace}/_build
if ! test -e host.conf; then
$CONFIG_SHELL ${abe_dir}/configure ${chroot} --with-local-snapshots=${user_snapshots} \
--with-git-reference-dir=${shared}/snapshots --with-fileserver=${fileserver} --with-remote-snapshots=${ref}
fi
if test x"${runtests}" = xtrue; then
chroot="--enable-schroot-test"
check="--check all"
else
check=""
fi
if test x"${date}" != x; then
release="${date}"
fi
if test "`echo ${target} | grep -c linux`" -gt 0; then
if test "`echo ${gcc_src} | grep -c -- '-[56][[:digit:]\.]*'`" -gt 0; then
libc="--set libc=glibc"
else
libc="--set libc=eglibc"
fi
else
# ELF and EABI based targets are bare metal only
libc="--set libc=newlib"
fi
binutils=${binutils_src:+binutils=${binutils_src}}
gcc=${gcc_src:+gcc=${gcc_src}}
# Build a toolchain, run the tests, and the create a source release as a tarball
if test x"${tarsrc}" = x"yes"; then
$CONFIG_SHELL ${abe_dir}/abe.sh --release ${release} ${extra} \
--tarsrc ${check} ${gcc} ${binutils} ${platform} -build all ${libc}
fi
# Build a binary release tarball, then run the tests on the installed binaries
if test x"${tarbin}" = x"yes"; then
# Canadian cross builds require a Linux hosted cross compiler first
if test x"${canadian}" = x"true"; then
$CONFIG_SHELL ${abe_dir}/abe.sh ${update} --release ${release} ${check} ${gcc} ${binutils} ${platform} --build all ${libc} ${extra}
host="--host i686-w64-mingw32"
rm -fr ${local_builds}/${host}/${target}/
# update="--disable update"
else
host=""
fi
$CONFIG_SHELL ${abe_dir}/abe.sh ${update} --release ${release} --tarbin ${check} ${gcc} ${binutils} ${platform} ${host} --build all ${libc} ${extra}
fi
# force a failure if abe has build problems.
if test $? -gt 0; then
exit 1
fi
# If not running the testsuites, just exit.
if test x"${nocheck}" = xyes; then
exit 0
fi
# Copy the source build test results and tarballs to the fileserver
bases="/work/abe/baselines/${release}/${target}"
snaps="/home/abe/var/snapshots/"
if test x"${tarsrc}" = x"yes"; then
manifest="`find ${user_workspace} -name \*manifest.txt`"
scp ${manifest} ${fileserver}:${bases}/
if test x"${check}" != x; then
sums="`find ${user_workspace} -name \*.sum`"
logs="`find ${user_workspace} -name \*.log`"
if test x"${sums}" != x; then
ssh ${fileserver} "mkdir -p ${bases}"
xz ${sums} ${logs}
sums="`echo ${sums} | sed -e 's/\.sum/\.sum.xz/g'`"
logs="`echo ${logs} | sed -e 's/\.log/\.log.xz/g'`"
scp ${sums} ${logs} ${fileserver}:${bases}/
else
echo "ERROR: No test results were found!"
fi
fi
tarballs="`find ${user_snapshots} -name \*${release}\*.xz -o -name \*${release}\*.asc`"
if test x"${tarballs}" != x; then
scp ${tarballs} ${fileserver}:${snaps}/
if test $? -gt 0; then
echo "ERROR: Couldn't copy files to ${fileserver}!"
exit 1
fi
else
echo "ERROR: No source tarballs were found!"
fi
fi
# Copy the binary test results to the fileserver
binaries="/work/space/binaries/${release}/${target}"
if test x"${tarbin}" = xyes; then
manifest="`find ${user_workspace} -name \*manifest.txt`"
ssh ${fileserver} "if test ! -d ${binaries}; then mkdir -p ${binaries}; fi"
scp ${manifest} ${fileserver}:${binaries}/
tarballs="`find ${user_snapshots} -name \*${release}\*.xz -o -name \*${release}\*.asc`"
scp ${tarballs} ${fileserver}:${binaries}/
if test x"${check}" != x; then
sums="`find ${user_workspace} -name \*.sum`"
logs="`find ${user_workspace} -name \*.log`"
if test x"${sums}" != x; then
xz ${sums} ${logs}
sums="`echo ${sums} | sed -e 's/\.sum/\.sum.xz/g'`"
logs="`echo ${logs} | sed -e 's/\.log/\.log.xz/g'`"
ssh ${fileserver} "mkdir -p ${binaries}/"
scp ${sums} ${logs} ${fileserver}:${binaries}/
else
echo "ERROR: No test results were found!"
fi
# Diff the two directories
scp ${abe_dir}/tcwgweb.sh ${fileserver}:/tmp/tcwgweb$$.sh
out="`ssh ${fileserver} "if test -e ${bases}; then echo YES; else echo NO; fi"`"
if test x"${out}" = x"YES"; then
out="`ssh ${fileserver} /tmp/tcwgweb$$.sh --email --tdir ${bases} ${binaries}`"
if test "`echo ${out} | grep -c REGRESSIONS`"; then
exit 1
fi
fi
fi
fi
exit 0
|