]> git.ozlabs.org Git - next-scripts/blob - do_build
do_build: quieten the .config creations
[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=$(dirname "$0")
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                 b=\$(basename \$log)
63                 if [ -f $obdir/\$b ]; then
64                         if [ \$(wc -l <$obdir/\$b) -lt \$(wc -l <\$log) ]; then
65                                 echo "\$sep"
66                                 echo " log \$b increased number of lines"
67                                 echo "\$sep"
68                                 pushover "linux-next log got bigger"
69                                 diff -u $obdir/\$b \$log 2>&1 | less
70                         fi
71                 fi
72                 mv \$log $obdir/\$b
73         }
74
75         echo Building: x86_64 allmodconfig
76         d="$bparent/x86_64_allmodconfig"
77         [ -d \$d ] || mkdir \$d || exit 1
78         log_x86=\$d.log
79         e=\$d.except
80         echo CONFIG_BUILD_DOCSRC=n >\$e || exit 1
81         echo CONFIG_MODULES=y >>\$e || exit 1
82         KCONFIG_ALLCONFIG=\$e cross -n -N -a x86_64 -c "$gcc_version" O=\$d -s allmodconfig || exit 1
83         echo "Forking x86 build ..."
84         /usr/bin/time cross -n -N -a x86_64 -c "$gcc_version" O=\$d -j"$j_factor" -s > \$log_x86 2>&1 &
85         x86_64_pid=\$!
86
87         echo Building: powerpc ppc64_defconfig
88         d="$bparent/powerpc_ppc64_defconfig"
89         [ -d \$d ] || mkdir \$d || exit 1
90         log_ppc=\$d.log
91         cross -n -N -a powerpc64 -k powerpc -c "$gcc_ppc_version" O=\$d -s ppc64_defconfig || exit 1
92         echo "Forking powerpc build ..."
93         /usr/bin/time cross -n -N -a powerpc64 -k powerpc -c "$gcc_ppc_version" O=\$d -j"$j_factor" -s > \$log_ppc 2>&1 &
94         ppc64_pid=\$!
95
96         echo Building: arm multi_v7_defconfig
97         d="$bparent/arm_multi_v7_defconfig"
98         [ -d \$d ] || mkdir \$d || exit 1
99         log_arm=\$d.log
100         cross -n -N -a arm -c "$gcc_version" O=\$d -s multi_v7_defconfig || exit 1
101         echo "Forking arm build ..."
102         /usr/bin/time cross -n -N -a arm -c "$gcc_version" O=\$d -j"$j_factor" -s > \$log_arm 2>&1 &
103         arm_pid=\$!
104
105         echo Building: perf
106         d="$bparent/perf"
107         [ -d \$d ] || mkdir \$d || exit 1
108         log_perf=\$d.log
109         echo "Forking perf build ..."
110         /usr/bin/time make -s -C tools/perf JOBS="$j_factor" O=\$d > \$log_perf 2>&1 &
111         perf_pid=\$!
112
113         wait \$perf_pid
114         rc=\$?
115
116         if [ \$rc -ne 0 ]; then
117                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
118                 echo "ERROR: perf build failed - log follows"
119                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
120                 cat \$log_perf
121                 kill \$x86_64_pid
122                 kill \$ppc64_pid
123                 kill \$arm_pid
124                 killall make
125                 rm .scmversion
126                 exit 1
127         else
128                 show_log native perf \$log_perf
129         fi
130
131         wait \$arm_pid
132         rc=\$?
133
134         if [ \$rc -ne 0 ]; then
135                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
136                 echo "ERROR: arm multi_v7_defconfig build failed - log follows"
137                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
138                 cat \$log_arm
139                 kill \$x86_64_pid
140                 kill \$ppd64_pid
141                 killall make
142                 rm .scmversion
143                 exit 1
144         else
145                 show_log arm multi_v7_defconfig \$log_arm
146         fi
147
148         wait \$ppc64_pid
149         rc=\$?
150
151         if [ \$rc -ne 0 ]; then
152                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
153                 echo "ERROR: powerpc ppc64_defconfig build failed - log follows"
154                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
155                 cat \$log_ppc
156                 kill \$x86_64_pid
157                 killall make
158                 rm .scmversion
159                 exit 1
160         else
161                 show_log powerpc ppc64_defconfig \$log_ppc
162         fi
163
164         wait \$x86_64_pid
165         rc=\$?
166
167         if [ \$rc -ne 0 ]; then
168                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
169                 echo "ERROR: x86_64 allmodconfig build failed - log follows"
170                 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
171                 cat \$log_x86
172                 rm .scmversion
173                 exit 1
174         else
175                 show_log x86_64 allmodconfig \$log_x86
176         fi
177
178         rm .scmversion
179 EOF