Print this page
4522 the build doesn't fail nearly often enough
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Jens Elkner <jel+illumos@cs.uni-magdeburg.de>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/scripts/nightly.sh
+++ new/usr/src/tools/scripts/nightly.sh
1 1 #!/bin/ksh -p
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 24 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 25 # Copyright 2008, 2010, Richard Lowe
26 26 # Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27 27 # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
28 28 #
29 29 # Based on the nightly script from the integration folks,
30 30 # Mostly modified and owned by mike_s.
31 31 # Changes also by kjc, dmk.
32 32 #
33 33 # BRINGOVER_WS may be specified in the env file.
34 34 # The default is the old behavior of CLONE_WS
35 35 #
36 36 # -i on the command line, means fast options, so when it's on the
37 37 # command line (only), lint and check builds are skipped no matter what
38 38 # the setting of their individual flags are in NIGHTLY_OPTIONS.
39 39 #
40 40 # LINTDIRS can be set in the env file, format is a list of:
41 41 #
42 42 # /dirname-to-run-lint-on flag
43 43 #
44 44 # Where flag is: y - enable lint noise diff output
45 45 # n - disable lint noise diff output
46 46 #
47 47 # For example: LINTDIRS="$SRC/uts n $SRC/stand y $SRC/psm y"
48 48 #
49 49 # OPTHOME may be set in the environment to override /opt
50 50 #
51 51
52 52 #
53 53 # The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
54 54 # under certain circumstances, which can really screw things up; unset it.
55 55 #
56 56 unset CDPATH
57 57
58 58 # Get the absolute path of the nightly script that the user invoked. This
59 59 # may be a relative path, and we need to do this before changing directory.
60 60 nightly_path=`whence $0`
61 61
62 62 #
63 63 # Keep track of where we found nightly so we can invoke the matching
64 64 # which_scm script. If that doesn't work, don't go guessing, just rely
65 65 # on the $PATH settings, which will generally give us either /opt/onbld
66 66 # or the user's workspace.
67 67 #
68 68 WHICH_SCM=$(dirname $nightly_path)/which_scm
69 69 if [[ ! -x $WHICH_SCM ]]; then
70 70 WHICH_SCM=which_scm
71 71 fi
72 72
73 73 function fatal_error
74 74 {
75 75 print -u2 "nightly: $*"
76 76 exit 1
77 77 }
78 78
79 79 #
80 80 # Function to do a DEBUG and non-DEBUG build. Needed because we might
81 81 # need to do another for the source build, and since we only deliver DEBUG or
82 82 # non-DEBUG packages.
83 83 #
84 84 # usage: normal_build
85 85 #
86 86 function normal_build {
87 87
88 88 typeset orig_p_FLAG="$p_FLAG"
89 89 typeset crypto_signer="$CODESIGN_USER"
90 90
91 91 suffix=""
92 92
93 93 # non-DEBUG build begins
94 94
95 95 if [ "$F_FLAG" = "n" ]; then
96 96 set_non_debug_build_flags
97 97 CODESIGN_USER="$crypto_signer" \
98 98 build "non-DEBUG" "$suffix-nd" "-nd" "$MULTI_PROTO"
99 99 else
100 100 echo "\n==== No non-DEBUG $open_only build ====\n" >> "$LOGFILE"
101 101 fi
102 102
103 103 # non-DEBUG build ends
104 104
105 105 # DEBUG build begins
106 106
107 107 if [ "$D_FLAG" = "y" ]; then
108 108 set_debug_build_flags
109 109 CODESIGN_USER="$crypto_signer" \
110 110 build "DEBUG" "$suffix" "" "$MULTI_PROTO"
111 111 else
112 112 echo "\n==== No DEBUG $open_only build ====\n" >> "$LOGFILE"
113 113 fi
114 114
115 115 # DEBUG build ends
116 116
117 117 p_FLAG="$orig_p_FLAG"
118 118 }
119 119
120 120 #
121 121 # usage: run_hook HOOKNAME ARGS...
122 122 #
123 123 # If variable "$HOOKNAME" is defined, insert a section header into
124 124 # our logs and then run the command with ARGS
125 125 #
126 126 function run_hook {
127 127 HOOKNAME=$1
128 128 eval HOOKCMD=\$$HOOKNAME
129 129 shift
130 130
131 131 if [ -n "$HOOKCMD" ]; then
132 132 (
133 133 echo "\n==== Running $HOOKNAME command: $HOOKCMD ====\n"
134 134 ( $HOOKCMD "$@" 2>&1 )
135 135 if [ "$?" -ne 0 ]; then
136 136 # Let exit status propagate up
137 137 touch $TMPDIR/abort
138 138 fi
139 139 ) | tee -a $mail_msg_file >> $LOGFILE
140 140
141 141 if [ -f $TMPDIR/abort ]; then
142 142 build_ok=n
143 143 echo "\nAborting at request of $HOOKNAME" |
144 144 tee -a $mail_msg_file >> $LOGFILE
145 145 exit 1
146 146 fi
147 147 fi
148 148 }
149 149
150 150 # Return library search directive as function of given root.
151 151 function myldlibs {
152 152 echo "-L$1/lib -L$1/usr/lib"
153 153 }
154 154
155 155 # Return header search directive as function of given root.
156 156 function myheaders {
157 157 echo "-I$1/usr/include"
158 158 }
159 159
160 160 #
161 161 # Function to do the build, including package generation.
162 162 # usage: build LABEL SUFFIX ND MULTIPROTO
163 163 # - LABEL is used to tag build output.
164 164 # - SUFFIX is used to distinguish files (e.g., DEBUG vs non-DEBUG,
165 165 # open-only vs full tree).
166 166 # - ND is "-nd" (non-DEBUG builds) or "" (DEBUG builds).
167 167 # - If MULTIPROTO is "yes", it means to name the proto area according to
168 168 # SUFFIX. Otherwise ("no"), (re)use the standard proto area.
169 169 #
170 170 function build {
171 171 LABEL=$1
172 172 SUFFIX=$2
173 173 ND=$3
174 174 MULTIPROTO=$4
175 175 INSTALLOG=install${SUFFIX}-${MACH}
176 176 NOISE=noise${SUFFIX}-${MACH}
177 177 PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX}
178 178
179 179 ORIGROOT=$ROOT
180 180 [ $MULTIPROTO = no ] || export ROOT=$ROOT$SUFFIX
181 181
182 182 export ENVLDLIBS1=`myldlibs $ROOT`
183 183 export ENVCPPFLAGS1=`myheaders $ROOT`
184 184
185 185 this_build_ok=y
186 186 #
187 187 # Build OS-Networking source
188 188 #
189 189 echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \
190 190 >> $LOGFILE
191 191
↓ open down ↓ |
191 lines elided |
↑ open up ↑ |
192 192 rm -f $SRC/${INSTALLOG}.out
193 193 cd $SRC
194 194 /bin/time $MAKE -e install 2>&1 | \
195 195 tee -a $SRC/${INSTALLOG}.out >> $LOGFILE
196 196
197 197 echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file
198 198 egrep ":" $SRC/${INSTALLOG}.out |
199 199 egrep -e "(^${MAKE}:|[ ]error[: \n])" | \
200 200 egrep -v "Ignoring unknown host" | \
201 201 egrep -v "cc .* -o error " | \
202 - egrep -v "warning" >> $mail_msg_file
203 - if [ "$?" = "0" ]; then
202 + egrep -v "warning" | tee $TMPDIR/build_errs${SUFFIX} \
203 + >> $mail_msg_file
204 + if [[ -s $TMPDIR/build_errs${SUFFIX} ]]; then
204 205 build_ok=n
205 206 this_build_ok=n
206 207 fi
207 208 grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \
208 209 >> $mail_msg_file
209 210 if [ "$?" = "0" ]; then
210 211 build_ok=n
211 212 this_build_ok=n
212 213 fi
213 214
214 215 echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file
215 216 egrep -i warning: $SRC/${INSTALLOG}.out \
216 217 | egrep -v '^tic:' \
217 218 | egrep -v "symbol (\`|')timezone' has differing types:" \
218 219 | egrep -v "parameter <PSTAMP> set to" \
219 220 | egrep -v "Ignoring unknown host" \
220 221 | egrep -v "redefining segment flags attribute for" \
221 - >> $mail_msg_file
222 + | tee $TMPDIR/build_warnings${SUFFIX} >> $mail_msg_file
223 + if [[ -s $TMPDIR/build_warnings${SUFFIX} ]]; then
224 + build_ok=n
225 + this_build_ok=n
226 + fi
222 227
223 228 echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \
224 229 >> $LOGFILE
225 230
226 231 echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file
227 232 tail -3 $SRC/${INSTALLOG}.out >>$mail_msg_file
228 233
229 234 if [ "$i_FLAG" = "n" ]; then
230 235 rm -f $SRC/${NOISE}.ref
231 236 if [ -f $SRC/${NOISE}.out ]; then
232 237 mv $SRC/${NOISE}.out $SRC/${NOISE}.ref
233 238 fi
234 239 grep : $SRC/${INSTALLOG}.out \
235 240 | egrep -v '^/' \
236 241 | egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \
237 242 | egrep -v '^tic:' \
238 243 | egrep -v '^mcs' \
239 244 | egrep -v '^LD_LIBRARY_PATH=' \
240 245 | egrep -v 'ar: creating' \
241 246 | egrep -v 'ar: writing' \
242 247 | egrep -v 'conflicts:' \
243 248 | egrep -v ':saved created' \
244 249 | egrep -v '^stty.*c:' \
245 250 | egrep -v '^mfgname.c:' \
246 251 | egrep -v '^uname-i.c:' \
247 252 | egrep -v '^volumes.c:' \
248 253 | egrep -v '^lint library construction:' \
249 254 | egrep -v 'tsort: INFORM:' \
250 255 | egrep -v 'stripalign:' \
251 256 | egrep -v 'chars, width' \
252 257 | egrep -v "symbol (\`|')timezone' has differing types:" \
253 258 | egrep -v 'PSTAMP' \
254 259 | egrep -v '|%WHOANDWHERE%|' \
255 260 | egrep -v '^Manifying' \
256 261 | egrep -v 'Ignoring unknown host' \
257 262 | egrep -v 'Processing method:' \
258 263 | egrep -v '^Writing' \
259 264 | egrep -v 'spellin1:' \
260 265 | egrep -v '^adding:' \
261 266 | egrep -v "^echo 'msgid" \
262 267 | egrep -v '^echo ' \
263 268 | egrep -v '\.c:$' \
264 269 | egrep -v '^Adding file:' \
265 270 | egrep -v 'CLASSPATH=' \
266 271 | egrep -v '\/var\/mail\/:saved' \
267 272 | egrep -v -- '-DUTS_VERSION=' \
268 273 | egrep -v '^Running Mkbootstrap' \
269 274 | egrep -v '^Applet length read:' \
270 275 | egrep -v 'bytes written:' \
271 276 | egrep -v '^File:SolarisAuthApplet.bin' \
272 277 | egrep -v -i 'jibversion' \
273 278 | egrep -v '^Output size:' \
274 279 | egrep -v '^Solo size statistics:' \
275 280 | egrep -v '^Using ROM API Version' \
276 281 | egrep -v '^Zero Signature length:' \
277 282 | egrep -v '^Note \(probably harmless\):' \
278 283 | egrep -v '::' \
279 284 | egrep -v -- '-xcache' \
280 285 | egrep -v '^\+' \
281 286 | egrep -v '^cc1: note: -fwritable-strings' \
282 287 | egrep -v 'svccfg-native -s svc:/' \
283 288 | sort | uniq >$SRC/${NOISE}.out
284 289 if [ ! -f $SRC/${NOISE}.ref ]; then
285 290 cp $SRC/${NOISE}.out $SRC/${NOISE}.ref
286 291 fi
287 292 echo "\n==== Build noise differences ($LABEL) ====\n" \
288 293 >>$mail_msg_file
289 294 diff $SRC/${NOISE}.ref $SRC/${NOISE}.out >>$mail_msg_file
290 295 fi
291 296
292 297 #
293 298 # Re-sign selected binaries using signing server
294 299 # (gatekeeper builds only)
295 300 #
296 301 if [ -n "$CODESIGN_USER" -a "$this_build_ok" = "y" ]; then
297 302 echo "\n==== Signing proto area at `date` ====\n" >> $LOGFILE
298 303 signing_file="${TMPDIR}/signing"
299 304 rm -f ${signing_file}
300 305 export CODESIGN_USER
301 306 signproto $SRC/tools/codesign/creds 2>&1 | \
302 307 tee -a ${signing_file} >> $LOGFILE
303 308 echo "\n==== Finished signing proto area at `date` ====\n" \
304 309 >> $LOGFILE
305 310 echo "\n==== Crypto module signing errors ($LABEL) ====\n" \
306 311 >> $mail_msg_file
307 312 egrep 'WARNING|ERROR' ${signing_file} >> $mail_msg_file
308 313 if (( $? == 0 )) ; then
309 314 build_ok=n
310 315 this_build_ok=n
311 316 fi
312 317 fi
313 318
314 319 #
315 320 # Building Packages
316 321 #
317 322 if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then
318 323 if [ -d $SRC/pkg ]; then
319 324 echo "\n==== Creating $LABEL packages at `date` ====\n" \
320 325 >> $LOGFILE
321 326 echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE
322 327 rm -rf $PKGARCHIVE >> "$LOGFILE" 2>&1
323 328 mkdir -p $PKGARCHIVE >> "$LOGFILE" 2>&1
324 329
325 330 rm -f $SRC/pkg/${INSTALLOG}.out
↓ open down ↓ |
94 lines elided |
↑ open up ↑ |
326 331 cd $SRC/pkg
327 332 /bin/time $MAKE -e install 2>&1 | \
328 333 tee -a $SRC/pkg/${INSTALLOG}.out >> $LOGFILE
329 334
330 335 echo "\n==== package build errors ($LABEL) ====\n" \
331 336 >> $mail_msg_file
332 337
333 338 egrep "${MAKE}|ERROR|WARNING" $SRC/pkg/${INSTALLOG}.out | \
334 339 grep ':' | \
335 340 grep -v PSTAMP | \
336 - egrep -v "Ignoring unknown host" \
337 - >> $mail_msg_file
341 + egrep -v "Ignoring unknown host" | \
342 + tee $TMPDIR/package >> $mail_msg_file
343 + if [[ -s $TMPDIR/package ]]; then
344 + build_extras_ok=n
345 + this_build_ok=n
346 + fi
338 347 else
339 348 #
340 349 # Handle it gracefully if -p was set but there so
341 350 # no pkg directory.
342 351 #
343 352 echo "\n==== No $LABEL packages to build ====\n" \
344 353 >> $LOGFILE
345 354 fi
346 355 else
347 356 echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE
348 357 fi
349 358
350 359 ROOT=$ORIGROOT
351 360 }
352 361
353 362 # Usage: dolint /dir y|n
354 363 # Arg. 2 is a flag to turn on/off the lint diff output
355 364 function dolint {
356 365 if [ ! -d "$1" ]; then
357 366 echo "dolint error: $1 is not a directory"
358 367 exit 1
359 368 fi
360 369
361 370 if [ "$2" != "y" -a "$2" != "n" ]; then
362 371 echo "dolint internal error: $2 should be 'y' or 'n'"
363 372 exit 1
364 373 fi
365 374
366 375 lintdir=$1
367 376 dodiff=$2
368 377 base=`basename $lintdir`
369 378 LINTOUT=$lintdir/lint-${MACH}.out
370 379 LINTNOISE=$lintdir/lint-noise-${MACH}
371 380 export ENVLDLIBS1=`myldlibs $ROOT`
372 381 export ENVCPPFLAGS1=`myheaders $ROOT`
373 382
374 383 set_debug_build_flags
375 384
376 385 #
377 386 # '$MAKE lint' in $lintdir
378 387 #
379 388 echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
380 389
381 390 # remove old lint.out
382 391 rm -f $lintdir/lint.out $lintdir/lint-noise.out
383 392 if [ -f $lintdir/lint-noise.ref ]; then
384 393 mv $lintdir/lint-noise.ref ${LINTNOISE}.ref
385 394 fi
386 395
387 396 rm -f $LINTOUT
↓ open down ↓ |
40 lines elided |
↑ open up ↑ |
388 397 cd $lintdir
389 398 #
390 399 # Remove all .ln files to ensure a full reference file
391 400 #
392 401 rm -f Nothing_to_remove \
393 402 `find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \) \
394 403 -prune -o -type f -name '*.ln' -print `
395 404
396 405 /bin/time $MAKE -ek lint 2>&1 | \
397 406 tee -a $LINTOUT >> $LOGFILE
407 +
398 408 echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file
409 +
399 410 grep "$MAKE:" $LINTOUT |
400 - egrep -v "Ignoring unknown host" \
401 - >> $mail_msg_file
411 + egrep -v "Ignoring unknown host" | \
412 + tee $TMPDIR/lint_errs >> $mail_msg_file
413 + if [[ -s $TMPDIR/lint_errs ]]; then
414 + build_extras_ok=n
415 + fi
402 416
403 417 echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
404 418
405 419 echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \
406 420 >>$mail_msg_file
407 421 tail -3 $LINTOUT >>$mail_msg_file
408 422
409 423 rm -f ${LINTNOISE}.ref
410 424 if [ -f ${LINTNOISE}.out ]; then
411 425 mv ${LINTNOISE}.out ${LINTNOISE}.ref
412 426 fi
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
413 427 grep : $LINTOUT | \
414 428 egrep -v '^(real|user|sys)' |
415 429 egrep -v '(library construction)' | \
416 430 egrep -v ': global crosschecks' | \
417 431 egrep -v 'Ignoring unknown host' | \
418 432 egrep -v '\.c:$' | \
419 433 sort | uniq > ${LINTNOISE}.out
420 434 if [ ! -f ${LINTNOISE}.ref ]; then
421 435 cp ${LINTNOISE}.out ${LINTNOISE}.ref
422 436 fi
437 +
423 438 if [ "$dodiff" != "n" ]; then
424 439 echo "\n==== lint warnings $base ====\n" \
425 440 >>$mail_msg_file
426 441 # should be none, though there are a few that were filtered out
427 442 # above
428 443 egrep -i '(warning|lint):' ${LINTNOISE}.out \
429 - | sort | uniq >> $mail_msg_file
444 + | sort | uniq | tee $TMPDIR/lint_warns >> $mail_msg_file
445 + if [[ -s $TMPDIR/lint_warns ]]; then
446 + build_extras_ok=n
447 + fi
430 448 echo "\n==== lint noise differences $base ====\n" \
431 449 >> $mail_msg_file
432 450 diff ${LINTNOISE}.ref ${LINTNOISE}.out \
433 451 >> $mail_msg_file
434 452 fi
435 453 }
436 454
437 455 #
438 456 # Build and install the onbld tools.
439 457 #
440 458 # usage: build_tools DESTROOT
441 459 #
442 460 # returns non-zero status if the build was successful.
443 461 #
444 462 function build_tools {
445 463 DESTROOT=$1
446 464
447 465 INSTALLOG=install-${MACH}
448 466
449 467 echo "\n==== Building tools at `date` ====\n" \
450 468 >> $LOGFILE
451 469
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
452 470 rm -f ${TOOLS}/${INSTALLOG}.out
453 471 cd ${TOOLS}
454 472 /bin/time $MAKE TOOLS_PROTO=${DESTROOT} -e install 2>&1 | \
455 473 tee -a ${TOOLS}/${INSTALLOG}.out >> $LOGFILE
456 474
457 475 echo "\n==== Tools build errors ====\n" >> $mail_msg_file
458 476
459 477 egrep ":" ${TOOLS}/${INSTALLOG}.out |
460 478 egrep -e "(${MAKE}:|[ ]error[: \n])" | \
461 479 egrep -v "Ignoring unknown host" | \
462 - egrep -v warning >> $mail_msg_file
463 - return $?
480 + egrep -v warning | tee $TMPDIR/tools_errors >> $mail_msg_file
481 +
482 + if [[ -s $TMPDIR/tools_errors ]]; then
483 + return 1
484 + fi
485 + return 0
464 486 }
465 487
466 488 #
467 489 # Set up to use locally installed tools.
468 490 #
469 491 # usage: use_tools TOOLSROOT
470 492 #
471 493 function use_tools {
472 494 TOOLSROOT=$1
473 495
474 496 #
475 497 # If we're not building ON workspace, then the TOOLSROOT
476 498 # settings here are clearly ignored by the workspace
477 499 # makefiles, prepending nonexistent directories to PATH is
478 500 # harmless, and we clearly do not wish to override
479 501 # ONBLD_TOOLS.
480 502 #
481 503 # If we're building an ON workspace, then the prepended PATH
482 504 # elements should supercede the preexisting ONBLD_TOOLS paths,
483 505 # and we want to override ONBLD_TOOLS to catch the tools that
484 506 # don't have specific path env vars here.
485 507 #
486 508 # So the only conditional behavior is overriding ONBLD_TOOLS,
487 509 # and we check for "an ON workspace" by looking for
488 510 # ${TOOLSROOT}/opt/onbld.
489 511 #
490 512
491 513 STABS=${TOOLSROOT}/opt/onbld/bin/${MACH}/stabs
492 514 export STABS
493 515 CTFSTABS=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfstabs
494 516 export CTFSTABS
495 517 GENOFFSETS=${TOOLSROOT}/opt/onbld/bin/genoffsets
496 518 export GENOFFSETS
497 519
498 520 CTFCONVERT=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfconvert
499 521 export CTFCONVERT
500 522 CTFMERGE=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfmerge
501 523 export CTFMERGE
502 524
503 525 CTFCVTPTBL=${TOOLSROOT}/opt/onbld/bin/ctfcvtptbl
504 526 export CTFCVTPTBL
505 527 CTFFINDMOD=${TOOLSROOT}/opt/onbld/bin/ctffindmod
506 528 export CTFFINDMOD
507 529
508 530 if [ "$VERIFY_ELFSIGN" = "y" ]; then
509 531 ELFSIGN=${TOOLSROOT}/opt/onbld/bin/elfsigncmp
510 532 else
511 533 ELFSIGN=${TOOLSROOT}/opt/onbld/bin/${MACH}/elfsign
512 534 fi
513 535 export ELFSIGN
514 536
515 537 PATH="${TOOLSROOT}/opt/onbld/bin/${MACH}:${PATH}"
516 538 PATH="${TOOLSROOT}/opt/onbld/bin:${PATH}"
517 539 export PATH
518 540
519 541 if [ -d "${TOOLSROOT}/opt/onbld" ]; then
520 542 ONBLD_TOOLS=${TOOLSROOT}/opt/onbld
521 543 export ONBLD_TOOLS
522 544 fi
523 545
524 546 echo "\n==== New environment settings. ====\n" >> $LOGFILE
525 547 echo "STABS=${STABS}" >> $LOGFILE
526 548 echo "CTFSTABS=${CTFSTABS}" >> $LOGFILE
527 549 echo "CTFCONVERT=${CTFCONVERT}" >> $LOGFILE
528 550 echo "CTFMERGE=${CTFMERGE}" >> $LOGFILE
529 551 echo "CTFCVTPTBL=${CTFCVTPTBL}" >> $LOGFILE
530 552 echo "CTFFINDMOD=${CTFFINDMOD}" >> $LOGFILE
531 553 echo "ELFSIGN=${ELFSIGN}" >> $LOGFILE
532 554 echo "PATH=${PATH}" >> $LOGFILE
533 555 echo "ONBLD_TOOLS=${ONBLD_TOOLS}" >> $LOGFILE
534 556 }
535 557
536 558 function staffer {
537 559 if [ $ISUSER -ne 0 ]; then
538 560 "$@"
539 561 else
540 562 arg="\"$1\""
541 563 shift
542 564 for i
543 565 do
544 566 arg="$arg \"$i\""
545 567 done
546 568 eval su $STAFFER -c \'$arg\'
547 569 fi
548 570 }
549 571
550 572 #
551 573 # Verify that the closed bins are present
552 574 #
553 575 function check_closed_bins {
554 576 if [[ ! -d "$ON_CLOSED_BINS" ]]; then
555 577 echo "ON_CLOSED_BINS must point to the closed binaries tree."
556 578 build_ok=n
557 579 exit 1
558 580 fi
559 581 }
560 582
561 583 #
562 584 # wrapper over wsdiff.
563 585 # usage: do_wsdiff LABEL OLDPROTO NEWPROTO
564 586 #
565 587 function do_wsdiff {
566 588 label=$1
567 589 oldproto=$2
568 590 newproto=$3
569 591
570 592 wsdiff="wsdiff"
571 593 [ "$t_FLAG" = y ] && wsdiff="wsdiff -t"
572 594
573 595 echo "\n==== Getting object changes since last build at `date`" \
574 596 "($label) ====\n" | tee -a $LOGFILE >> $mail_msg_file
575 597 $wsdiff -s -r ${TMPDIR}/wsdiff.results $oldproto $newproto 2>&1 | \
576 598 tee -a $LOGFILE >> $mail_msg_file
577 599 echo "\n==== Object changes determined at `date` ($label) ====\n" | \
578 600 tee -a $LOGFILE >> $mail_msg_file
579 601 }
580 602
581 603 #
582 604 # Functions for setting build flags (DEBUG/non-DEBUG). Keep them
583 605 # together.
584 606 #
585 607
586 608 function set_non_debug_build_flags {
587 609 export RELEASE_BUILD ; RELEASE_BUILD=
588 610 unset EXTRA_OPTIONS
589 611 unset EXTRA_CFLAGS
590 612 }
591 613
592 614 function set_debug_build_flags {
593 615 unset RELEASE_BUILD
594 616 unset EXTRA_OPTIONS
595 617 unset EXTRA_CFLAGS
596 618 }
597 619
598 620
599 621 MACH=`uname -p`
600 622
601 623 if [ "$OPTHOME" = "" ]; then
602 624 OPTHOME=/opt
603 625 export OPTHOME
604 626 fi
605 627
606 628 USAGE='Usage: nightly [-in] [+t] [-V VERS ] <env_file>
607 629
608 630 Where:
609 631 -i Fast incremental options (no clobber, lint, check)
610 632 -n Do not do a bringover
611 633 +t Use the build tools in $ONBLD_TOOLS/bin
612 634 -V VERS set the build version string to VERS
613 635
614 636 <env_file> file in Bourne shell syntax that sets and exports
615 637 variables that configure the operation of this script and many of
616 638 the scripts this one calls. If <env_file> does not exist,
617 639 it will be looked for in $OPTHOME/onbld/env.
618 640
619 641 non-DEBUG is the default build type. Build options can be set in the
620 642 NIGHTLY_OPTIONS variable in the <env_file> as follows:
621 643
622 644 -A check for ABI differences in .so files
623 645 -C check for cstyle/hdrchk errors
624 646 -D do a build with DEBUG on
625 647 -F do _not_ do a non-DEBUG build
626 648 -G gate keeper default group of options (-au)
627 649 -I integration engineer default group of options (-ampu)
628 650 -M do not run pmodes (safe file permission checker)
629 651 -N do not run protocmp
630 652 -R default group of options for building a release (-mp)
631 653 -U update proto area in the parent
632 654 -V VERS set the build version string to VERS
633 655 -f find unreferenced files
634 656 -i do an incremental build (no "make clobber")
635 657 -l do "make lint" in $LINTDIRS (default: $SRC y)
636 658 -m send mail to $MAILTO at end of build
637 659 -n do not do a bringover
638 660 -p create packages
639 661 -r check ELF runtime attributes in the proto area
640 662 -t build and use the tools in $SRC/tools (default setting)
641 663 +t Use the build tools in $ONBLD_TOOLS/bin
642 664 -u update proto_list_$MACH and friends in the parent workspace;
643 665 when used with -f, also build an unrefmaster.out in the parent
644 666 -w report on differences between previous and current proto areas
645 667 '
646 668 #
647 669 # A log file will be generated under the name $LOGFILE
648 670 # for partially completed build and log.`date '+%F'`
649 671 # in the same directory for fully completed builds.
650 672 #
651 673
652 674 # default values for low-level FLAGS; G I R are group FLAGS
653 675 A_FLAG=n
654 676 C_FLAG=n
655 677 D_FLAG=n
656 678 F_FLAG=n
657 679 f_FLAG=n
658 680 i_FLAG=n; i_CMD_LINE_FLAG=n
659 681 l_FLAG=n
660 682 M_FLAG=n
661 683 m_FLAG=n
662 684 N_FLAG=n
↓ open down ↓ |
189 lines elided |
↑ open up ↑ |
663 685 n_FLAG=n
664 686 p_FLAG=n
665 687 r_FLAG=n
666 688 t_FLAG=y
667 689 U_FLAG=n
668 690 u_FLAG=n
669 691 V_FLAG=n
670 692 w_FLAG=n
671 693 #
672 694 build_ok=y
695 +build_extras_ok=y
673 696
674 697 #
675 698 # examine arguments
676 699 #
677 700
678 701 OPTIND=1
679 702 while getopts +intV: FLAG
680 703 do
681 704 case $FLAG in
682 705 i ) i_FLAG=y; i_CMD_LINE_FLAG=y
683 706 ;;
684 707 n ) n_FLAG=y
685 708 ;;
686 709 +t ) t_FLAG=n
687 710 ;;
688 711 V ) V_FLAG=y
689 712 V_ARG="$OPTARG"
690 713 ;;
691 714 \? ) echo "$USAGE"
692 715 exit 1
693 716 ;;
694 717 esac
695 718 done
696 719
697 720 # correct argument count after options
698 721 shift `expr $OPTIND - 1`
699 722
700 723 # test that the path to the environment-setting file was given
701 724 if [ $# -ne 1 ]; then
702 725 echo "$USAGE"
703 726 exit 1
704 727 fi
705 728
706 729 # check if user is running nightly as root
707 730 # ISUSER is set non-zero if an ordinary user runs nightly, or is zero
708 731 # when root invokes nightly.
709 732 /usr/bin/id | grep '^uid=0(' >/dev/null 2>&1
710 733 ISUSER=$?; export ISUSER
711 734
712 735 #
713 736 # force locale to C
714 737 LC_COLLATE=C; export LC_COLLATE
715 738 LC_CTYPE=C; export LC_CTYPE
716 739 LC_MESSAGES=C; export LC_MESSAGES
717 740 LC_MONETARY=C; export LC_MONETARY
718 741 LC_NUMERIC=C; export LC_NUMERIC
719 742 LC_TIME=C; export LC_TIME
720 743
721 744 # clear environment variables we know to be bad for the build
722 745 unset LD_OPTIONS
723 746 unset LD_AUDIT LD_AUDIT_32 LD_AUDIT_64
724 747 unset LD_BIND_NOW LD_BIND_NOW_32 LD_BIND_NOW_64
725 748 unset LD_BREADTH LD_BREADTH_32 LD_BREADTH_64
726 749 unset LD_CONFIG LD_CONFIG_32 LD_CONFIG_64
727 750 unset LD_DEBUG LD_DEBUG_32 LD_DEBUG_64
728 751 unset LD_DEMANGLE LD_DEMANGLE_32 LD_DEMANGLE_64
729 752 unset LD_FLAGS LD_FLAGS_32 LD_FLAGS_64
730 753 unset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64
731 754 unset LD_LOADFLTR LD_LOADFLTR_32 LD_LOADFLTR_64
732 755 unset LD_NOAUDIT LD_NOAUDIT_32 LD_NOAUDIT_64
733 756 unset LD_NOAUXFLTR LD_NOAUXFLTR_32 LD_NOAUXFLTR_64
734 757 unset LD_NOCONFIG LD_NOCONFIG_32 LD_NOCONFIG_64
735 758 unset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64
736 759 unset LD_NODIRECT LD_NODIRECT_32 LD_NODIRECT_64
737 760 unset LD_NOLAZYLOAD LD_NOLAZYLOAD_32 LD_NOLAZYLOAD_64
738 761 unset LD_NOOBJALTER LD_NOOBJALTER_32 LD_NOOBJALTER_64
739 762 unset LD_NOVERSION LD_NOVERSION_32 LD_NOVERSION_64
740 763 unset LD_ORIGIN LD_ORIGIN_32 LD_ORIGIN_64
741 764 unset LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64
742 765 unset LD_PROFILE LD_PROFILE_32 LD_PROFILE_64
743 766
744 767 unset CONFIG
745 768 unset GROUP
746 769 unset OWNER
747 770 unset REMOTE
748 771 unset ENV
749 772 unset ARCH
750 773 unset CLASSPATH
751 774 unset NAME
752 775
753 776 #
754 777 # To get ONBLD_TOOLS from the environment, it must come from the env file.
755 778 # If it comes interactively, it is generally TOOLS_PROTO, which will be
756 779 # clobbered before the compiler version checks, which will therefore fail.
757 780 #
758 781 unset ONBLD_TOOLS
759 782
760 783 #
761 784 # Setup environmental variables
762 785 #
763 786 if [ -f /etc/nightly.conf ]; then
764 787 . /etc/nightly.conf
765 788 fi
766 789
767 790 if [ -f $1 ]; then
768 791 if [[ $1 = */* ]]; then
769 792 . $1
770 793 else
771 794 . ./$1
772 795 fi
773 796 else
774 797 if [ -f $OPTHOME/onbld/env/$1 ]; then
775 798 . $OPTHOME/onbld/env/$1
776 799 else
777 800 echo "Cannot find env file as either $1 or $OPTHOME/onbld/env/$1"
778 801 exit 1
779 802 fi
780 803 fi
781 804
782 805 # contents of stdenv.sh inserted after next line:
783 806 # STDENV_START
784 807 # STDENV_END
785 808
786 809 # Check if we have sufficient data to continue...
787 810 [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
788 811 if [[ "${NIGHTLY_OPTIONS}" == ~(F)n ]] ; then
789 812 # Check if the gate data are valid if we don't do a "bringover" below
790 813 [[ -d "${CODEMGR_WS}" ]] || \
791 814 fatal_error "Error: ${CODEMGR_WS} is not a directory."
792 815 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || \
793 816 fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
794 817 fi
795 818
796 819 #
797 820 # place ourselves in a new task, respecting BUILD_PROJECT if set.
798 821 #
799 822 if [ -z "$BUILD_PROJECT" ]; then
800 823 /usr/bin/newtask -c $$
801 824 else
802 825 /usr/bin/newtask -c $$ -p $BUILD_PROJECT
803 826 fi
804 827
805 828 ps -o taskid= -p $$ | read build_taskid
806 829 ps -o project= -p $$ | read build_project
807 830
808 831 #
809 832 # See if NIGHTLY_OPTIONS is set
810 833 #
811 834 if [ "$NIGHTLY_OPTIONS" = "" ]; then
812 835 NIGHTLY_OPTIONS="-aBm"
813 836 fi
814 837
815 838 #
816 839 # If BRINGOVER_WS was not specified, let it default to CLONE_WS
817 840 #
818 841 if [ "$BRINGOVER_WS" = "" ]; then
819 842 BRINGOVER_WS=$CLONE_WS
820 843 fi
821 844
822 845 #
823 846 # If BRINGOVER_FILES was not specified, default to usr
824 847 #
825 848 if [ "$BRINGOVER_FILES" = "" ]; then
826 849 BRINGOVER_FILES="usr"
827 850 fi
828 851
829 852 check_closed_bins
830 853
831 854 #
832 855 # Note: changes to the option letters here should also be applied to the
833 856 # bldenv script. `d' is listed for backward compatibility.
834 857 #
835 858 NIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-}
836 859 OPTIND=1
837 860 while getopts +ABCDdFfGIilMmNnpRrtUuw FLAG $NIGHTLY_OPTIONS
838 861 do
839 862 case $FLAG in
840 863 A ) A_FLAG=y
841 864 ;;
842 865 B ) D_FLAG=y
843 866 ;; # old version of D
844 867 C ) C_FLAG=y
845 868 ;;
846 869 D ) D_FLAG=y
847 870 ;;
848 871 F ) F_FLAG=y
849 872 ;;
850 873 f ) f_FLAG=y
851 874 ;;
852 875 G ) u_FLAG=y
853 876 ;;
854 877 I ) m_FLAG=y
855 878 p_FLAG=y
856 879 u_FLAG=y
857 880 ;;
858 881 i ) i_FLAG=y
859 882 ;;
860 883 l ) l_FLAG=y
861 884 ;;
862 885 M ) M_FLAG=y
863 886 ;;
864 887 m ) m_FLAG=y
865 888 ;;
866 889 N ) N_FLAG=y
867 890 ;;
868 891 n ) n_FLAG=y
869 892 ;;
870 893 p ) p_FLAG=y
871 894 ;;
872 895 R ) m_FLAG=y
873 896 p_FLAG=y
874 897 ;;
875 898 r ) r_FLAG=y
876 899 ;;
877 900 +t ) t_FLAG=n
878 901 ;;
879 902 U ) if [ -z "${PARENT_ROOT}" ]; then
880 903 echo "PARENT_ROOT must be set if the U flag is" \
881 904 "present in NIGHTLY_OPTIONS."
882 905 exit 1
883 906 fi
884 907 NIGHTLY_PARENT_ROOT=$PARENT_ROOT
885 908 if [ -n "${PARENT_TOOLS_ROOT}" ]; then
886 909 NIGHTLY_PARENT_TOOLS_ROOT=$PARENT_TOOLS_ROOT
887 910 fi
888 911 U_FLAG=y
889 912 ;;
890 913 u ) u_FLAG=y
891 914 ;;
892 915 w ) w_FLAG=y
893 916 ;;
894 917 \? ) echo "$USAGE"
895 918 exit 1
896 919 ;;
897 920 esac
898 921 done
899 922
900 923 if [ $ISUSER -ne 0 ]; then
901 924 # Set default value for STAFFER, if needed.
902 925 if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then
903 926 STAFFER=`/usr/xpg4/bin/id -un`
904 927 export STAFFER
905 928 fi
906 929 fi
907 930
908 931 if [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then
909 932 MAILTO=$STAFFER
910 933 export MAILTO
911 934 fi
912 935
913 936 PATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin"
914 937 PATH="$PATH:$OPTHOME/SUNWspro/bin:/usr/bin:/usr/sbin:/usr/ucb"
915 938 PATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
916 939 export PATH
917 940
918 941 # roots of source trees, both relative to $SRC and absolute.
919 942 relsrcdirs="."
920 943 abssrcdirs="$SRC"
921 944
922 945 PROTOCMPTERSE="protocmp.terse -gu"
923 946 POUND_SIGN="#"
924 947 # have we set RELEASE_DATE in our env file?
925 948 if [ -z "$RELEASE_DATE" ]; then
926 949 RELEASE_DATE=$(LC_ALL=C date +"%B %Y")
927 950 fi
928 951 BUILD_DATE=$(LC_ALL=C date +%Y-%b-%d)
929 952 BASEWSDIR=$(basename $CODEMGR_WS)
930 953 DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
931 954
932 955 # we export POUND_SIGN, RELEASE_DATE and DEV_CM to speed up the build process
933 956 # by avoiding repeated shell invocations to evaluate Makefile.master
934 957 # definitions.
935 958 export POUND_SIGN RELEASE_DATE DEV_CM
936 959
937 960 maketype="distributed"
938 961 if [[ -z "$MAKE" ]]; then
939 962 MAKE=dmake
940 963 elif [[ ! -x "$MAKE" ]]; then
941 964 echo "\$MAKE is set to garbage in the environment"
942 965 exit 1
943 966 fi
944 967 # get the dmake version string alone
945 968 DMAKE_VERSION=$( $MAKE -v )
946 969 DMAKE_VERSION=${DMAKE_VERSION#*: }
947 970 # focus in on just the dotted version number alone
948 971 DMAKE_MAJOR=$( echo $DMAKE_VERSION | \
949 972 sed -e 's/.*\<\([^.]*\.[^ ]*\).*$/\1/' )
950 973 # extract the second (or final) integer
951 974 DMAKE_MINOR=${DMAKE_MAJOR#*.}
952 975 DMAKE_MINOR=${DMAKE_MINOR%%.*}
953 976 # extract the first integer
954 977 DMAKE_MAJOR=${DMAKE_MAJOR%%.*}
955 978 CHECK_DMAKE=${CHECK_DMAKE:-y}
956 979 # x86 was built on the 12th, sparc on the 13th.
957 980 if [ "$CHECK_DMAKE" = "y" -a \
958 981 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \
959 982 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \( \
960 983 "$DMAKE_MAJOR" -lt 7 -o \
961 984 "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \) ]; then
962 985 if [ -z "$DMAKE_VERSION" ]; then
963 986 echo "$MAKE is missing."
964 987 exit 1
965 988 fi
966 989 echo `whence $MAKE`" version is:"
967 990 echo " ${DMAKE_VERSION}"
968 991 cat <<EOF
969 992
970 993 This version may not be safe for use, if you really want to use this version
971 994 anyway add the following to your environment to disable this check:
972 995
973 996 CHECK_DMAKE=n
974 997 EOF
975 998 exit 1
976 999 fi
977 1000 export PATH
978 1001 export MAKE
979 1002
980 1003 if [ "${SUNWSPRO}" != "" ]; then
981 1004 PATH="${SUNWSPRO}/bin:$PATH"
982 1005 export PATH
983 1006 fi
984 1007
985 1008 hostname=$(uname -n)
986 1009 if [[ $DMAKE_MAX_JOBS != +([0-9]) || $DMAKE_MAX_JOBS -eq 0 ]]
987 1010 then
988 1011 maxjobs=
989 1012 if [[ -f $HOME/.make.machines ]]
990 1013 then
991 1014 # Note: there is a hard tab and space character in the []s
992 1015 # below.
993 1016 egrep -i "^[ ]*$hostname[ \.]" \
994 1017 $HOME/.make.machines | read host jobs
995 1018 maxjobs=${jobs##*=}
996 1019 fi
997 1020
998 1021 if [[ $maxjobs != +([0-9]) || $maxjobs -eq 0 ]]
999 1022 then
1000 1023 # default
1001 1024 maxjobs=4
1002 1025 fi
1003 1026
1004 1027 export DMAKE_MAX_JOBS=$maxjobs
1005 1028 fi
1006 1029
1007 1030 DMAKE_MODE=parallel;
1008 1031 export DMAKE_MODE
1009 1032
1010 1033 if [ -z "${ROOT}" ]; then
1011 1034 echo "ROOT must be set."
1012 1035 exit 1
1013 1036 fi
1014 1037
1015 1038 #
1016 1039 # if -V flag was given, reset VERSION to V_ARG
1017 1040 #
1018 1041 if [ "$V_FLAG" = "y" ]; then
1019 1042 VERSION=$V_ARG
1020 1043 fi
1021 1044
1022 1045 TMPDIR="/tmp/nightly.tmpdir.$$"
1023 1046 export TMPDIR
1024 1047 rm -rf ${TMPDIR}
1025 1048 mkdir -p $TMPDIR || exit 1
1026 1049 chmod 777 $TMPDIR
1027 1050
1028 1051 #
1029 1052 # Keep elfsign's use of pkcs11_softtoken from looking in the user home
1030 1053 # directory, which doesn't always work. Needed until all build machines
1031 1054 # have the fix for 6271754
1032 1055 #
1033 1056 SOFTTOKEN_DIR=$TMPDIR
1034 1057 export SOFTTOKEN_DIR
1035 1058
1036 1059 #
1037 1060 # Tools should only be built non-DEBUG. Keep track of the tools proto
1038 1061 # area path relative to $TOOLS, because the latter changes in an
1039 1062 # export build.
1040 1063 #
1041 1064 # TOOLS_PROTO is included below for builds other than usr/src/tools
1042 1065 # that look for this location. For usr/src/tools, this will be
1043 1066 # overridden on the $MAKE command line in build_tools().
1044 1067 #
1045 1068 TOOLS=${SRC}/tools
1046 1069 TOOLS_PROTO_REL=proto/root_${MACH}-nd
1047 1070 TOOLS_PROTO=${TOOLS}/${TOOLS_PROTO_REL}; export TOOLS_PROTO
1048 1071
1049 1072 unset CFLAGS LD_LIBRARY_PATH LDFLAGS
1050 1073
1051 1074 # create directories that are automatically removed if the nightly script
1052 1075 # fails to start correctly
1053 1076 function newdir {
1054 1077 dir=$1
1055 1078 toadd=
1056 1079 while [ ! -d $dir ]; do
1057 1080 toadd="$dir $toadd"
1058 1081 dir=`dirname $dir`
1059 1082 done
1060 1083 torm=
1061 1084 newlist=
1062 1085 for dir in $toadd; do
1063 1086 if staffer mkdir $dir; then
1064 1087 newlist="$ISUSER $dir $newlist"
1065 1088 torm="$dir $torm"
1066 1089 else
1067 1090 [ -z "$torm" ] || staffer rmdir $torm
1068 1091 return 1
1069 1092 fi
1070 1093 done
1071 1094 newdirlist="$newlist $newdirlist"
1072 1095 return 0
1073 1096 }
1074 1097 newdirlist=
1075 1098
1076 1099 [ -d $CODEMGR_WS ] || newdir $CODEMGR_WS || exit 1
1077 1100
1078 1101 # since this script assumes the build is from full source, it nullifies
1079 1102 # variables likely to have been set by a "ws" script; nullification
1080 1103 # confines the search space for headers and libraries to the proto area
1081 1104 # built from this immediate source.
1082 1105 ENVLDLIBS1=
1083 1106 ENVLDLIBS2=
1084 1107 ENVLDLIBS3=
1085 1108 ENVCPPFLAGS1=
1086 1109 ENVCPPFLAGS2=
1087 1110 ENVCPPFLAGS3=
1088 1111 ENVCPPFLAGS4=
1089 1112 PARENT_ROOT=
1090 1113
1091 1114 export ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \
1092 1115 ENVLDLIBS1 ENVLDLIBS2 PARENT_ROOT
1093 1116
1094 1117 PKGARCHIVE_ORIG=$PKGARCHIVE
1095 1118
1096 1119 #
1097 1120 # Juggle the logs and optionally send mail on completion.
1098 1121 #
1099 1122
1100 1123 function logshuffle {
1101 1124 LLOG="$ATLOG/log.`date '+%F.%H:%M'`"
1102 1125 if [ -f $LLOG -o -d $LLOG ]; then
1103 1126 LLOG=$LLOG.$$
1104 1127 fi
1105 1128 mkdir $LLOG
1106 1129 export LLOG
1107 1130
1108 1131 if [ "$build_ok" = "y" ]; then
1109 1132 mv $ATLOG/proto_list_${MACH} $LLOG
1110 1133
1111 1134 if [ -f $ATLOG/proto_list_tools_${MACH} ]; then
1112 1135 mv $ATLOG/proto_list_tools_${MACH} $LLOG
1113 1136 fi
1114 1137
1115 1138 if [ -f $TMPDIR/wsdiff.results ]; then
1116 1139 mv $TMPDIR/wsdiff.results $LLOG
1117 1140 fi
1118 1141
1119 1142 if [ -f $TMPDIR/wsdiff-nd.results ]; then
1120 1143 mv $TMPDIR/wsdiff-nd.results $LLOG
1121 1144 fi
1122 1145 fi
1123 1146
1124 1147 #
1125 1148 # Now that we're about to send mail, it's time to check the noise
1126 1149 # file. In the event that an error occurs beyond this point, it will
1127 1150 # be recorded in the nightly.log file, but nowhere else. This would
1128 1151 # include only errors that cause the copying of the noise log to fail
1129 1152 # or the mail itself not to be sent.
1130 1153 #
1131 1154
1132 1155 exec >>$LOGFILE 2>&1
1133 1156 if [ -s $build_noise_file ]; then
1134 1157 echo "\n==== Nightly build noise ====\n" |
1135 1158 tee -a $LOGFILE >>$mail_msg_file
1136 1159 cat $build_noise_file >>$LOGFILE
1137 1160 cat $build_noise_file >>$mail_msg_file
1138 1161 echo | tee -a $LOGFILE >>$mail_msg_file
1139 1162 fi
1140 1163 rm -f $build_noise_file
1141 1164
1142 1165 case "$build_ok" in
↓ open down ↓ |
460 lines elided |
↑ open up ↑ |
1143 1166 y)
1144 1167 state=Completed
1145 1168 ;;
1146 1169 i)
1147 1170 state=Interrupted
1148 1171 ;;
1149 1172 *)
1150 1173 state=Failed
1151 1174 ;;
1152 1175 esac
1176 +
1177 + if [[ $state != "Interrupted" && $build_extras_ok != "y" ]]; then
1178 + state=Failed
1179 + fi
1180 +
1153 1181 NIGHTLY_STATUS=$state
1154 1182 export NIGHTLY_STATUS
1155 1183
1156 1184 run_hook POST_NIGHTLY $state
1157 1185 run_hook SYS_POST_NIGHTLY $state
1158 1186
1159 1187 #
1160 1188 # mailx(1) sets From: based on the -r flag
1161 1189 # if it is given.
1162 1190 #
1163 1191 mailx_r=
1164 1192 if [[ -n "${MAILFROM}" ]]; then
1165 1193 mailx_r="-r ${MAILFROM}"
1166 1194 fi
1167 1195
1168 1196 cat $build_time_file $build_environ_file $mail_msg_file \
1169 1197 > ${LLOG}/mail_msg
1170 1198 if [ "$m_FLAG" = "y" ]; then
1171 1199 cat ${LLOG}/mail_msg | /usr/bin/mailx ${mailx_r} -s \
1172 1200 "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \
1173 1201 ${MAILTO}
1174 1202 fi
1175 1203
1176 1204 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
1177 1205 staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH}
1178 1206 staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log
1179 1207 fi
1180 1208
1181 1209 mv $LOGFILE $LLOG
1182 1210 }
1183 1211
1184 1212 #
1185 1213 # Remove the locks and temporary files on any exit
1186 1214 #
1187 1215 function cleanup {
1188 1216 logshuffle
1189 1217
1190 1218 [ -z "$lockfile" ] || staffer rm -f $lockfile
1191 1219 [ -z "$atloglockfile" ] || rm -f $atloglockfile
1192 1220 [ -z "$ulockfile" ] || staffer rm -f $ulockfile
1193 1221 [ -z "$Ulockfile" ] || rm -f $Ulockfile
1194 1222
1195 1223 set -- $newdirlist
1196 1224 while [ $# -gt 0 ]; do
1197 1225 ISUSER=$1 staffer rmdir $2
1198 1226 shift; shift
1199 1227 done
1200 1228 rm -rf $TMPDIR
1201 1229 }
1202 1230
1203 1231 function cleanup_signal {
1204 1232 build_ok=i
1205 1233 # this will trigger cleanup(), above.
1206 1234 exit 1
1207 1235 }
1208 1236
1209 1237 trap cleanup 0
1210 1238 trap cleanup_signal 1 2 3 15
1211 1239
1212 1240 #
1213 1241 # Generic lock file processing -- make sure that the lock file doesn't
1214 1242 # exist. If it does, it should name the build host and PID. If it
1215 1243 # doesn't, then make sure we can create it. Clean up locks that are
1216 1244 # known to be stale (assumes host name is unique among build systems
1217 1245 # for the workspace).
1218 1246 #
1219 1247 function create_lock {
1220 1248 lockf=$1
1221 1249 lockvar=$2
1222 1250
1223 1251 ldir=`dirname $lockf`
1224 1252 [ -d $ldir ] || newdir $ldir || exit 1
1225 1253 eval $lockvar=$lockf
1226 1254
1227 1255 while ! staffer ln -s $hostname.$STAFFER.$$ $lockf 2> /dev/null; do
1228 1256 basews=`basename $CODEMGR_WS`
1229 1257 ls -l $lockf | nawk '{print $NF}' | IFS=. read host user pid
1230 1258 if [ "$host" != "$hostname" ]; then
1231 1259 echo "$MACH build of $basews apparently" \
1232 1260 "already started by $user on $host as $pid."
1233 1261 exit 1
1234 1262 elif kill -s 0 $pid 2>/dev/null; then
1235 1263 echo "$MACH build of $basews already started" \
1236 1264 "by $user as $pid."
1237 1265 exit 1
1238 1266 else
1239 1267 # stale lock; clear it out and try again
1240 1268 rm -f $lockf
1241 1269 fi
1242 1270 done
1243 1271 }
1244 1272
1245 1273 #
1246 1274 # Return the list of interesting proto areas, depending on the current
1247 1275 # options.
1248 1276 #
1249 1277 function allprotos {
1250 1278 typeset roots="$ROOT"
1251 1279
1252 1280 if [[ "$F_FLAG" = n && "$MULTI_PROTO" = yes ]]; then
1253 1281 roots="$roots $ROOT-nd"
1254 1282 fi
1255 1283
1256 1284 echo $roots
1257 1285 }
1258 1286
1259 1287 # Ensure no other instance of this script is running on this host.
1260 1288 # LOCKNAME can be set in <env_file>, and is by default, but is not
1261 1289 # required due to the use of $ATLOG below.
1262 1290 if [ -n "$LOCKNAME" ]; then
1263 1291 create_lock /tmp/$LOCKNAME "lockfile"
1264 1292 fi
1265 1293 #
1266 1294 # Create from one, two, or three other locks:
1267 1295 # $ATLOG/nightly.lock
1268 1296 # - protects against multiple builds in same workspace
1269 1297 # $PARENT_WS/usr/src/nightly.$MACH.lock
1270 1298 # - protects against multiple 'u' copy-backs
1271 1299 # $NIGHTLY_PARENT_ROOT/nightly.lock
1272 1300 # - protects against multiple 'U' copy-backs
1273 1301 #
1274 1302 # Overriding ISUSER to 1 causes the lock to be created as root if the
1275 1303 # script is run as root. The default is to create it as $STAFFER.
1276 1304 ISUSER=1 create_lock $ATLOG/nightly.lock "atloglockfile"
1277 1305 if [ "$u_FLAG" = "y" ]; then
1278 1306 create_lock $PARENT_WS/usr/src/nightly.$MACH.lock "ulockfile"
1279 1307 fi
1280 1308 if [ "$U_FLAG" = "y" ]; then
1281 1309 # NIGHTLY_PARENT_ROOT is written as root if script invoked as root.
1282 1310 ISUSER=1 create_lock $NIGHTLY_PARENT_ROOT/nightly.lock "Ulockfile"
1283 1311 fi
1284 1312
1285 1313 # Locks have been taken, so we're doing a build and we're committed to
1286 1314 # the directories we may have created so far.
1287 1315 newdirlist=
1288 1316
1289 1317 #
1290 1318 # Create mail_msg_file
1291 1319 #
1292 1320 mail_msg_file="${TMPDIR}/mail_msg"
1293 1321 touch $mail_msg_file
1294 1322 build_time_file="${TMPDIR}/build_time"
1295 1323 build_environ_file="${TMPDIR}/build_environ"
1296 1324 touch $build_environ_file
1297 1325 #
1298 1326 # Move old LOGFILE aside
1299 1327 # ATLOG directory already made by 'create_lock' above
1300 1328 #
1301 1329 if [ -f $LOGFILE ]; then
1302 1330 mv -f $LOGFILE ${LOGFILE}-
1303 1331 fi
1304 1332 #
1305 1333 # Build OsNet source
1306 1334 #
1307 1335 START_DATE=`date`
1308 1336 SECONDS=0
1309 1337 echo "\n==== Nightly $maketype build started: $START_DATE ====" \
1310 1338 | tee -a $LOGFILE > $build_time_file
1311 1339
1312 1340 echo "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \
1313 1341 tee -a $mail_msg_file >> $LOGFILE
1314 1342
1315 1343 # make sure we log only to the nightly build file
1316 1344 build_noise_file="${TMPDIR}/build_noise"
1317 1345 exec </dev/null >$build_noise_file 2>&1
1318 1346
1319 1347 run_hook SYS_PRE_NIGHTLY
1320 1348 run_hook PRE_NIGHTLY
1321 1349
1322 1350 echo "\n==== list of environment variables ====\n" >> $LOGFILE
1323 1351 env >> $LOGFILE
1324 1352
1325 1353 echo "\n==== Nightly argument issues ====\n" | tee -a $mail_msg_file >> $LOGFILE
1326 1354
1327 1355 if [ "$N_FLAG" = "y" ]; then
1328 1356 if [ "$p_FLAG" = "y" ]; then
1329 1357 cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
1330 1358 WARNING: the p option (create packages) is set, but so is the N option (do
1331 1359 not run protocmp); this is dangerous; you should unset the N option
1332 1360 EOF
1333 1361 else
1334 1362 cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
1335 1363 Warning: the N option (do not run protocmp) is set; it probably shouldn't be
1336 1364 EOF
1337 1365 fi
1338 1366 echo "" | tee -a $mail_msg_file >> $LOGFILE
1339 1367 fi
1340 1368
1341 1369 if [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then
1342 1370 #
1343 1371 # In the past we just complained but went ahead with the lint
1344 1372 # pass, even though the proto area was built non-DEBUG. It's
1345 1373 # unlikely that non-DEBUG headers will make a difference, but
1346 1374 # rather than assuming it's a safe combination, force the user
1347 1375 # to specify a DEBUG build.
1348 1376 #
1349 1377 echo "WARNING: DEBUG build not requested; disabling lint.\n" \
1350 1378 | tee -a $mail_msg_file >> $LOGFILE
1351 1379 l_FLAG=n
1352 1380 fi
1353 1381
1354 1382 if [ "$f_FLAG" = "y" ]; then
1355 1383 if [ "$i_FLAG" = "y" ]; then
1356 1384 echo "WARNING: the -f flag cannot be used during incremental" \
1357 1385 "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE
1358 1386 f_FLAG=n
1359 1387 fi
1360 1388 if [ "${l_FLAG}${p_FLAG}" != "yy" ]; then
1361 1389 echo "WARNING: the -f flag requires -l, and -p;" \
1362 1390 "ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE
1363 1391 f_FLAG=n
1364 1392 fi
1365 1393 fi
1366 1394
1367 1395 if [ "$w_FLAG" = "y" -a ! -d $ROOT ]; then
1368 1396 echo "WARNING: -w specified, but $ROOT does not exist;" \
1369 1397 "ignoring -w\n" | tee -a $mail_msg_file >> $LOGFILE
1370 1398 w_FLAG=n
1371 1399 fi
1372 1400
1373 1401 if [ "$t_FLAG" = "n" ]; then
1374 1402 #
1375 1403 # We're not doing a tools build, so make sure elfsign(1) is
1376 1404 # new enough to safely sign non-crypto binaries. We test
1377 1405 # debugging output from elfsign to detect the old version.
1378 1406 #
1379 1407 newelfsigntest=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \
1380 1408 -e /usr/lib/security/pkcs11_softtoken.so.1 2>&1 \
1381 1409 | egrep algorithmOID`
1382 1410 if [ -z "$newelfsigntest" ]; then
1383 1411 echo "WARNING: /usr/bin/elfsign out of date;" \
1384 1412 "will only sign crypto modules\n" | \
1385 1413 tee -a $mail_msg_file >> $LOGFILE
1386 1414 export ELFSIGN_OBJECT=true
1387 1415 elif [ "$VERIFY_ELFSIGN" = "y" ]; then
1388 1416 echo "WARNING: VERIFY_ELFSIGN=y requires" \
1389 1417 "the -t flag; ignoring VERIFY_ELFSIGN\n" | \
1390 1418 tee -a $mail_msg_file >> $LOGFILE
1391 1419 fi
1392 1420 fi
1393 1421
1394 1422 case $MULTI_PROTO in
1395 1423 yes|no) ;;
1396 1424 *)
1397 1425 echo "WARNING: MULTI_PROTO is \"$MULTI_PROTO\"; " \
1398 1426 "should be \"yes\" or \"no\"." | tee -a $mail_msg_file >> $LOGFILE
1399 1427 echo "Setting MULTI_PROTO to \"no\".\n" | \
1400 1428 tee -a $mail_msg_file >> $LOGFILE
1401 1429 export MULTI_PROTO=no
1402 1430 ;;
1403 1431 esac
1404 1432
1405 1433 echo "\n==== Build version ====\n" | tee -a $mail_msg_file >> $LOGFILE
1406 1434 echo $VERSION | tee -a $mail_msg_file >> $LOGFILE
1407 1435
1408 1436 # Save the current proto area if we're comparing against the last build
1409 1437 if [ "$w_FLAG" = "y" -a -d "$ROOT" ]; then
1410 1438 if [ -d "$ROOT.prev" ]; then
1411 1439 rm -rf $ROOT.prev
1412 1440 fi
1413 1441 mv $ROOT $ROOT.prev
1414 1442 fi
1415 1443
1416 1444 # Same for non-DEBUG proto area
1417 1445 if [ "$w_FLAG" = "y" -a "$MULTI_PROTO" = yes -a -d "$ROOT-nd" ]; then
1418 1446 if [ -d "$ROOT-nd.prev" ]; then
1419 1447 rm -rf $ROOT-nd.prev
1420 1448 fi
1421 1449 mv $ROOT-nd $ROOT-nd.prev
1422 1450 fi
1423 1451
1424 1452 #
1425 1453 # Echo the SCM type of the parent workspace, this can't just be which_scm
1426 1454 # as that does not know how to identify various network repositories.
1427 1455 #
1428 1456 function parent_wstype {
1429 1457 typeset scm_type junk
1430 1458
1431 1459 CODEMGR_WS="$BRINGOVER_WS" "$WHICH_SCM" 2>/dev/null \
1432 1460 | read scm_type junk
1433 1461 if [[ -z "$scm_type" || "$scm_type" == unknown ]]; then
1434 1462 # Probe BRINGOVER_WS to determine its type
1435 1463 if [[ $BRINGOVER_WS == ssh://* ]]; then
1436 1464 scm_type="mercurial"
1437 1465 elif [[ $BRINGOVER_WS == http://* ]] && \
1438 1466 wget -q -O- --save-headers "$BRINGOVER_WS/?cmd=heads" | \
1439 1467 egrep -s "application/mercurial" 2> /dev/null; then
1440 1468 scm_type="mercurial"
1441 1469 else
1442 1470 scm_type="none"
1443 1471 fi
1444 1472 fi
1445 1473
1446 1474 # fold both unsupported and unrecognized results into "none"
1447 1475 case "$scm_type" in
1448 1476 mercurial)
1449 1477 ;;
1450 1478 *) scm_type=none
1451 1479 ;;
1452 1480 esac
1453 1481
1454 1482 echo $scm_type
1455 1483 }
1456 1484
1457 1485 # Echo the SCM types of $CODEMGR_WS and $BRINGOVER_WS
1458 1486 function child_wstype {
1459 1487 typeset scm_type junk
1460 1488
1461 1489 # Probe CODEMGR_WS to determine its type
1462 1490 if [[ -d $CODEMGR_WS ]]; then
1463 1491 $WHICH_SCM | read scm_type junk || exit 1
1464 1492 fi
1465 1493
1466 1494 case "$scm_type" in
1467 1495 none|git|mercurial)
1468 1496 ;;
1469 1497 *) scm_type=none
1470 1498 ;;
1471 1499 esac
1472 1500
1473 1501 echo $scm_type
1474 1502 }
1475 1503
1476 1504 SCM_TYPE=$(child_wstype)
1477 1505
1478 1506 #
1479 1507 # Decide whether to clobber
1480 1508 #
1481 1509 if [ "$i_FLAG" = "n" -a -d "$SRC" ]; then
1482 1510 echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE
1483 1511
1484 1512 cd $SRC
1485 1513 # remove old clobber file
1486 1514 rm -f $SRC/clobber.out
1487 1515 rm -f $SRC/clobber-${MACH}.out
↓ open down ↓ |
325 lines elided |
↑ open up ↑ |
1488 1516
1489 1517 # Remove all .make.state* files, just in case we are restarting
1490 1518 # the build after having interrupted a previous 'make clobber'.
1491 1519 find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \
1492 1520 -o -name 'interfaces.*' \) -prune \
1493 1521 -o -name '.make.*' -print | xargs rm -f
1494 1522
1495 1523 $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE
1496 1524 echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file
1497 1525 grep "$MAKE:" $SRC/clobber-${MACH}.out |
1498 - egrep -v "Ignoring unknown host" \
1499 - >> $mail_msg_file
1526 + egrep -v "Ignoring unknown host" | \
1527 + tee $TMPDIR/clobber_errs >> $mail_msg_file
1528 +
1529 + if [[ -s $TMPDIR/clobber_errs ]]; then
1530 + build_extras_ok=n
1531 + fi
1500 1532
1501 1533 if [[ "$t_FLAG" = "y" ]]; then
1502 1534 echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE
1503 1535 cd ${TOOLS}
1504 1536 rm -f ${TOOLS}/clobber-${MACH}.out
1505 1537 $MAKE TOOLS_PROTO=$TOOLS_PROTO -ek clobber 2>&1 | \
1506 1538 tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE
1507 1539 echo "\n==== Make tools clobber ERRORS ====\n" \
1508 1540 >> $mail_msg_file
1509 1541 grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \
1510 1542 >> $mail_msg_file
1543 + if (( $? == 0 )); then
1544 + build_extras_ok=n
1545 + fi
1511 1546 rm -rf ${TOOLS_PROTO}
1512 1547 mkdir -p ${TOOLS_PROTO}
1513 1548 fi
1514 1549
1515 1550 typeset roots=$(allprotos)
1516 1551 echo "\n\nClearing $roots" >> "$LOGFILE"
1517 1552 rm -rf $roots
1518 1553
1519 1554 # Get back to a clean workspace as much as possible to catch
1520 1555 # problems that only occur on fresh workspaces.
1521 1556 # Remove all .make.state* files, libraries, and .o's that may
1522 1557 # have been omitted from clobber. A couple of libraries are
1523 1558 # under source code control, so leave them alone.
1524 1559 # We should probably blow away temporary directories too.
1525 1560 cd $SRC
1526 1561 find $relsrcdirs \( -name SCCS -o -name .hg -o -name .svn \
1527 1562 -o -name .git -o -name 'interfaces.*' \) -prune -o \
1528 1563 \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \
1529 1564 -name '*.o' \) -print | \
1530 1565 grep -v 'tools/ctf/dwarf/.*/libdwarf' | xargs rm -f
1531 1566 else
1532 1567 echo "\n==== No clobber at `date` ====\n" >> $LOGFILE
1533 1568 fi
1534 1569
1535 1570 type bringover_mercurial > /dev/null 2>&1 || function bringover_mercurial {
1536 1571 typeset -x PATH=$PATH
1537 1572
1538 1573 # If the repository doesn't exist yet, then we want to populate it.
1539 1574 if [[ ! -d $CODEMGR_WS/.hg ]]; then
1540 1575 staffer hg init $CODEMGR_WS
1541 1576 staffer echo "[paths]" > $CODEMGR_WS/.hg/hgrc
1542 1577 staffer echo "default=$BRINGOVER_WS" >> $CODEMGR_WS/.hg/hgrc
1543 1578 touch $TMPDIR/new_repository
1544 1579 fi
1545 1580
1546 1581 typeset -x HGMERGE="/bin/false"
1547 1582
1548 1583 #
1549 1584 # If the user has changes, regardless of whether those changes are
1550 1585 # committed, and regardless of whether those changes conflict, then
1551 1586 # we'll attempt to merge them either implicitly (uncommitted) or
1552 1587 # explicitly (committed).
1553 1588 #
1554 1589 # These are the messages we'll use to help clarify mercurial output
1555 1590 # in those cases.
1556 1591 #
1557 1592 typeset mergefailmsg="\
1558 1593 ***\n\
1559 1594 *** nightly was unable to automatically merge your changes. You should\n\
1560 1595 *** redo the full merge manually, following the steps outlined by mercurial\n\
1561 1596 *** above, then restart nightly.\n\
1562 1597 ***\n"
1563 1598 typeset mergepassmsg="\
1564 1599 ***\n\
1565 1600 *** nightly successfully merged your changes. This means that your working\n\
1566 1601 *** directory has been updated, but those changes are not yet committed.\n\
1567 1602 *** After nightly completes, you should validate the results of the merge,\n\
1568 1603 *** then use hg commit manually.\n\
1569 1604 ***\n"
1570 1605
1571 1606 #
1572 1607 # For each repository in turn:
1573 1608 #
1574 1609 # 1. Do the pull. If this fails, dump the output and bail out.
1575 1610 #
1576 1611 # 2. If the pull resulted in an extra head, do an explicit merge.
1577 1612 # If this fails, dump the output and bail out.
1578 1613 #
1579 1614 # Because we can't rely on Mercurial to exit with a failure code
1580 1615 # when a merge fails (Mercurial issue #186), we must grep the
1581 1616 # output of pull/merge to check for attempted and/or failed merges.
1582 1617 #
1583 1618 # 3. If a merge failed, set the message and fail the bringover.
1584 1619 #
1585 1620 # 4. Otherwise, if a merge succeeded, set the message
1586 1621 #
1587 1622 # 5. Dump the output, and any message from step 3 or 4.
1588 1623 #
1589 1624
1590 1625 typeset HG_SOURCE=$BRINGOVER_WS
1591 1626 if [ ! -f $TMPDIR/new_repository ]; then
1592 1627 HG_SOURCE=$TMPDIR/open_bundle.hg
1593 1628 staffer hg --cwd $CODEMGR_WS incoming --bundle $HG_SOURCE \
1594 1629 -v $BRINGOVER_WS > $TMPDIR/incoming_open.out
1595 1630
1596 1631 #
1597 1632 # If there are no incoming changesets, then incoming will
1598 1633 # fail, and there will be no bundle file. Reset the source,
1599 1634 # to allow the remaining logic to complete with no false
1600 1635 # negatives. (Unlike incoming, pull will return success
1601 1636 # for the no-change case.)
1602 1637 #
1603 1638 if (( $? != 0 )); then
1604 1639 HG_SOURCE=$BRINGOVER_WS
1605 1640 fi
1606 1641 fi
1607 1642
1608 1643 staffer hg --cwd $CODEMGR_WS pull -u $HG_SOURCE \
1609 1644 > $TMPDIR/pull_open.out 2>&1
1610 1645 if (( $? != 0 )); then
1611 1646 printf "%s: pull failed as follows:\n\n" "$CODEMGR_WS"
1612 1647 cat $TMPDIR/pull_open.out
1613 1648 if grep "^merging.*failed" $TMPDIR/pull_open.out > /dev/null 2>&1; then
1614 1649 printf "$mergefailmsg"
1615 1650 fi
1616 1651 touch $TMPDIR/bringover_failed
1617 1652 return
1618 1653 fi
1619 1654
1620 1655 if grep "not updating" $TMPDIR/pull_open.out > /dev/null 2>&1; then
1621 1656 staffer hg --cwd $CODEMGR_WS merge \
1622 1657 >> $TMPDIR/pull_open.out 2>&1
1623 1658 if (( $? != 0 )); then
1624 1659 printf "%s: merge failed as follows:\n\n" \
1625 1660 "$CODEMGR_WS"
1626 1661 cat $TMPDIR/pull_open.out
1627 1662 if grep "^merging.*failed" $TMPDIR/pull_open.out \
1628 1663 > /dev/null 2>&1; then
1629 1664 printf "$mergefailmsg"
1630 1665 fi
1631 1666 touch $TMPDIR/bringover_failed
1632 1667 return
1633 1668 fi
1634 1669 fi
1635 1670
1636 1671 printf "updated %s with the following results:\n" "$CODEMGR_WS"
1637 1672 cat $TMPDIR/pull_open.out
1638 1673 if grep "^merging" $TMPDIR/pull_open.out >/dev/null 2>&1; then
1639 1674 printf "$mergepassmsg"
1640 1675 fi
1641 1676 printf "\n"
1642 1677
1643 1678 #
1644 1679 # Per-changeset output is neither useful nor manageable for a
1645 1680 # newly-created repository.
1646 1681 #
1647 1682 if [ -f $TMPDIR/new_repository ]; then
1648 1683 return
1649 1684 fi
1650 1685
1651 1686 printf "\nadded the following changesets to open repository:\n"
1652 1687 cat $TMPDIR/incoming_open.out
1653 1688 }
1654 1689
1655 1690 type bringover_none > /dev/null 2>&1 || function bringover_none {
1656 1691 echo "Couldn't figure out what kind of SCM to use for $BRINGOVER_WS."
1657 1692 touch $TMPDIR/bringover_failed
1658 1693 }
1659 1694
1660 1695 #
1661 1696 # Decide whether to bringover to the codemgr workspace
1662 1697 #
1663 1698 if [ "$n_FLAG" = "n" ]; then
1664 1699 PARENT_SCM_TYPE=$(parent_wstype)
1665 1700
1666 1701 if [[ $SCM_TYPE != none && $SCM_TYPE != $PARENT_SCM_TYPE ]]; then
1667 1702 echo "cannot bringover from $PARENT_SCM_TYPE to $SCM_TYPE, " \
1668 1703 "quitting at `date`." | tee -a $mail_msg_file >> $LOGFILE
1669 1704 exit 1
1670 1705 fi
1671 1706
1672 1707 run_hook PRE_BRINGOVER
1673 1708
1674 1709 echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE
1675 1710 echo "\n==== BRINGOVER LOG ====\n" >> $mail_msg_file
1676 1711
1677 1712 eval "bringover_${PARENT_SCM_TYPE}" 2>&1 |
1678 1713 tee -a $mail_msg_file >> $LOGFILE
1679 1714
1680 1715 if [ -f $TMPDIR/bringover_failed ]; then
1681 1716 rm -f $TMPDIR/bringover_failed
1682 1717 build_ok=n
1683 1718 echo "trouble with bringover, quitting at `date`." |
1684 1719 tee -a $mail_msg_file >> $LOGFILE
1685 1720 exit 1
1686 1721 fi
1687 1722
1688 1723 #
1689 1724 # It's possible that we used the bringover above to create
1690 1725 # $CODEMGR_WS. If so, then SCM_TYPE was previously "none,"
1691 1726 # but should now be the same as $BRINGOVER_WS.
1692 1727 #
1693 1728 [[ $SCM_TYPE = none ]] && SCM_TYPE=$PARENT_SCM_TYPE
1694 1729
1695 1730 run_hook POST_BRINGOVER
1696 1731
1697 1732 check_closed_bins
1698 1733
1699 1734 else
1700 1735 echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE
1701 1736 fi
1702 1737
1703 1738 # Safeguards
1704 1739 [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
1705 1740 [[ -d "${CODEMGR_WS}" ]] || fatal_error "Error: ${CODEMGR_WS} is not a directory."
1706 1741 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
1707 1742
1708 1743 echo "\n==== Build environment ====\n" | tee -a $build_environ_file >> $LOGFILE
1709 1744
1710 1745 # System
1711 1746 whence uname | tee -a $build_environ_file >> $LOGFILE
1712 1747 uname -a 2>&1 | tee -a $build_environ_file >> $LOGFILE
1713 1748 echo | tee -a $build_environ_file >> $LOGFILE
1714 1749
1715 1750 # make
1716 1751 whence $MAKE | tee -a $build_environ_file >> $LOGFILE
1717 1752 $MAKE -v | tee -a $build_environ_file >> $LOGFILE
1718 1753 echo "number of concurrent jobs = $DMAKE_MAX_JOBS" |
1719 1754 tee -a $build_environ_file >> $LOGFILE
1720 1755
1721 1756 #
1722 1757 # Report the compiler versions.
1723 1758 #
1724 1759
1725 1760 if [[ ! -f $SRC/Makefile ]]; then
1726 1761 build_ok=n
1727 1762 echo "\nUnable to find \"Makefile\" in $SRC." | \
1728 1763 tee -a $build_environ_file >> $LOGFILE
1729 1764 exit 1
1730 1765 fi
1731 1766
1732 1767 ( cd $SRC
1733 1768 for target in cc-version cc64-version java-version; do
1734 1769 echo
1735 1770 #
1736 1771 # Put statefile somewhere we know we can write to rather than trip
1737 1772 # over a read-only $srcroot.
1738 1773 #
1739 1774 rm -f $TMPDIR/make-state
1740 1775 export SRC
1741 1776 if $MAKE -K $TMPDIR/make-state -e $target 2>/dev/null; then
1742 1777 continue
1743 1778 fi
1744 1779 touch $TMPDIR/nocompiler
1745 1780 done
1746 1781 echo
1747 1782 ) | tee -a $build_environ_file >> $LOGFILE
1748 1783
1749 1784 if [ -f $TMPDIR/nocompiler ]; then
1750 1785 rm -f $TMPDIR/nocompiler
1751 1786 build_ok=n
1752 1787 echo "Aborting due to missing compiler." |
1753 1788 tee -a $build_environ_file >> $LOGFILE
1754 1789 exit 1
1755 1790 fi
1756 1791
1757 1792 # as
1758 1793 whence as | tee -a $build_environ_file >> $LOGFILE
1759 1794 as -V 2>&1 | head -1 | tee -a $build_environ_file >> $LOGFILE
1760 1795 echo | tee -a $build_environ_file >> $LOGFILE
1761 1796
1762 1797 # Check that we're running a capable link-editor
1763 1798 whence ld | tee -a $build_environ_file >> $LOGFILE
1764 1799 LDVER=`ld -V 2>&1`
1765 1800 echo $LDVER | tee -a $build_environ_file >> $LOGFILE
1766 1801 LDVER=`echo $LDVER | sed -e "s/.*-1\.\([0-9]*\).*/\1/"`
1767 1802 if [ `expr $LDVER \< 422` -eq 1 ]; then
1768 1803 echo "The link-editor needs to be at version 422 or higher to build" | \
1769 1804 tee -a $build_environ_file >> $LOGFILE
1770 1805 echo "the latest stuff. Hope your build works." | \
↓ open down ↓ |
250 lines elided |
↑ open up ↑ |
1771 1806 tee -a $build_environ_file >> $LOGFILE
1772 1807 fi
1773 1808
1774 1809 #
1775 1810 # Build and use the workspace's tools if requested
1776 1811 #
1777 1812 if [[ "$t_FLAG" = "y" ]]; then
1778 1813 set_non_debug_build_flags
1779 1814
1780 1815 build_tools ${TOOLS_PROTO}
1781 - if [[ $? != 0 && "$t_FLAG" = y ]]; then
1816 + if (( $? != 0 )); then
1817 + build_ok=n
1818 + else
1782 1819 use_tools $TOOLS_PROTO
1783 1820 fi
1784 1821 fi
1785 1822
1786 1823 # timestamp the start of the normal build; the findunref tool uses it.
1787 1824 touch $SRC/.build.tstamp
1788 1825
1789 1826 normal_build
1790 1827
1791 1828 ORIG_SRC=$SRC
1792 1829 BINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z
1793 1830
1794 1831
1795 1832 #
1796 1833 # There are several checks that need to look at the proto area, but
1797 1834 # they only need to look at one, and they don't care whether it's
1798 1835 # DEBUG or non-DEBUG.
1799 1836 #
1800 1837 if [[ "$MULTI_PROTO" = yes && "$D_FLAG" = n ]]; then
1801 1838 checkroot=$ROOT-nd
1802 1839 else
1803 1840 checkroot=$ROOT
1804 1841 fi
1805 1842
1806 1843 if [ "$build_ok" = "y" ]; then
1807 1844 echo "\n==== Creating protolist system file at `date` ====" \
1808 1845 >> $LOGFILE
1809 1846 protolist $checkroot > $ATLOG/proto_list_${MACH}
1810 1847 echo "==== protolist system file created at `date` ====\n" \
1811 1848 >> $LOGFILE
1812 1849
1813 1850 if [ "$N_FLAG" != "y" ]; then
1814 1851
1815 1852 E1=
1816 1853 f1=
1817 1854 for f in $f1; do
1818 1855 if [ -f "$f" ]; then
1819 1856 E1="$E1 -e $f"
1820 1857 fi
1821 1858 done
1822 1859
1823 1860 E2=
1824 1861 f2=
1825 1862 if [ -d "$SRC/pkg" ]; then
1826 1863 f2="$f2 exceptions/packaging"
1827 1864 fi
1828 1865
↓ open down ↓ |
37 lines elided |
↑ open up ↑ |
1829 1866 for f in $f2; do
1830 1867 if [ -f "$f" ]; then
1831 1868 E2="$E2 -e $f"
1832 1869 fi
1833 1870 done
1834 1871 fi
1835 1872
1836 1873 if [ "$N_FLAG" != "y" -a -d $SRC/pkg ]; then
1837 1874 echo "\n==== Validating manifests against proto area ====\n" \
1838 1875 >> $mail_msg_file
1839 - ( cd $SRC/pkg ; $MAKE -e protocmp ROOT="$checkroot" ) \
1840 - >> $mail_msg_file
1841 -
1876 + ( cd $SRC/pkg ; $MAKE -e protocmp ROOT="$checkroot" ) | \
1877 + tee $TMPDIR/protocmp_noise >> $mail_msg_file
1878 + if [[ -s $TMPDIR/protocmp_noise ]]; then
1879 + build_extras_ok=n
1880 + fi
1842 1881 fi
1843 1882
1844 1883 if [ "$N_FLAG" != "y" -a -f "$REF_PROTO_LIST" ]; then
1845 1884 echo "\n==== Impact on proto area ====\n" >> $mail_msg_file
1846 1885 if [ -n "$E2" ]; then
1847 1886 ELIST=$E2
1848 1887 else
1849 1888 ELIST=$E1
1850 1889 fi
1851 1890 $PROTOCMPTERSE \
1852 1891 "Files in yesterday's proto area, but not today's:" \
1853 1892 "Files in today's proto area, but not yesterday's:" \
1854 1893 "Files that changed between yesterday and today:" \
1855 1894 ${ELIST} \
1856 1895 -d $REF_PROTO_LIST \
1857 1896 $ATLOG/proto_list_${MACH} \
1858 1897 >> $mail_msg_file
1859 1898 fi
1860 1899 fi
1861 1900
1862 -if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
1901 +if [[ "$u_FLAG" == "y" && "$build_ok" == "y" && \
1902 + "$build_extras_ok" == "y" ]]; then
1863 1903 staffer cp $ATLOG/proto_list_${MACH} \
1864 1904 $PARENT_WS/usr/src/proto_list_${MACH}
1865 1905 fi
1866 1906
1867 1907 # Update parent proto area if necessary. This is done now
1868 1908 # so that the proto area has either DEBUG or non-DEBUG kernels.
1869 1909 # Note that this clears out the lock file, so we can dispense with
1870 1910 # the variable now.
1871 1911 if [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then
1872 1912 echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \
1873 1913 tee -a $LOGFILE >> $mail_msg_file
1874 1914 rm -rf $NIGHTLY_PARENT_ROOT/*
1875 1915 unset Ulockfile
1876 1916 mkdir -p $NIGHTLY_PARENT_ROOT
1877 1917 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
1878 1918 ( cd $ROOT; tar cf - . |
1879 1919 ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf - ) ) 2>&1 |
1880 1920 tee -a $mail_msg_file >> $LOGFILE
1881 1921 fi
1882 1922 if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n ]]; then
1883 1923 rm -rf $NIGHTLY_PARENT_ROOT-nd/*
1884 1924 mkdir -p $NIGHTLY_PARENT_ROOT-nd
1885 1925 cd $ROOT-nd
1886 1926 ( tar cf - . |
1887 1927 ( cd $NIGHTLY_PARENT_ROOT-nd; umask 0; tar xpf - ) ) 2>&1 |
1888 1928 tee -a $mail_msg_file >> $LOGFILE
1889 1929 fi
1890 1930 if [ -n "${NIGHTLY_PARENT_TOOLS_ROOT}" ]; then
1891 1931 echo "\n==== Copying tools proto area to $NIGHTLY_PARENT_TOOLS_ROOT ====\n" | \
1892 1932 tee -a $LOGFILE >> $mail_msg_file
1893 1933 rm -rf $NIGHTLY_PARENT_TOOLS_ROOT/*
1894 1934 mkdir -p $NIGHTLY_PARENT_TOOLS_ROOT
1895 1935 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
1896 1936 ( cd $TOOLS_PROTO; tar cf - . |
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
1897 1937 ( cd $NIGHTLY_PARENT_TOOLS_ROOT;
1898 1938 umask 0; tar xpf - ) ) 2>&1 |
1899 1939 tee -a $mail_msg_file >> $LOGFILE
1900 1940 fi
1901 1941 fi
1902 1942 fi
1903 1943
1904 1944 #
1905 1945 # ELF verification: ABI (-A) and runtime (-r) checks
1906 1946 #
1907 -if [[ ($build_ok = y) && ( ($A_FLAG = y) || ($r_FLAG = y) ) ]]; then
1947 +if [[ ($build_ok = y) && (($A_FLAG = y) || ($r_FLAG = y)) ]]; then
1908 1948 # Directory ELF-data.$MACH holds the files produced by these tests.
1909 1949 elf_ddir=$SRC/ELF-data.$MACH
1910 1950
1911 1951 # If there is a previous ELF-data backup directory, remove it. Then,
1912 1952 # rotate current ELF-data directory into its place and create a new
1913 1953 # empty directory
1914 1954 rm -rf $elf_ddir.ref
1915 1955 if [[ -d $elf_ddir ]]; then
1916 1956 mv $elf_ddir $elf_ddir.ref
1917 1957 fi
1918 1958 mkdir -p $elf_ddir
1919 1959
1920 1960 # Call find_elf to produce a list of the ELF objects in the proto area.
1921 1961 # This list is passed to check_rtime and interface_check, preventing
1922 1962 # them from separately calling find_elf to do the same work twice.
1923 1963 find_elf -fr $checkroot > $elf_ddir/object_list
↓ open down ↓ |
6 lines elided |
↑ open up ↑ |
1924 1964
1925 1965 if [[ $A_FLAG = y ]]; then
1926 1966 echo "\n==== Check versioning and ABI information ====\n" | \
1927 1967 tee -a $LOGFILE >> $mail_msg_file
1928 1968
1929 1969 # Produce interface description for the proto. Report errors.
1930 1970 interface_check -o -w $elf_ddir -f object_list \
1931 1971 -i interface -E interface.err
1932 1972 if [[ -s $elf_ddir/interface.err ]]; then
1933 1973 tee -a $LOGFILE < $elf_ddir/interface.err \
1934 - >> $mail_msg_file
1974 + >> $mail_msg_file
1975 + build_extras_ok=n
1935 1976 fi
1936 1977
1937 1978 # If ELF_DATA_BASELINE_DIR is defined, compare the new interface
1938 1979 # description file to that from the baseline gate. Issue a
1939 1980 # warning if the baseline is not present, and keep going.
1940 1981 if [[ "$ELF_DATA_BASELINE_DIR" != '' ]]; then
1941 1982 base_ifile="$ELF_DATA_BASELINE_DIR/interface"
1942 1983
1943 1984 echo "\n==== Compare versioning and ABI information" \
1944 1985 "to baseline ====\n" | \
1945 1986 tee -a $LOGFILE >> $mail_msg_file
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
1946 1987 echo "Baseline: $base_ifile\n" >> $LOGFILE
1947 1988
1948 1989 if [[ -f $base_ifile ]]; then
1949 1990 interface_cmp -d -o $base_ifile \
1950 1991 $elf_ddir/interface > $elf_ddir/interface.cmp
1951 1992 if [[ -s $elf_ddir/interface.cmp ]]; then
1952 1993 echo | tee -a $LOGFILE >> $mail_msg_file
1953 1994 tee -a $LOGFILE < \
1954 1995 $elf_ddir/interface.cmp \
1955 1996 >> $mail_msg_file
1997 + build_extras_ok=n
1956 1998 fi
1957 1999 else
1958 2000 echo "baseline not available. comparison" \
1959 2001 "skipped" | \
1960 2002 tee -a $LOGFILE >> $mail_msg_file
1961 2003 fi
1962 2004
1963 2005 fi
1964 2006 fi
1965 2007
1966 2008 if [[ $r_FLAG = y ]]; then
1967 2009 echo "\n==== Check ELF runtime attributes ====\n" | \
1968 2010 tee -a $LOGFILE >> $mail_msg_file
1969 2011
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
1970 2012 # If we're doing a DEBUG build the proto area will be left
1971 2013 # with debuggable objects, thus don't assert -s.
1972 2014 if [[ $D_FLAG = y ]]; then
1973 2015 rtime_sflag=""
1974 2016 else
1975 2017 rtime_sflag="-s"
1976 2018 fi
1977 2019 check_rtime -i -m -v $rtime_sflag -o -w $elf_ddir \
1978 2020 -D object_list -f object_list -E runtime.err \
1979 2021 -I runtime.attr.raw
2022 + if (( $? != 0 )); then
2023 + build_extras_ok=n
2024 + fi
1980 2025
1981 2026 # check_rtime -I output needs to be sorted in order to
1982 2027 # compare it to that from previous builds.
1983 2028 sort $elf_ddir/runtime.attr.raw > $elf_ddir/runtime.attr
1984 2029 rm $elf_ddir/runtime.attr.raw
1985 2030
1986 2031 # Report errors
1987 2032 if [[ -s $elf_ddir/runtime.err ]]; then
1988 2033 tee -a $LOGFILE < $elf_ddir/runtime.err \
1989 2034 >> $mail_msg_file
2035 + build_extras_ok=n
1990 2036 fi
1991 2037
1992 2038 # If there is an ELF-data directory from a previous build,
1993 2039 # then diff the attr files. These files contain information
1994 2040 # about dependencies, versioning, and runpaths. There is some
1995 2041 # overlap with the ABI checking done above, but this also
1996 2042 # flushes out non-ABI interface differences along with the
1997 2043 # other information.
1998 2044 echo "\n==== Diff ELF runtime attributes" \
1999 2045 "(since last build) ====\n" | \
2000 2046 tee -a $LOGFILE >> $mail_msg_file >> $mail_msg_file
2001 2047
2002 2048 if [[ -f $elf_ddir.ref/runtime.attr ]]; then
2003 2049 diff $elf_ddir.ref/runtime.attr \
2004 2050 $elf_ddir/runtime.attr \
2005 2051 >> $mail_msg_file
2006 2052 fi
2007 2053 fi
2008 2054
2009 2055 # If -u set, copy contents of ELF-data.$MACH to the parent workspace.
2010 2056 if [[ "$u_FLAG" = "y" ]]; then
2011 2057 p_elf_ddir=$PARENT_WS/usr/src/ELF-data.$MACH
2012 2058
2013 2059 # If parent lacks the ELF-data.$MACH directory, create it
2014 2060 if [[ ! -d $p_elf_ddir ]]; then
2015 2061 staffer mkdir -p $p_elf_ddir
2016 2062 fi
2017 2063
2018 2064 # These files are used asynchronously by other builds for ABI
2019 2065 # verification, as above for the -A option. As such, we require
2020 2066 # the file replacement to be atomic. Copy the data to a temp
2021 2067 # file in the same filesystem and then rename into place.
2022 2068 (
2023 2069 cd $elf_ddir
2024 2070 for elf_dfile in *; do
2025 2071 staffer cp $elf_dfile \
2026 2072 ${p_elf_ddir}/${elf_dfile}.new
2027 2073 staffer mv -f ${p_elf_ddir}/${elf_dfile}.new \
2028 2074 ${p_elf_ddir}/${elf_dfile}
2029 2075 done
2030 2076 )
2031 2077 fi
2032 2078 fi
2033 2079
2034 2080 # DEBUG lint of kernel begins
2035 2081
2036 2082 if [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then
2037 2083 if [ "$LINTDIRS" = "" ]; then
2038 2084 # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y"
2039 2085 LINTDIRS="$SRC y"
2040 2086 fi
2041 2087 set $LINTDIRS
2042 2088 while [ $# -gt 0 ]; do
2043 2089 dolint $1 $2; shift; shift
2044 2090 done
2045 2091 else
2046 2092 echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE
2047 2093 fi
2048 2094
2049 2095 # "make check" begins
2050 2096
2051 2097 if [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then
2052 2098 # remove old check.out
↓ open down ↓ |
53 lines elided |
↑ open up ↑ |
2053 2099 rm -f $SRC/check.out
2054 2100
2055 2101 rm -f $SRC/check-${MACH}.out
2056 2102 cd $SRC
2057 2103 $MAKE -ek check ROOT="$checkroot" 2>&1 | tee -a $SRC/check-${MACH}.out \
2058 2104 >> $LOGFILE
2059 2105 echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file
2060 2106
2061 2107 grep ":" $SRC/check-${MACH}.out |
2062 2108 egrep -v "Ignoring unknown host" | \
2063 - sort | uniq >> $mail_msg_file
2109 + sort | uniq | tee $TMPDIR/check_errors >> $mail_msg_file
2110 +
2111 + if [[ -s $TMPDIR/check_errors ]]; then
2112 + build_extras_ok=n
2113 + fi
2064 2114 else
2065 2115 echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE
2066 2116 fi
2067 2117
2068 2118 echo "\n==== Find core files ====\n" | \
2069 2119 tee -a $LOGFILE >> $mail_msg_file
2070 2120
2071 2121 find $abssrcdirs -name core -a -type f -exec file {} \; | \
2072 2122 tee -a $LOGFILE >> $mail_msg_file
2073 2123
2074 2124 if [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then
2075 2125 echo "\n==== Diff unreferenced files (since last build) ====\n" \
2076 2126 | tee -a $LOGFILE >>$mail_msg_file
2077 2127 rm -f $SRC/unref-${MACH}.ref
2078 2128 if [ -f $SRC/unref-${MACH}.out ]; then
2079 2129 mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref
2080 2130 fi
2081 2131
2082 2132 findunref -S $SCM_TYPE -t $SRC/.build.tstamp -s usr $CODEMGR_WS \
2083 2133 ${TOOLS}/findunref/exception_list 2>> $mail_msg_file | \
2084 2134 sort > $SRC/unref-${MACH}.out
2085 2135
2086 2136 if [ ! -f $SRC/unref-${MACH}.ref ]; then
2087 2137 cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref
2088 2138 fi
2089 2139
2090 2140 diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file
2091 2141 fi
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
2092 2142
2093 2143 # Verify that the usual lists of files, such as exception lists,
2094 2144 # contain only valid references to files. If the build has failed,
2095 2145 # then don't check the proto area.
2096 2146 CHECK_PATHS=${CHECK_PATHS:-y}
2097 2147 if [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then
2098 2148 echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \
2099 2149 >>$mail_msg_file
2100 2150 arg=-b
2101 2151 [ "$build_ok" = y ] && arg=
2102 - checkpaths $arg $checkroot 2>&1 | tee -a $LOGFILE >>$mail_msg_file
2152 + checkpaths $arg $checkroot > $SRC/checkpaths.out 2>&1
2153 + if [[ -s $SRC/checkpaths.out ]]; then
2154 + tee -a $LOGFILE < $SRC/checkpaths.out >> $mail_msg_file
2155 + build_extras_ok=n
2156 + fi
2103 2157 fi
2104 2158
2105 2159 if [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then
2106 2160 echo "\n==== Impact on file permissions ====\n" \
2107 2161 >> $mail_msg_file
2108 2162
2109 2163 abspkg=
2110 2164 for d in $abssrcdirs; do
2111 2165 if [ -d "$d/pkg" ]; then
2112 2166 abspkg="$abspkg $d"
2113 2167 fi
2114 2168 done
2115 2169
2116 2170 if [ -n "$abspkg" ]; then
2117 2171 for d in "$abspkg"; do
2118 2172 ( cd $d/pkg ; $MAKE -e pmodes ) >> $mail_msg_file
2119 2173 done
2120 2174 fi
2121 2175 fi
2122 2176
2123 2177 if [ "$w_FLAG" = "y" -a "$build_ok" = "y" ]; then
2124 2178 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
2125 2179 do_wsdiff DEBUG $ROOT.prev $ROOT
2126 2180 fi
2127 2181
2128 2182 if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n ]]; then
2129 2183 do_wsdiff non-DEBUG $ROOT-nd.prev $ROOT-nd
2130 2184 fi
2131 2185 fi
2132 2186
2133 2187 END_DATE=`date`
2134 2188 echo "==== Nightly $maketype build completed: $END_DATE ====" | \
2135 2189 tee -a $LOGFILE >> $build_time_file
2136 2190
2137 2191 typeset -i10 hours
2138 2192 typeset -Z2 minutes
2139 2193 typeset -Z2 seconds
2140 2194
2141 2195 elapsed_time=$SECONDS
2142 2196 ((hours = elapsed_time / 3600 ))
2143 2197 ((minutes = elapsed_time / 60 % 60))
2144 2198 ((seconds = elapsed_time % 60))
2145 2199
2146 2200 echo "\n==== Total build time ====" | \
2147 2201 tee -a $LOGFILE >> $build_time_file
2148 2202 echo "\nreal ${hours}:${minutes}:${seconds}" | \
2149 2203 tee -a $LOGFILE >> $build_time_file
2150 2204
2151 2205 if [ "$u_FLAG" = "y" -a "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then
2152 2206 staffer cp ${SRC}/unref-${MACH}.out $PARENT_WS/usr/src/
2153 2207
2154 2208 #
2155 2209 # Produce a master list of unreferenced files -- ideally, we'd
2156 2210 # generate the master just once after all of the nightlies
2157 2211 # have finished, but there's no simple way to know when that
2158 2212 # will be. Instead, we assume that we're the last nightly to
2159 2213 # finish and merge all of the unref-${MACH}.out files in
2160 2214 # $PARENT_WS/usr/src/. If we are in fact the final ${MACH} to
2161 2215 # finish, then this file will be the authoritative master
2162 2216 # list. Otherwise, another ${MACH}'s nightly will eventually
2163 2217 # overwrite ours with its own master, but in the meantime our
2164 2218 # temporary "master" will be no worse than any older master
2165 2219 # which was already on the parent.
2166 2220 #
2167 2221
2168 2222 set -- $PARENT_WS/usr/src/unref-*.out
2169 2223 cp "$1" ${TMPDIR}/unref.merge
2170 2224 shift
2171 2225
2172 2226 for unreffile; do
2173 2227 comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$
2174 2228 mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge
↓ open down ↓ |
62 lines elided |
↑ open up ↑ |
2175 2229 done
2176 2230
2177 2231 staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out
2178 2232 fi
2179 2233
2180 2234 #
2181 2235 # All done save for the sweeping up.
2182 2236 # (whichever exit we hit here will trigger the "cleanup" trap which
2183 2237 # optionally sends mail on completion).
2184 2238 #
2185 -if [ "$build_ok" = "y" ]; then
2239 +if [[ "$build_ok" == "y" && "$build_extras_ok" == "y" ]]; then
2186 2240 exit 0
2187 2241 fi
2188 2242 exit 1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX