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