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