]> git.ozlabs.org Git - next-scripts/blob - do_build
sanitise the log fiels a bit before comparing them to old ones
[next-scripts] / do_build
1 #!/bin/sh
2
3 tree=
4 if [ "$1" ]; then
5         tree=$1
6         shift
7 fi
8
9 tools_dir=$(cd $(dirname "$0"); pwd)
10 . "$tools_dir/common.sh"
11
12 set -e
13
14 bparent=$(dirname "$build_dir")
15
16 line="$(tail -n 1 $SHA1_FILE)"
17
18 # strip everything after the first tab character
19 stree=${line%%  *}
20 if [ "$tree" ]; then
21         [ "$tree" = "$stree" ] || {
22                 echo "That is not the last tree merged ($tree v $stree)" 1>&2
23                 exit 1
24         }
25 else
26         tree="$stree"
27 fi
28 obdir="$bparent/old/$tree"
29
30 cmd="/bin/sh"
31 [ "$build_host" ] &&
32         cmd="ssh root@$build_host unshare -n su $(id -u -n)"
33
34 $cmd <<-EOF
35
36         echo Building on \$(hostname)
37
38         echo \$PATH | grep -q "\$HOME/bin" || export PATH="\$HOME/bin:\$PATH"
39         export LANG=C
40
41         cd "$build_dir" || exit 1
42
43         export CCACHE_DIR="$bparent/.ccache"
44         export TMPDIR="$bparent/tmp"
45
46         git reset --hard next || exit 1
47         touch .scmversion || exit 1
48
49         [ -d "$obdir" ] || mkdir -p "$obdir" || exit 1
50
51         show_log() {
52                 arch=\$1
53                 conf=\$2
54                 log=\$3
55
56                 sep='======================================================================'
57
58                 echo "\$sep"
59                 echo " \$arch \$conf build OK - log follows"
60                 echo "\$sep"
61                 cat \$log
62                 $tools_dir/sanitise_log \$log >\$log.san
63                 mv -f \$log.san \$log
64                 b=\$(basename \$log)
65                 if [ -f $obdir/\$b ]; then
66                         if [ \$(wc -l <$obdir/\$b) -lt \$(grep -v -x -F -f $bparent/log-ignore <\$log | wc -l) ]; then
67                                 echo "\$sep"
68                                 echo " log \$b increased number of lines"
69                                 echo "\$sep"
70                                 pushover "linux-next log got bigger"
71                                 diff -u $obdir/\$b \$log 2>&1 | less
72                         fi
73                 fi
74                 mv \$log $obdir/\$b
75         }
76
77         echo Building: x86_64 allmodconfig
78         d="$bparent/x86_64_allmodconfig"
79         [ -d \$d ] || mkdir \$d || exit 1
80         log_x86=\$d.log
81         e=\$d.except
82         echo CONFIG_BUILD_DOCSRC=n >\$e || exit 1
83         echo CONFIG_MODULES=y >>\$e || exit 1
84         KCONFIG_ALLCONFIG=\$e cross -n -N -a x86_64 -c "$gcc_version" O=\$d -s allmodconfig || exit 1
85         echo "Forking x86 build ..."
86         /usr/bin/time cross -n -N -a x86_64 -c "$gcc_version" O=\$d -j"$j_factor" -s > \$log_x86 2>&1 &
87         x86_64_pid=\$!
88
89         echo Building: powerpc ppc64_defconfig
90         d="$bparent/powerpc_ppc64_defconfig"
91         [ -d \$d ] || mkdir \$d || exit 1
92         log_ppc=\$d.log
93         cross -n -N -a powerpc64 -k powerpc -c "$gcc_ppc_version" O=\$d -s ppc64_defconfig || exit 1
94         echo "Forking powerpc build ..."
95         /usr/bin/time cross -n -N -a powerpc64 -k powerpc -c "$gcc_ppc_version" O=\$d -j"$j_factor" -s > \$log_ppc 2>&1 &
96         ppc64_pid=\$!
97
98         echo Building: arm multi_v7_defconfig
99         d="$bparent/arm_multi_v7_defconfig"
100         [ -d \$d ] || mkdir \$d || exit 1
101         log_arm=\$d.log
102         cross -n -N -a arm -c "$gcc_version" O=\$d -s multi_v7_defconfig || exit 1
103         echo "Forking arm build ..."
104         /usr/bin/time cross -n -N -a arm -c "$gcc_version" O=\$d -j"$j_factor" -s > \$log_arm 2>&1 &
105         arm_pid=\$!
106
107         echo Building: perf
108         d="$bparent/perf"
109         [ -d \$d ] || mkdir \$d || exit 1
110         log_perf=\$d.log
111         echo "Forking perf build ..."
112         /usr/bin/time make -s -C tools/perf JOBS="$j_factor" O=\$d > \$log_perf 2>&1 &
113         perf_pid=\$!
114
115         wait \$perf_pid
116         rc=\$?
117
118         if [ \$rc -ne 0 ]; then
119                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
120                 echo "ERROR: perf build failed - log follows"
121                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
122                 cat \$log_perf
123                 kill \$x86_64_pid
124                 kill \$ppc64_pid
125                 kill \$arm_pid
126                 killall make
127                 rm .scmversion
128                 exit 1
129         else
130                 show_log native perf \$log_perf
131         fi
132
133         wait \$arm_pid
134         rc=\$?
135
136         if [ \$rc -ne 0 ]; then
137                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
138                 echo "ERROR: arm multi_v7_defconfig build failed - log follows"
139                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
140                 cat \$log_arm
141                 kill \$x86_64_pid
142                 kill \$ppd64_pid
143                 killall make
144                 rm .scmversion
145                 exit 1
146         else
147                 show_log arm multi_v7_defconfig \$log_arm
148         fi
149
150         wait \$ppc64_pid
151         rc=\$?
152
153         if [ \$rc -ne 0 ]; then
154                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
155                 echo "ERROR: powerpc ppc64_defconfig build failed - log follows"
156                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
157                 cat \$log_ppc
158                 kill \$x86_64_pid
159                 killall make
160                 rm .scmversion
161                 exit 1
162         else
163                 show_log powerpc ppc64_defconfig \$log_ppc
164         fi
165
166         wait \$x86_64_pid
167         rc=\$?
168
169         if [ \$rc -ne 0 ]; then
170                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
171                 echo "ERROR: x86_64 allmodconfig build failed - log follows"
172                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
173                 cat \$log_x86
174                 rm .scmversion
175                 exit 1
176         else
177                 show_log x86_64 allmodconfig \$log_x86
178         fi
179
180         rm .scmversion
181 EOF