Print this page
4028 remove CLOSED_IS_PRESENT
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/scripts/nightly.sh
+++ new/usr/src/tools/scripts/nightly.sh
1 1 #!/bin/ksh -p
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 24 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 25 # Copyright 2008, 2010, Richard Lowe
26 26 # Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27 27 # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
28 28 #
29 29 # Based on the nightly script from the integration folks,
30 30 # Mostly modified and owned by mike_s.
31 31 # Changes also by kjc, dmk.
32 32 #
33 33 # BRINGOVER_WS may be specified in the env file.
34 34 # The default is the old behavior of CLONE_WS
35 35 #
36 36 # -i on the command line, means fast options, so when it's on the
37 37 # command line (only), lint and check builds are skipped no matter what
38 38 # the setting of their individual flags are in NIGHTLY_OPTIONS.
39 39 #
40 40 # LINTDIRS can be set in the env file, format is a list of:
41 41 #
42 42 # /dirname-to-run-lint-on flag
43 43 #
44 44 # Where flag is: y - enable lint noise diff output
45 45 # n - disable lint noise diff output
46 46 #
47 47 # For example: LINTDIRS="$SRC/uts n $SRC/stand y $SRC/psm y"
48 48 #
49 49 # OPTHOME and TEAMWARE may be set in the environment to override /opt
50 50 # and /opt/teamware defaults.
51 51 #
52 52
53 53 #
54 54 # The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
55 55 # under certain circumstances, which can really screw things up; unset it.
56 56 #
57 57 unset CDPATH
58 58
59 59 # Get the absolute path of the nightly script that the user invoked. This
60 60 # may be a relative path, and we need to do this before changing directory.
61 61 nightly_path=`whence $0`
62 62
63 63 #
64 64 # Keep track of where we found nightly so we can invoke the matching
65 65 # which_scm script. If that doesn't work, don't go guessing, just rely
66 66 # on the $PATH settings, which will generally give us either /opt/onbld
67 67 # or the user's workspace.
68 68 #
69 69 WHICH_SCM=$(dirname $nightly_path)/which_scm
70 70 if [[ ! -x $WHICH_SCM ]]; then
71 71 WHICH_SCM=which_scm
72 72 fi
73 73
74 74 function fatal_error
75 75 {
76 76 print -u2 "nightly: $*"
77 77 exit 1
78 78 }
79 79
80 80 #
81 81 # Function to do a DEBUG and non-DEBUG build. Needed because we might
82 82 # need to do another for the source build, and since we only deliver DEBUG or
83 83 # non-DEBUG packages.
84 84 #
85 85 # usage: normal_build
86 86 #
87 87 function normal_build {
88 88
89 89 typeset orig_p_FLAG="$p_FLAG"
90 90 typeset crypto_signer="$CODESIGN_USER"
91 91
92 92 suffix=""
93 93
94 94 # non-DEBUG build begins
95 95
96 96 if [ "$F_FLAG" = "n" ]; then
97 97 set_non_debug_build_flags
98 98 CODESIGN_USER="$crypto_signer" \
99 99 build "non-DEBUG" "$suffix-nd" "-nd" "$MULTI_PROTO"
100 100 if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a \
101 101 "$p_FLAG" = "y" ]; then
102 102 copy_ihv_pkgs non-DEBUG -nd
103 103 fi
104 104 else
105 105 echo "\n==== No non-DEBUG $open_only build ====\n" >> "$LOGFILE"
106 106 fi
107 107
108 108 # non-DEBUG build ends
109 109
110 110 # DEBUG build begins
111 111
112 112 if [ "$D_FLAG" = "y" ]; then
113 113 set_debug_build_flags
114 114 CODESIGN_USER="$crypto_signer" \
115 115 build "DEBUG" "$suffix" "" "$MULTI_PROTO"
116 116 if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a \
117 117 "$p_FLAG" = "y" ]; then
118 118 copy_ihv_pkgs DEBUG ""
119 119 fi
120 120 else
121 121 echo "\n==== No DEBUG $open_only build ====\n" >> "$LOGFILE"
122 122 fi
123 123
124 124 # DEBUG build ends
125 125
126 126 p_FLAG="$orig_p_FLAG"
127 127 }
128 128
129 129 #
130 130 # usage: run_hook HOOKNAME ARGS...
131 131 #
132 132 # If variable "$HOOKNAME" is defined, insert a section header into
133 133 # our logs and then run the command with ARGS
134 134 #
135 135 function run_hook {
136 136 HOOKNAME=$1
137 137 eval HOOKCMD=\$$HOOKNAME
138 138 shift
139 139
140 140 if [ -n "$HOOKCMD" ]; then
141 141 (
142 142 echo "\n==== Running $HOOKNAME command: $HOOKCMD ====\n"
143 143 ( $HOOKCMD "$@" 2>&1 )
144 144 if [ "$?" -ne 0 ]; then
145 145 # Let exit status propagate up
146 146 touch $TMPDIR/abort
147 147 fi
148 148 ) | tee -a $mail_msg_file >> $LOGFILE
149 149
150 150 if [ -f $TMPDIR/abort ]; then
151 151 build_ok=n
152 152 echo "\nAborting at request of $HOOKNAME" |
153 153 tee -a $mail_msg_file >> $LOGFILE
154 154 exit 1
155 155 fi
156 156 fi
157 157 }
158 158
159 159 #
160 160 # usage: filelist DESTDIR PATTERN
161 161 #
162 162 function filelist {
163 163 DEST=$1
164 164 PATTERN=$2
165 165 cd ${DEST}
166 166 }
167 167
168 168 # function to save off binaries after a full build for later
169 169 # restoration
170 170 function save_binaries {
171 171 # save off list of binaries
172 172 echo "\n==== Saving binaries from build at `date` ====\n" | \
173 173 tee -a $mail_msg_file >> $LOGFILE
174 174 rm -f ${BINARCHIVE}
175 175 cd ${CODEMGR_WS}
176 176 filelist ${CODEMGR_WS} '^preserve:' >> $LOGFILE
177 177 filelist ${CODEMGR_WS} '^preserve:' | \
178 178 cpio -ocB 2>/dev/null | compress \
179 179 > ${BINARCHIVE}
180 180 }
181 181
182 182 # delete files
183 183 # usage: hybridize_files DESTDIR MAKE_TARGET
184 184 function hybridize_files {
185 185 DEST=$1
186 186 MAKETARG=$2
187 187
188 188 echo "\n==== Hybridizing files at `date` ====\n" | \
189 189 tee -a $mail_msg_file >> $LOGFILE
190 190 for i in `filelist ${DEST} '^delete:'`
191 191 do
192 192 echo "removing ${i}." | tee -a $mail_msg_file >> $LOGFILE
193 193 rm -rf "${i}"
194 194 done
195 195 for i in `filelist ${DEST} '^hybridize:' `
196 196 do
197 197 echo "hybridizing ${i}." | tee -a $mail_msg_file >> $LOGFILE
198 198 rm -f ${i}+
199 199 sed -e "/^# HYBRID DELETE START/,/^# HYBRID DELETE END/d" \
200 200 < ${i} > ${i}+
201 201 mv ${i}+ ${i}
202 202 done
203 203 }
204 204
205 205 # restore binaries into the proper source tree.
206 206 # usage: restore_binaries DESTDIR MAKE_TARGET
207 207 function restore_binaries {
208 208 DEST=$1
209 209 MAKETARG=$2
210 210
211 211 echo "\n==== Restoring binaries to ${MAKETARG} at `date` ====\n" | \
212 212 tee -a $mail_msg_file >> $LOGFILE
213 213 cd ${DEST}
214 214 zcat ${BINARCHIVE} | \
215 215 cpio -idmucvB 2>/dev/null | tee -a $mail_msg_file >> ${LOGFILE}
216 216 }
217 217
218 218 # rename files we save binaries of
219 219 # usage: rename_files DESTDIR MAKE_TARGET
220 220 function rename_files {
221 221 DEST=$1
222 222 MAKETARG=$2
223 223 echo "\n==== Renaming source files in ${MAKETARG} at `date` ====\n" | \
224 224 tee -a $mail_msg_file >> $LOGFILE
225 225 for i in `filelist ${DEST} '^rename:'`
226 226 do
227 227 echo ${i} | tee -a $mail_msg_file >> ${LOGFILE}
228 228 rm -f ${i}.export
229 229 mv ${i} ${i}.export
230 230 done
231 231 }
232 232
233 233 #
234 234 # Copy some or all of the source tree.
235 235 #
236 236 # Returns 0 for success, non-zero for failure.
237 237 #
238 238 # usage: copy_source CODEMGR_WS DESTDIR LABEL SRCROOT
239 239 #
240 240 function copy_source {
241 241 WS=$1
242 242 DEST=$2
243 243 label=$3
244 244 srcroot=$4
245 245
246 246 printf "\n==== Creating %s source from %s (%s) ====\n\n" \
247 247 "$DEST" "$WS" "$label" | tee -a $mail_msg_file >> $LOGFILE
248 248
249 249 printf "cleaning out %s\n" "$DEST." >> $LOGFILE
250 250 rm -rf "$DEST" >> $LOGFILE 2>&1
251 251
252 252 printf "creating %s\n" "$DEST." >> $LOGFILE
253 253 mkdir -p "$DEST" 2>> $LOGFILE
254 254
255 255 if (( $? != 0 )) ; then
256 256 printf "failed to create %s\n" "$DEST" |
257 257 tee -a $mail_msg_file >> $LOGFILE
258 258 build_ok=n
259 259 return 1
260 260 fi
261 261 cd "$WS"
262 262
263 263 printf "populating %s\n" "$DEST." >> $LOGFILE
264 264
265 265 case "$SCM_TYPE" in
266 266 teamware)
267 267 find $srcroot -name 's\.*' -a -type f -print | \
268 268 sed -e 's,SCCS\/s.,,' | \
269 269 grep -v '/\.del-*' | \
270 270 cpio -pd $DEST >>$LOGFILE 2>&1
271 271 if (( $? != 0 )) ; then
272 272 printf "cpio failed for %s\n" "$DEST" |
273 273 tee -a $mail_msg_file >> $LOGFILE
274 274 build_ok=n
275 275 return 1
276 276 fi
277 277 ;;
278 278 mercurial)
279 279 copy_source_mercurial $DEST $srcroot
280 280 if (( $? != 0 )) ; then
281 281 build_ok=n
282 282 return 1
283 283 fi
284 284 ;;
285 285 *)
286 286 build_ok=n
↓ open down ↓ |
286 lines elided |
↑ open up ↑ |
287 287 echo "Tree copy is not supported for workspace type" \
288 288 "$SCM_TYPE" | tee -a $mail_msg_file >> $LOGFILE
289 289 return 1
290 290 ;;
291 291 esac
292 292
293 293 return 0
294 294 }
295 295
296 296 #
297 -# Mercurial-specific copy code for copy_source(). Handles the
298 -# combined open and closed trees.
297 +# Mercurial-specific copy code for copy_source().
299 298 #
300 299 # Returns 0 for success, non-zero for failure.
301 300 #
302 301 # usage: copy_source_mercurial destdir srcroot
303 302 #
304 303 function copy_source_mercurial {
305 304 typeset dest=$1
306 305 typeset srcroot=$2
307 - typeset open_top closed_top
308 306
309 - case $srcroot in
310 - usr)
311 - open_top=usr
312 - if [[ "$CLOSED_IS_PRESENT" = yes ]]; then
313 - closed_top=usr/closed
314 - fi
315 - ;;
316 - usr/closed*)
317 - if [[ "$CLOSED_IS_PRESENT" = no ]]; then
318 - printf "can't copy %s: closed tree not present.\n" \
319 - "$srcroot" | tee -a $mail_msg_file >> $LOGFILE
320 - return 1
321 - fi
322 - closed_top="$srcroot"
323 - ;;
324 - *)
325 - open_top="$srcroot"
326 - ;;
327 - esac
328 -
329 - if [[ -n "$open_top" ]]; then
330 - hg locate -I "$open_top" | cpio -pd "$dest" >>$LOGFILE 2>&1
331 - if (( $? != 0 )) ; then
332 - printf "cpio failed for %s\n" "$dest" |
333 - tee -a $mail_msg_file >> $LOGFILE
334 - return 1
335 - fi
336 - fi
337 -
338 - if [[ -n "$closed_top" ]]; then
339 - mkdir -p "$dest/usr/closed" || return 1
340 - if [[ "$closed_top" = usr/closed ]]; then
341 - (cd usr/closed; hg locate |
342 - cpio -pd "$dest/usr/closed") >>$LOGFILE 2>&1
343 - if (( $? != 0 )) ; then
344 - printf "cpio failed for %s/usr/closed\n" \
345 - "$dest" | tee -a $mail_msg_file >> $LOGFILE
346 - return 1
347 - fi
348 - else
349 - # copy subtree of usr/closed
350 - closed_top=${closed_top#usr/closed/}
351 - (cd usr/closed; hg locate -I "$closed_top" |
352 - cpio -pd "$dest/usr/closed") >>$LOGFILE 2>&1
353 - if (( $? != 0 )) ; then
354 - printf "cpio failed for %s/usr/closed/%s\n" \
355 - "$dest" "$closed_top" |
356 - tee -a $mail_msg_file >> $LOGFILE
357 - return 1
358 - fi
359 - fi
307 + hg locate -I "$srcroot" | cpio -pd "$dest" >>$LOGFILE 2>&1
308 + if (( $? != 0 )) ; then
309 + printf "cpio failed for %s\n" "$dest" |
310 + tee -a $mail_msg_file >> $LOGFILE
311 + return 1
360 312 fi
361 313
362 314 return 0
363 315 }
364 316
365 317 #
366 318 # function to create (but not build) the export/crypt source tree.
367 319 # usage: set_up_source_build CODEMGR_WS DESTDIR MAKE_TARGET
368 320 # Sets SRC to the modified source tree, for use by the caller when it
369 321 # builds the tree.
370 322 #
371 323 function set_up_source_build {
372 324 WS=$1
373 325 DEST=$2
374 326 MAKETARG=$3
375 327
376 328 copy_source $WS $DEST $MAKETARG usr
377 329 if (( $? != 0 )); then
378 330 echo "\nCould not copy source tree for source build." |
379 331 tee -a $mail_msg_file >> $LOGFILE
380 332 build_ok=n
381 333 return
382 334 fi
383 335
384 336 SRC=${DEST}/usr/src
385 337
386 338 cd $SRC
387 339 rm -f ${MAKETARG}.out
388 340 echo "making ${MAKETARG} in ${SRC}." >> $LOGFILE
389 341 /bin/time $MAKE -e ${MAKETARG} 2>&1 | \
390 342 tee -a $SRC/${MAKETARG}.out >> $LOGFILE
391 343 echo "\n==== ${MAKETARG} build errors ====\n" >> $mail_msg_file
392 344 egrep ":" $SRC/${MAKETARG}.out | \
393 345 egrep -e "(^${MAKE}:|[ ]error[: \n])" | \
394 346 egrep -v "Ignoring unknown host" | \
395 347 egrep -v "warning" >> $mail_msg_file
396 348
397 349 echo "clearing state files." >> $LOGFILE
398 350 find . -name '.make*' -exec rm -f {} \;
399 351 }
400 352
401 353 # Return library search directive as function of given root.
402 354 function myldlibs {
403 355 echo "-L$1/lib -L$1/usr/lib"
404 356 }
405 357
406 358 # Return header search directive as function of given root.
407 359 function myheaders {
408 360 echo "-I$1/usr/include"
409 361 }
410 362
411 363 #
412 364 # Function to do the build, including package generation.
413 365 # usage: build LABEL SUFFIX ND MULTIPROTO
414 366 # - LABEL is used to tag build output.
415 367 # - SUFFIX is used to distinguish files (e.g., DEBUG vs non-DEBUG,
416 368 # open-only vs full tree).
417 369 # - ND is "-nd" (non-DEBUG builds) or "" (DEBUG builds).
418 370 # - If MULTIPROTO is "yes", it means to name the proto area according to
419 371 # SUFFIX. Otherwise ("no"), (re)use the standard proto area.
420 372 #
421 373 function build {
422 374 LABEL=$1
423 375 SUFFIX=$2
424 376 ND=$3
425 377 MULTIPROTO=$4
426 378 INSTALLOG=install${SUFFIX}-${MACH}
427 379 NOISE=noise${SUFFIX}-${MACH}
428 380 PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX}
429 381
430 382 ORIGROOT=$ROOT
431 383 [ $MULTIPROTO = no ] || export ROOT=$ROOT$SUFFIX
432 384
433 385 if [[ "$O_FLAG" = y ]]; then
434 386 echo "\nSetting CLOSEDROOT= ${ROOT}-closed\n" >> $LOGFILE
435 387 export CLOSEDROOT=${ROOT}-closed
436 388 fi
437 389
438 390 export ENVLDLIBS1=`myldlibs $ROOT`
439 391 export ENVCPPFLAGS1=`myheaders $ROOT`
440 392
441 393 this_build_ok=y
442 394 #
443 395 # Build OS-Networking source
444 396 #
445 397 echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \
446 398 >> $LOGFILE
447 399
448 400 rm -f $SRC/${INSTALLOG}.out
449 401 cd $SRC
450 402 /bin/time $MAKE -e install 2>&1 | \
451 403 tee -a $SRC/${INSTALLOG}.out >> $LOGFILE
452 404
453 405 if [[ "$SCM_TYPE" = teamware ]]; then
454 406 echo "\n==== SCCS Noise ($LABEL) ====\n" >> $mail_msg_file
455 407 egrep 'sccs(check:| *get)' $SRC/${INSTALLOG}.out >> \
456 408 $mail_msg_file
457 409 fi
458 410
459 411 echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file
460 412 egrep ":" $SRC/${INSTALLOG}.out |
461 413 egrep -e "(^${MAKE}:|[ ]error[: \n])" | \
462 414 egrep -v "Ignoring unknown host" | \
463 415 egrep -v "cc .* -o error " | \
464 416 egrep -v "warning" >> $mail_msg_file
465 417 if [ "$?" = "0" ]; then
466 418 build_ok=n
467 419 this_build_ok=n
468 420 fi
469 421 grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \
470 422 >> $mail_msg_file
471 423 if [ "$?" = "0" ]; then
472 424 build_ok=n
473 425 this_build_ok=n
474 426 fi
475 427
476 428 if [ "$W_FLAG" = "n" ]; then
477 429 echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file
478 430 egrep -i warning: $SRC/${INSTALLOG}.out \
479 431 | egrep -v '^tic:' \
480 432 | egrep -v "symbol (\`|')timezone' has differing types:" \
481 433 | egrep -v "parameter <PSTAMP> set to" \
482 434 | egrep -v "Ignoring unknown host" \
483 435 | egrep -v "redefining segment flags attribute for" \
484 436 >> $mail_msg_file
485 437 fi
486 438
487 439 echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \
488 440 >> $LOGFILE
489 441
490 442 echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file
491 443 tail -3 $SRC/${INSTALLOG}.out >>$mail_msg_file
492 444
493 445 if [ "$i_FLAG" = "n" -a "$W_FLAG" = "n" ]; then
494 446 rm -f $SRC/${NOISE}.ref
495 447 if [ -f $SRC/${NOISE}.out ]; then
496 448 mv $SRC/${NOISE}.out $SRC/${NOISE}.ref
497 449 fi
498 450 grep : $SRC/${INSTALLOG}.out \
499 451 | egrep -v '^/' \
500 452 | egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \
501 453 | egrep -v '^tic:' \
502 454 | egrep -v '^mcs' \
503 455 | egrep -v '^LD_LIBRARY_PATH=' \
504 456 | egrep -v 'ar: creating' \
505 457 | egrep -v 'ar: writing' \
506 458 | egrep -v 'conflicts:' \
507 459 | egrep -v ':saved created' \
508 460 | egrep -v '^stty.*c:' \
509 461 | egrep -v '^mfgname.c:' \
510 462 | egrep -v '^uname-i.c:' \
511 463 | egrep -v '^volumes.c:' \
512 464 | egrep -v '^lint library construction:' \
513 465 | egrep -v 'tsort: INFORM:' \
514 466 | egrep -v 'stripalign:' \
515 467 | egrep -v 'chars, width' \
516 468 | egrep -v "symbol (\`|')timezone' has differing types:" \
517 469 | egrep -v 'PSTAMP' \
518 470 | egrep -v '|%WHOANDWHERE%|' \
519 471 | egrep -v '^Manifying' \
520 472 | egrep -v 'Ignoring unknown host' \
521 473 | egrep -v 'Processing method:' \
522 474 | egrep -v '^Writing' \
523 475 | egrep -v 'spellin1:' \
524 476 | egrep -v '^adding:' \
525 477 | egrep -v "^echo 'msgid" \
526 478 | egrep -v '^echo ' \
527 479 | egrep -v '\.c:$' \
528 480 | egrep -v '^Adding file:' \
529 481 | egrep -v 'CLASSPATH=' \
530 482 | egrep -v '\/var\/mail\/:saved' \
531 483 | egrep -v -- '-DUTS_VERSION=' \
532 484 | egrep -v '^Running Mkbootstrap' \
533 485 | egrep -v '^Applet length read:' \
534 486 | egrep -v 'bytes written:' \
535 487 | egrep -v '^File:SolarisAuthApplet.bin' \
536 488 | egrep -v -i 'jibversion' \
537 489 | egrep -v '^Output size:' \
538 490 | egrep -v '^Solo size statistics:' \
539 491 | egrep -v '^Using ROM API Version' \
540 492 | egrep -v '^Zero Signature length:' \
541 493 | egrep -v '^Note \(probably harmless\):' \
542 494 | egrep -v '::' \
543 495 | egrep -v -- '-xcache' \
544 496 | egrep -v '^\+' \
545 497 | egrep -v '^cc1: note: -fwritable-strings' \
546 498 | egrep -v 'svccfg-native -s svc:/' \
547 499 | sort | uniq >$SRC/${NOISE}.out
548 500 if [ ! -f $SRC/${NOISE}.ref ]; then
549 501 cp $SRC/${NOISE}.out $SRC/${NOISE}.ref
550 502 fi
551 503 echo "\n==== Build noise differences ($LABEL) ====\n" \
552 504 >>$mail_msg_file
553 505 diff $SRC/${NOISE}.ref $SRC/${NOISE}.out >>$mail_msg_file
554 506 fi
555 507
556 508 #
557 509 # Re-sign selected binaries using signing server
558 510 # (gatekeeper builds only)
559 511 #
560 512 if [ -n "$CODESIGN_USER" -a "$this_build_ok" = "y" ]; then
561 513 echo "\n==== Signing proto area at `date` ====\n" >> $LOGFILE
562 514 signing_file="${TMPDIR}/signing"
563 515 rm -f ${signing_file}
564 516 export CODESIGN_USER
565 517 signproto $SRC/tools/codesign/creds 2>&1 | \
566 518 tee -a ${signing_file} >> $LOGFILE
567 519 echo "\n==== Finished signing proto area at `date` ====\n" \
568 520 >> $LOGFILE
569 521 echo "\n==== Crypto module signing errors ($LABEL) ====\n" \
570 522 >> $mail_msg_file
571 523 egrep 'WARNING|ERROR' ${signing_file} >> $mail_msg_file
572 524 if (( $? == 0 )) ; then
573 525 build_ok=n
574 526 this_build_ok=n
575 527 fi
576 528 fi
577 529
578 530 #
579 531 # Building Packages
580 532 #
581 533 if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then
582 534 if [ -d $SRC/pkg -o -d $SRC/pkgdefs ]; then
583 535 echo "\n==== Creating $LABEL packages at `date` ====\n" \
584 536 >> $LOGFILE
585 537 echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE
586 538 rm -rf $PKGARCHIVE >> "$LOGFILE" 2>&1
587 539 mkdir -p $PKGARCHIVE >> "$LOGFILE" 2>&1
588 540
589 541 for d in pkg pkgdefs; do
590 542 if [ ! -f "$SRC/$d/Makefile" ]; then
591 543 continue
592 544 fi
593 545 rm -f $SRC/$d/${INSTALLOG}.out
594 546 cd $SRC/$d
595 547 /bin/time $MAKE -e install 2>&1 | \
596 548 tee -a $SRC/$d/${INSTALLOG}.out >> $LOGFILE
597 549 done
598 550
599 551 echo "\n==== package build errors ($LABEL) ====\n" \
600 552 >> $mail_msg_file
601 553
602 554 for d in pkg pkgdefs; do
603 555 if [ ! -f "$SRC/$d/Makefile" ]; then
604 556 continue
605 557 fi
606 558
607 559 egrep "${MAKE}|ERROR|WARNING" $SRC/$d/${INSTALLOG}.out | \
608 560 grep ':' | \
609 561 grep -v PSTAMP | \
610 562 egrep -v "Ignoring unknown host" \
611 563 >> $mail_msg_file
612 564 done
613 565 else
614 566 #
615 567 # Handle it gracefully if -p was set but there are
616 568 # neither pkg nor pkgdefs directories.
617 569 #
618 570 echo "\n==== No $LABEL packages to build ====\n" \
619 571 >> $LOGFILE
620 572 fi
621 573 else
622 574 echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE
623 575 fi
624 576
625 577 ROOT=$ORIGROOT
626 578 }
627 579
628 580 # Usage: dolint /dir y|n
629 581 # Arg. 2 is a flag to turn on/off the lint diff output
630 582 function dolint {
631 583 if [ ! -d "$1" ]; then
632 584 echo "dolint error: $1 is not a directory"
633 585 exit 1
634 586 fi
635 587
636 588 if [ "$2" != "y" -a "$2" != "n" ]; then
637 589 echo "dolint internal error: $2 should be 'y' or 'n'"
638 590 exit 1
639 591 fi
640 592
641 593 lintdir=$1
642 594 dodiff=$2
643 595 base=`basename $lintdir`
644 596 LINTOUT=$lintdir/lint-${MACH}.out
645 597 LINTNOISE=$lintdir/lint-noise-${MACH}
646 598 export ENVLDLIBS1=`myldlibs $ROOT`
647 599 export ENVCPPFLAGS1=`myheaders $ROOT`
648 600
649 601 set_debug_build_flags
650 602
651 603 #
652 604 # '$MAKE lint' in $lintdir
653 605 #
654 606 echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
655 607
656 608 # remove old lint.out
657 609 rm -f $lintdir/lint.out $lintdir/lint-noise.out
658 610 if [ -f $lintdir/lint-noise.ref ]; then
659 611 mv $lintdir/lint-noise.ref ${LINTNOISE}.ref
660 612 fi
661 613
662 614 rm -f $LINTOUT
663 615 cd $lintdir
664 616 #
665 617 # Remove all .ln files to ensure a full reference file
666 618 #
667 619 rm -f Nothing_to_remove \
668 620 `find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \) \
669 621 -prune -o -type f -name '*.ln' -print `
670 622
671 623 /bin/time $MAKE -ek lint 2>&1 | \
672 624 tee -a $LINTOUT >> $LOGFILE
673 625 echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file
674 626 grep "$MAKE:" $LINTOUT |
675 627 egrep -v "Ignoring unknown host" \
676 628 >> $mail_msg_file
677 629
678 630 echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
679 631
680 632 echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \
681 633 >>$mail_msg_file
682 634 tail -3 $LINTOUT >>$mail_msg_file
683 635
684 636 rm -f ${LINTNOISE}.ref
685 637 if [ -f ${LINTNOISE}.out ]; then
686 638 mv ${LINTNOISE}.out ${LINTNOISE}.ref
687 639 fi
688 640 grep : $LINTOUT | \
689 641 egrep -v '^(real|user|sys)' |
690 642 egrep -v '(library construction)' | \
691 643 egrep -v ': global crosschecks' | \
692 644 egrep -v 'Ignoring unknown host' | \
693 645 egrep -v '\.c:$' | \
694 646 sort | uniq > ${LINTNOISE}.out
695 647 if [ ! -f ${LINTNOISE}.ref ]; then
696 648 cp ${LINTNOISE}.out ${LINTNOISE}.ref
697 649 fi
698 650 if [ "$dodiff" != "n" ]; then
699 651 echo "\n==== lint warnings $base ====\n" \
700 652 >>$mail_msg_file
701 653 # should be none, though there are a few that were filtered out
702 654 # above
703 655 egrep -i '(warning|lint):' ${LINTNOISE}.out \
704 656 | sort | uniq >> $mail_msg_file
705 657 echo "\n==== lint noise differences $base ====\n" \
706 658 >> $mail_msg_file
707 659 diff ${LINTNOISE}.ref ${LINTNOISE}.out \
708 660 >> $mail_msg_file
709 661 fi
710 662 }
711 663
712 664 # Install proto area from IHV build
713 665
714 666 function copy_ihv_proto {
715 667
716 668 echo "\n==== Installing IHV proto area ====\n" \
717 669 >> $LOGFILE
718 670 if [ -d "$IA32_IHV_ROOT" ]; then
719 671 if [ ! -d "$ROOT" ]; then
720 672 echo "mkdir -p $ROOT" >> $LOGFILE
721 673 mkdir -p $ROOT
722 674 fi
723 675 echo "copying $IA32_IHV_ROOT to $ROOT\n" >> $LOGFILE
724 676 cd $IA32_IHV_ROOT
725 677 tar cf - . | (cd $ROOT; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
726 678 else
727 679 echo "$IA32_IHV_ROOT: not found" >> $LOGFILE
728 680 fi
729 681
730 682 if [ "$MULTI_PROTO" = yes ]; then
731 683 if [ ! -d "$ROOT-nd" ]; then
732 684 echo "mkdir -p $ROOT-nd" >> $LOGFILE
733 685 mkdir -p $ROOT-nd
734 686 fi
735 687 # If there's a non-DEBUG version of the IHV proto area,
736 688 # copy it, but copy something if there's not.
737 689 if [ -d "$IA32_IHV_ROOT-nd" ]; then
738 690 echo "copying $IA32_IHV_ROOT-nd to $ROOT-nd\n" >> $LOGFILE
739 691 cd $IA32_IHV_ROOT-nd
740 692 elif [ -d "$IA32_IHV_ROOT" ]; then
741 693 echo "copying $IA32_IHV_ROOT to $ROOT-nd\n" >> $LOGFILE
742 694 cd $IA32_IHV_ROOT
743 695 else
744 696 echo "$IA32_IHV_ROOT{-nd,}: not found" >> $LOGFILE
745 697 return
746 698 fi
747 699 tar cf - . | (cd $ROOT-nd; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
748 700 fi
749 701 }
750 702
751 703 # Install IHV packages in PKGARCHIVE
752 704 # usage: copy_ihv_pkgs LABEL SUFFIX
753 705 function copy_ihv_pkgs {
754 706 LABEL=$1
755 707 SUFFIX=$2
756 708 # always use non-DEBUG IHV packages
757 709 IA32_IHV_PKGS=${IA32_IHV_PKGS_ORIG}-nd
758 710 PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX}
759 711
760 712 echo "\n==== Installing IHV packages from $IA32_IHV_PKGS ($LABEL) ====\n" \
761 713 >> $LOGFILE
762 714 if [ -d "$IA32_IHV_PKGS" ]; then
763 715 cd $IA32_IHV_PKGS
764 716 tar cf - * | \
765 717 (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
766 718 else
767 719 echo "$IA32_IHV_PKGS: not found" >> $LOGFILE
768 720 fi
769 721
770 722 echo "\n==== Installing IHV packages from $IA32_IHV_BINARY_PKGS ($LABEL) ====\n" \
771 723 >> $LOGFILE
772 724 if [ -d "$IA32_IHV_BINARY_PKGS" ]; then
773 725 cd $IA32_IHV_BINARY_PKGS
774 726 tar cf - * | \
775 727 (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
776 728 else
777 729 echo "$IA32_IHV_BINARY_PKGS: not found" >> $LOGFILE
778 730 fi
779 731 }
780 732
781 733 #
782 734 # Build and install the onbld tools.
783 735 #
784 736 # usage: build_tools DESTROOT
785 737 #
786 738 # returns non-zero status if the build was successful.
787 739 #
788 740 function build_tools {
789 741 DESTROOT=$1
790 742
791 743 INSTALLOG=install-${MACH}
792 744
793 745 echo "\n==== Building tools at `date` ====\n" \
794 746 >> $LOGFILE
795 747
796 748 rm -f ${TOOLS}/${INSTALLOG}.out
797 749 cd ${TOOLS}
798 750 /bin/time $MAKE TOOLS_PROTO=${DESTROOT} -e install 2>&1 | \
799 751 tee -a ${TOOLS}/${INSTALLOG}.out >> $LOGFILE
800 752
801 753 echo "\n==== Tools build errors ====\n" >> $mail_msg_file
802 754
803 755 egrep ":" ${TOOLS}/${INSTALLOG}.out |
804 756 egrep -e "(${MAKE}:|[ ]error[: \n])" | \
805 757 egrep -v "Ignoring unknown host" | \
806 758 egrep -v warning >> $mail_msg_file
807 759 return $?
808 760 }
809 761
810 762 #
811 763 # Set up to use locally installed tools.
812 764 #
813 765 # usage: use_tools TOOLSROOT
814 766 #
815 767 function use_tools {
816 768 TOOLSROOT=$1
817 769
818 770 #
819 771 # If we're not building ON workspace, then the TOOLSROOT
820 772 # settings here are clearly ignored by the workspace
821 773 # makefiles, prepending nonexistent directories to PATH is
822 774 # harmless, and we clearly do not wish to override
823 775 # ONBLD_TOOLS.
824 776 #
825 777 # If we're building an ON workspace, then the prepended PATH
826 778 # elements should supercede the preexisting ONBLD_TOOLS paths,
827 779 # and we want to override ONBLD_TOOLS to catch the tools that
828 780 # don't have specific path env vars here.
829 781 #
830 782 # So the only conditional behavior is overriding ONBLD_TOOLS,
831 783 # and we check for "an ON workspace" by looking for
832 784 # ${TOOLSROOT}/opt/onbld.
833 785 #
834 786
835 787 STABS=${TOOLSROOT}/opt/onbld/bin/${MACH}/stabs
836 788 export STABS
837 789 CTFSTABS=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfstabs
838 790 export CTFSTABS
839 791 GENOFFSETS=${TOOLSROOT}/opt/onbld/bin/genoffsets
840 792 export GENOFFSETS
841 793
842 794 CTFCONVERT=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfconvert
843 795 export CTFCONVERT
844 796 CTFMERGE=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfmerge
845 797 export CTFMERGE
846 798
847 799 CTFCVTPTBL=${TOOLSROOT}/opt/onbld/bin/ctfcvtptbl
848 800 export CTFCVTPTBL
849 801 CTFFINDMOD=${TOOLSROOT}/opt/onbld/bin/ctffindmod
850 802 export CTFFINDMOD
851 803
852 804 if [ "$VERIFY_ELFSIGN" = "y" ]; then
853 805 ELFSIGN=${TOOLSROOT}/opt/onbld/bin/elfsigncmp
854 806 else
855 807 ELFSIGN=${TOOLSROOT}/opt/onbld/bin/${MACH}/elfsign
856 808 fi
857 809 export ELFSIGN
858 810
859 811 PATH="${TOOLSROOT}/opt/onbld/bin/${MACH}:${PATH}"
860 812 PATH="${TOOLSROOT}/opt/onbld/bin:${PATH}"
861 813 export PATH
862 814
863 815 if [ -d "${TOOLSROOT}/opt/onbld" ]; then
864 816 ONBLD_TOOLS=${TOOLSROOT}/opt/onbld
865 817 export ONBLD_TOOLS
866 818 fi
867 819
868 820 echo "\n==== New environment settings. ====\n" >> $LOGFILE
869 821 echo "STABS=${STABS}" >> $LOGFILE
870 822 echo "CTFSTABS=${CTFSTABS}" >> $LOGFILE
871 823 echo "CTFCONVERT=${CTFCONVERT}" >> $LOGFILE
872 824 echo "CTFMERGE=${CTFMERGE}" >> $LOGFILE
873 825 echo "CTFCVTPTBL=${CTFCVTPTBL}" >> $LOGFILE
874 826 echo "CTFFINDMOD=${CTFFINDMOD}" >> $LOGFILE
875 827 echo "ELFSIGN=${ELFSIGN}" >> $LOGFILE
876 828 echo "PATH=${PATH}" >> $LOGFILE
877 829 echo "ONBLD_TOOLS=${ONBLD_TOOLS}" >> $LOGFILE
878 830 }
879 831
880 832 function staffer {
881 833 if [ $ISUSER -ne 0 ]; then
882 834 "$@"
883 835 else
884 836 arg="\"$1\""
885 837 shift
886 838 for i
887 839 do
888 840 arg="$arg \"$i\""
↓ open down ↓ |
519 lines elided |
↑ open up ↑ |
889 841 done
890 842 eval su $STAFFER -c \'$arg\'
891 843 fi
892 844 }
893 845
894 846 #
895 847 # Verify that the closed tree is present if it needs to be.
896 848 #
897 849 function check_closed_tree {
898 850 if [[ ! -d "$ON_CLOSED_BINS" ]]; then
899 - echo "If the closed sources are not present," \
900 - "ON_CLOSED_BINS"
901 - echo "must point to the closed binaries tree."
851 + echo "ON_CLOSED_BINS must point to the closed binaries tree."
902 852 build_ok=n
903 853 exit 1
904 854 fi
905 855 }
906 856
907 857 function obsolete_build {
908 858 echo "WARNING: Obsolete $1 build requested; request will be ignored"
909 859 }
910 860
911 861 #
912 862 # wrapper over wsdiff.
913 863 # usage: do_wsdiff LABEL OLDPROTO NEWPROTO
914 864 #
915 865 function do_wsdiff {
916 866 label=$1
917 867 oldproto=$2
918 868 newproto=$3
919 869
920 870 wsdiff="wsdiff"
921 871 [ "$t_FLAG" = y ] && wsdiff="wsdiff -t"
922 872
923 873 echo "\n==== Getting object changes since last build at `date`" \
924 874 "($label) ====\n" | tee -a $LOGFILE >> $mail_msg_file
925 875 $wsdiff -s -r ${TMPDIR}/wsdiff.results $oldproto $newproto 2>&1 | \
926 876 tee -a $LOGFILE >> $mail_msg_file
927 877 echo "\n==== Object changes determined at `date` ($label) ====\n" | \
928 878 tee -a $LOGFILE >> $mail_msg_file
929 879 }
930 880
931 881 #
932 882 # Functions for setting build flags (DEBUG/non-DEBUG). Keep them
933 883 # together.
934 884 #
935 885
936 886 function set_non_debug_build_flags {
937 887 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD=
938 888 export RELEASE_BUILD ; RELEASE_BUILD=
939 889 unset EXTRA_OPTIONS
940 890 unset EXTRA_CFLAGS
941 891 }
942 892
943 893 function set_debug_build_flags {
944 894 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD=
945 895 unset RELEASE_BUILD
946 896 unset EXTRA_OPTIONS
947 897 unset EXTRA_CFLAGS
948 898 }
949 899
950 900
951 901 MACH=`uname -p`
952 902
953 903 if [ "$OPTHOME" = "" ]; then
954 904 OPTHOME=/opt
955 905 export OPTHOME
956 906 fi
957 907 if [ "$TEAMWARE" = "" ]; then
958 908 TEAMWARE=$OPTHOME/teamware
959 909 export TEAMWARE
960 910 fi
961 911
962 912 USAGE='Usage: nightly [-in] [+t] [-V VERS ] [ -S E|D|H|O ] <env_file>
963 913
964 914 Where:
965 915 -i Fast incremental options (no clobber, lint, check)
966 916 -n Do not do a bringover
967 917 +t Use the build tools in $ONBLD_TOOLS/bin
968 918 -V VERS set the build version string to VERS
969 919 -S Build a variant of the source product
970 920 E - build exportable source
971 921 D - build domestic source (exportable + crypt)
972 922 H - build hybrid source (binaries + deleted source)
973 923 O - build (only) open source
974 924
975 925 <env_file> file in Bourne shell syntax that sets and exports
976 926 variables that configure the operation of this script and many of
977 927 the scripts this one calls. If <env_file> does not exist,
978 928 it will be looked for in $OPTHOME/onbld/env.
979 929
980 930 non-DEBUG is the default build type. Build options can be set in the
981 931 NIGHTLY_OPTIONS variable in the <env_file> as follows:
982 932
983 933 -A check for ABI differences in .so files
984 934 -C check for cstyle/hdrchk errors
985 935 -D do a build with DEBUG on
986 936 -F do _not_ do a non-DEBUG build
987 937 -G gate keeper default group of options (-au)
988 938 -I integration engineer default group of options (-ampu)
989 939 -M do not run pmodes (safe file permission checker)
990 940 -N do not run protocmp
991 941 -O generate OpenSolaris deliverables
992 942 -R default group of options for building a release (-mp)
993 943 -U update proto area in the parent
994 944 -V VERS set the build version string to VERS
995 945 -X copy x86 IHV proto area
996 946 -f find unreferenced files
997 947 -i do an incremental build (no "make clobber")
998 948 -l do "make lint" in $LINTDIRS (default: $SRC y)
999 949 -m send mail to $MAILTO at end of build
1000 950 -n do not do a bringover
1001 951 -o build using root privileges to set OWNER/GROUP (old style)
1002 952 -p create packages
1003 953 -r check ELF runtime attributes in the proto area
1004 954 -t build and use the tools in $SRC/tools (default setting)
1005 955 +t Use the build tools in $ONBLD_TOOLS/bin
1006 956 -u update proto_list_$MACH and friends in the parent workspace;
1007 957 when used with -f, also build an unrefmaster.out in the parent
1008 958 -w report on differences between previous and current proto areas
1009 959 -z compress cpio archives with gzip
1010 960 -W Do not report warnings (freeware gate ONLY)
1011 961 -S Build a variant of the source product
1012 962 E - build exportable source
1013 963 D - build domestic source (exportable + crypt)
1014 964 H - build hybrid source (binaries + deleted source)
1015 965 O - build (only) open source
1016 966 '
1017 967 #
1018 968 # A log file will be generated under the name $LOGFILE
1019 969 # for partially completed build and log.`date '+%F'`
1020 970 # in the same directory for fully completed builds.
1021 971 #
1022 972
1023 973 # default values for low-level FLAGS; G I R are group FLAGS
1024 974 A_FLAG=n
1025 975 C_FLAG=n
1026 976 D_FLAG=n
1027 977 F_FLAG=n
1028 978 f_FLAG=n
1029 979 i_FLAG=n; i_CMD_LINE_FLAG=n
1030 980 l_FLAG=n
1031 981 M_FLAG=n
1032 982 m_FLAG=n
1033 983 N_FLAG=n
1034 984 n_FLAG=n
1035 985 O_FLAG=n
1036 986 o_FLAG=n
1037 987 P_FLAG=n
1038 988 p_FLAG=n
1039 989 r_FLAG=n
1040 990 T_FLAG=n
1041 991 t_FLAG=y
1042 992 U_FLAG=n
1043 993 u_FLAG=n
1044 994 V_FLAG=n
1045 995 W_FLAG=n
1046 996 w_FLAG=n
1047 997 X_FLAG=n
1048 998 SD_FLAG=n
1049 999 SE_FLAG=n
1050 1000 SH_FLAG=n
1051 1001 SO_FLAG=n
1052 1002 #
1053 1003 XMOD_OPT=
1054 1004 #
1055 1005 build_ok=y
1056 1006
1057 1007 function is_source_build {
1058 1008 [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o \
1059 1009 "$SH_FLAG" = "y" -o "$SO_FLAG" = "y" ]
1060 1010 return $?
1061 1011 }
1062 1012
1063 1013 #
1064 1014 # examine arguments
1065 1015 #
1066 1016
1067 1017 #
1068 1018 # single function for setting -S flag and doing error checking.
1069 1019 # usage: set_S_flag <type>
1070 1020 # where <type> is the source build type ("E", "D", ...).
1071 1021 #
1072 1022 function set_S_flag {
1073 1023 if is_source_build; then
1074 1024 echo "Can only build one source variant at a time."
1075 1025 exit 1
1076 1026 fi
1077 1027 if [ "$1" = "E" ]; then
1078 1028 SE_FLAG=y
1079 1029 elif [ "$1" = "D" ]; then
1080 1030 SD_FLAG=y
1081 1031 elif [ "$1" = "H" ]; then
1082 1032 SH_FLAG=y
1083 1033 elif [ "$1" = "O" ]; then
1084 1034 SO_FLAG=y
1085 1035 else
1086 1036 echo "$USAGE"
1087 1037 exit 1
1088 1038 fi
1089 1039 }
1090 1040
1091 1041 OPTIND=1
1092 1042 while getopts +inS:tV: FLAG
1093 1043 do
1094 1044 case $FLAG in
1095 1045 i ) i_FLAG=y; i_CMD_LINE_FLAG=y
1096 1046 ;;
1097 1047 n ) n_FLAG=y
1098 1048 ;;
1099 1049 S )
1100 1050 set_S_flag $OPTARG
1101 1051 ;;
1102 1052 +t ) t_FLAG=n
1103 1053 ;;
1104 1054 V ) V_FLAG=y
1105 1055 V_ARG="$OPTARG"
1106 1056 ;;
1107 1057 \? ) echo "$USAGE"
1108 1058 exit 1
1109 1059 ;;
1110 1060 esac
1111 1061 done
1112 1062
1113 1063 # correct argument count after options
1114 1064 shift `expr $OPTIND - 1`
1115 1065
1116 1066 # test that the path to the environment-setting file was given
1117 1067 if [ $# -ne 1 ]; then
1118 1068 echo "$USAGE"
1119 1069 exit 1
1120 1070 fi
1121 1071
1122 1072 # check if user is running nightly as root
1123 1073 # ISUSER is set non-zero if an ordinary user runs nightly, or is zero
1124 1074 # when root invokes nightly.
1125 1075 /usr/bin/id | grep '^uid=0(' >/dev/null 2>&1
1126 1076 ISUSER=$?; export ISUSER
1127 1077
1128 1078 #
1129 1079 # force locale to C
1130 1080 LC_COLLATE=C; export LC_COLLATE
1131 1081 LC_CTYPE=C; export LC_CTYPE
1132 1082 LC_MESSAGES=C; export LC_MESSAGES
1133 1083 LC_MONETARY=C; export LC_MONETARY
1134 1084 LC_NUMERIC=C; export LC_NUMERIC
1135 1085 LC_TIME=C; export LC_TIME
1136 1086
1137 1087 # clear environment variables we know to be bad for the build
1138 1088 unset LD_OPTIONS
1139 1089 unset LD_AUDIT LD_AUDIT_32 LD_AUDIT_64
1140 1090 unset LD_BIND_NOW LD_BIND_NOW_32 LD_BIND_NOW_64
1141 1091 unset LD_BREADTH LD_BREADTH_32 LD_BREADTH_64
1142 1092 unset LD_CONFIG LD_CONFIG_32 LD_CONFIG_64
1143 1093 unset LD_DEBUG LD_DEBUG_32 LD_DEBUG_64
1144 1094 unset LD_DEMANGLE LD_DEMANGLE_32 LD_DEMANGLE_64
1145 1095 unset LD_FLAGS LD_FLAGS_32 LD_FLAGS_64
1146 1096 unset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64
1147 1097 unset LD_LOADFLTR LD_LOADFLTR_32 LD_LOADFLTR_64
1148 1098 unset LD_NOAUDIT LD_NOAUDIT_32 LD_NOAUDIT_64
1149 1099 unset LD_NOAUXFLTR LD_NOAUXFLTR_32 LD_NOAUXFLTR_64
1150 1100 unset LD_NOCONFIG LD_NOCONFIG_32 LD_NOCONFIG_64
1151 1101 unset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64
1152 1102 unset LD_NODIRECT LD_NODIRECT_32 LD_NODIRECT_64
1153 1103 unset LD_NOLAZYLOAD LD_NOLAZYLOAD_32 LD_NOLAZYLOAD_64
1154 1104 unset LD_NOOBJALTER LD_NOOBJALTER_32 LD_NOOBJALTER_64
1155 1105 unset LD_NOVERSION LD_NOVERSION_32 LD_NOVERSION_64
1156 1106 unset LD_ORIGIN LD_ORIGIN_32 LD_ORIGIN_64
1157 1107 unset LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64
1158 1108 unset LD_PROFILE LD_PROFILE_32 LD_PROFILE_64
1159 1109
1160 1110 unset CONFIG
1161 1111 unset GROUP
1162 1112 unset OWNER
1163 1113 unset REMOTE
1164 1114 unset ENV
1165 1115 unset ARCH
1166 1116 unset CLASSPATH
1167 1117 unset NAME
1168 1118
1169 1119 #
1170 1120 # To get ONBLD_TOOLS from the environment, it must come from the env file.
1171 1121 # If it comes interactively, it is generally TOOLS_PROTO, which will be
1172 1122 # clobbered before the compiler version checks, which will therefore fail.
1173 1123 #
1174 1124 unset ONBLD_TOOLS
1175 1125
1176 1126 #
1177 1127 # Setup environmental variables
1178 1128 #
1179 1129 if [ -f /etc/nightly.conf ]; then
1180 1130 . /etc/nightly.conf
1181 1131 fi
1182 1132
1183 1133 if [ -f $1 ]; then
1184 1134 if [[ $1 = */* ]]; then
1185 1135 . $1
1186 1136 else
1187 1137 . ./$1
1188 1138 fi
1189 1139 else
1190 1140 if [ -f $OPTHOME/onbld/env/$1 ]; then
1191 1141 . $OPTHOME/onbld/env/$1
1192 1142 else
1193 1143 echo "Cannot find env file as either $1 or $OPTHOME/onbld/env/$1"
1194 1144 exit 1
1195 1145 fi
1196 1146 fi
1197 1147
1198 1148 # contents of stdenv.sh inserted after next line:
1199 1149 # STDENV_START
1200 1150 # STDENV_END
1201 1151
1202 1152 # Check if we have sufficient data to continue...
1203 1153 [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
1204 1154 if [[ "${NIGHTLY_OPTIONS}" == ~(F)n ]] ; then
1205 1155 # Check if the gate data are valid if we don't do a "bringover" below
1206 1156 [[ -d "${CODEMGR_WS}" ]] || \
1207 1157 fatal_error "Error: ${CODEMGR_WS} is not a directory."
1208 1158 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || \
1209 1159 fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
1210 1160 fi
1211 1161
1212 1162 #
1213 1163 # place ourselves in a new task, respecting BUILD_PROJECT if set.
1214 1164 #
1215 1165 if [ -z "$BUILD_PROJECT" ]; then
1216 1166 /usr/bin/newtask -c $$
1217 1167 else
1218 1168 /usr/bin/newtask -c $$ -p $BUILD_PROJECT
1219 1169 fi
1220 1170
1221 1171 ps -o taskid= -p $$ | read build_taskid
1222 1172 ps -o project= -p $$ | read build_project
1223 1173
1224 1174 #
1225 1175 # See if NIGHTLY_OPTIONS is set
1226 1176 #
1227 1177 if [ "$NIGHTLY_OPTIONS" = "" ]; then
1228 1178 NIGHTLY_OPTIONS="-aBm"
1229 1179 fi
1230 1180
1231 1181 #
1232 1182 # If BRINGOVER_WS was not specified, let it default to CLONE_WS
1233 1183 #
1234 1184 if [ "$BRINGOVER_WS" = "" ]; then
1235 1185 BRINGOVER_WS=$CLONE_WS
1236 1186 fi
1237 1187
1238 1188 #
1239 1189 # If CLOSED_BRINGOVER_WS was not specified, let it default to CLOSED_CLONE_WS
1240 1190 #
1241 1191 if [ "$CLOSED_BRINGOVER_WS" = "" ]; then
↓ open down ↓ |
330 lines elided |
↑ open up ↑ |
1242 1192 CLOSED_BRINGOVER_WS=$CLOSED_CLONE_WS
1243 1193 fi
1244 1194
1245 1195 #
1246 1196 # If BRINGOVER_FILES was not specified, default to usr
1247 1197 #
1248 1198 if [ "$BRINGOVER_FILES" = "" ]; then
1249 1199 BRINGOVER_FILES="usr"
1250 1200 fi
1251 1201
1252 -#
1253 -# If the closed sources are not present, the closed binaries must be
1254 -# present for the build to succeed. If there's no pointer to the
1255 -# closed binaries, flag that now, rather than forcing the user to wait
1256 -# a couple hours (or more) to find out.
1257 -#
1258 -orig_closed_is_present="$CLOSED_IS_PRESENT"
1259 1202 check_closed_tree
1260 1203
1261 1204 #
1262 1205 # Note: changes to the option letters here should also be applied to the
1263 1206 # bldenv script. `d' is listed for backward compatibility.
1264 1207 #
1265 1208 NIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-}
1266 1209 OPTIND=1
1267 1210 while getopts +ABCDdFfGIilMmNnOoPpRrS:TtUuWwXxz FLAG $NIGHTLY_OPTIONS
1268 1211 do
1269 1212 case $FLAG in
1270 1213 A ) A_FLAG=y
1271 - #
1272 - # If ELF_DATA_BASELINE_DIR is not defined, and we are on SWAN
1273 - # (based on CLOSED_IS_PRESENT), then refuse to run. The value
1274 - # of ELF version checking is greatly enhanced by including
1275 - # the baseline gate comparison.
1276 - if [ "$CLOSED_IS_PRESENT" = 'yes' -a \
1277 - "$ELF_DATA_BASELINE_DIR" = '' ]; then
1278 - echo "ELF_DATA_BASELINE_DIR must be set if the A" \
1279 - "flag is present in\nNIGHTLY_OPTIONS and closed" \
1280 - "sources are present. Update environment file."
1281 - exit 1;
1282 - fi
1283 1214 ;;
1284 1215 B ) D_FLAG=y
1285 1216 ;; # old version of D
1286 1217 C ) C_FLAG=y
1287 1218 ;;
1288 1219 D ) D_FLAG=y
1289 1220 ;;
1290 1221 F ) F_FLAG=y
1291 1222 ;;
1292 1223 f ) f_FLAG=y
1293 1224 ;;
1294 1225 G ) u_FLAG=y
1295 1226 ;;
1296 1227 I ) m_FLAG=y
1297 1228 p_FLAG=y
1298 1229 u_FLAG=y
1299 1230 ;;
1300 1231 i ) i_FLAG=y
1301 1232 ;;
1302 1233 l ) l_FLAG=y
1303 1234 ;;
1304 1235 M ) M_FLAG=y
1305 1236 ;;
1306 1237 m ) m_FLAG=y
1307 1238 ;;
1308 1239 N ) N_FLAG=y
1309 1240 ;;
1310 1241 n ) n_FLAG=y
1311 1242 ;;
1312 1243 O ) O_FLAG=y
1313 1244 ;;
1314 1245 o ) o_FLAG=y
1315 1246 ;;
1316 1247 P ) P_FLAG=y
1317 1248 ;; # obsolete
1318 1249 p ) p_FLAG=y
1319 1250 ;;
1320 1251 R ) m_FLAG=y
1321 1252 p_FLAG=y
1322 1253 ;;
1323 1254 r ) r_FLAG=y
1324 1255 ;;
1325 1256 S )
1326 1257 set_S_flag $OPTARG
1327 1258 ;;
1328 1259 T ) T_FLAG=y
1329 1260 ;; # obsolete
1330 1261 +t ) t_FLAG=n
1331 1262 ;;
1332 1263 U ) if [ -z "${PARENT_ROOT}" ]; then
1333 1264 echo "PARENT_ROOT must be set if the U flag is" \
1334 1265 "present in NIGHTLY_OPTIONS."
1335 1266 exit 1
1336 1267 fi
1337 1268 NIGHTLY_PARENT_ROOT=$PARENT_ROOT
1338 1269 if [ -n "${PARENT_TOOLS_ROOT}" ]; then
1339 1270 NIGHTLY_PARENT_TOOLS_ROOT=$PARENT_TOOLS_ROOT
1340 1271 fi
1341 1272 U_FLAG=y
1342 1273 ;;
1343 1274 u ) u_FLAG=y
1344 1275 ;;
1345 1276 W ) W_FLAG=y
1346 1277 ;;
1347 1278
1348 1279 w ) w_FLAG=y
1349 1280 ;;
1350 1281 X ) # now that we no longer need realmode builds, just
1351 1282 # copy IHV packages. only meaningful on x86.
1352 1283 if [ "$MACH" = "i386" ]; then
1353 1284 X_FLAG=y
1354 1285 fi
1355 1286 ;;
1356 1287 x ) XMOD_OPT="-x"
1357 1288 ;;
1358 1289 \? ) echo "$USAGE"
1359 1290 exit 1
1360 1291 ;;
1361 1292 esac
1362 1293 done
1363 1294
1364 1295 if [ $ISUSER -ne 0 ]; then
1365 1296 if [ "$o_FLAG" = "y" ]; then
1366 1297 echo "Old-style build requires root permission."
1367 1298 exit 1
1368 1299 fi
1369 1300
1370 1301 # Set default value for STAFFER, if needed.
1371 1302 if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then
1372 1303 STAFFER=`/usr/xpg4/bin/id -un`
1373 1304 export STAFFER
1374 1305 fi
1375 1306 fi
1376 1307
1377 1308 if [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then
1378 1309 MAILTO=$STAFFER
↓ open down ↓ |
86 lines elided |
↑ open up ↑ |
1379 1310 export MAILTO
1380 1311 fi
1381 1312
1382 1313 PATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin"
1383 1314 PATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb"
1384 1315 PATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
1385 1316 export PATH
1386 1317
1387 1318 # roots of source trees, both relative to $SRC and absolute.
1388 1319 relsrcdirs="."
1389 -if [[ -d $CODEMGR_WS/usr/closed && "$CLOSED_IS_PRESENT" != no ]]; then
1390 - relsrcdirs="$relsrcdirs ../closed"
1391 -fi
1392 -abssrcdirs=""
1393 -for d in $relsrcdirs; do
1394 - abssrcdirs="$abssrcdirs $SRC/$d"
1395 -done
1320 +abssrcdirs="$SRC"
1396 1321
1397 1322 unset CH
1398 1323 if [ "$o_FLAG" = "y" ]; then
1399 1324 # root invoked old-style build -- make sure it works as it always has
1400 1325 # by exporting 'CH'. The current Makefile.master doesn't use this, but
1401 1326 # the old ones still do.
1402 1327 PROTOCMPTERSE="protocmp.terse"
1403 1328 CH=
1404 1329 export CH
1405 1330 else
1406 1331 PROTOCMPTERSE="protocmp.terse -gu"
1407 1332 fi
1408 1333 POUND_SIGN="#"
1409 1334 # have we set RELEASE_DATE in our env file?
1410 1335 if [ -z "$RELEASE_DATE" ]; then
1411 1336 RELEASE_DATE=$(LC_ALL=C date +"%B %Y")
1412 1337 fi
1413 1338 BUILD_DATE=$(LC_ALL=C date +%Y-%b-%d)
1414 1339 BASEWSDIR=$(basename $CODEMGR_WS)
1415 1340 DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
1416 1341
1417 1342 # we export POUND_SIGN, RELEASE_DATE and DEV_CM to speed up the build process
1418 1343 # by avoiding repeated shell invocations to evaluate Makefile.master definitions.
1419 1344 # we export o_FLAG and X_FLAG for use by makebfu, and by usr/src/pkg/Makefile
1420 1345 export o_FLAG X_FLAG POUND_SIGN RELEASE_DATE DEV_CM
1421 1346
1422 1347 maketype="distributed"
1423 1348 MAKE=dmake
1424 1349 # get the dmake version string alone
1425 1350 DMAKE_VERSION=$( $MAKE -v )
1426 1351 DMAKE_VERSION=${DMAKE_VERSION#*: }
1427 1352 # focus in on just the dotted version number alone
1428 1353 DMAKE_MAJOR=$( echo $DMAKE_VERSION | \
1429 1354 sed -e 's/.*\<\([^.]*\.[^ ]*\).*$/\1/' )
1430 1355 # extract the second (or final) integer
1431 1356 DMAKE_MINOR=${DMAKE_MAJOR#*.}
1432 1357 DMAKE_MINOR=${DMAKE_MINOR%%.*}
1433 1358 # extract the first integer
1434 1359 DMAKE_MAJOR=${DMAKE_MAJOR%%.*}
1435 1360 CHECK_DMAKE=${CHECK_DMAKE:-y}
1436 1361 # x86 was built on the 12th, sparc on the 13th.
1437 1362 if [ "$CHECK_DMAKE" = "y" -a \
1438 1363 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \
1439 1364 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \( \
1440 1365 "$DMAKE_MAJOR" -lt 7 -o \
1441 1366 "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \) ]; then
1442 1367 if [ -z "$DMAKE_VERSION" ]; then
1443 1368 echo "$MAKE is missing."
1444 1369 exit 1
1445 1370 fi
1446 1371 echo `whence $MAKE`" version is:"
1447 1372 echo " ${DMAKE_VERSION}"
1448 1373 cat <<EOF
1449 1374
1450 1375 This version may not be safe for use. Either set TEAMWARE to a better
1451 1376 path or (if you really want to use this version of dmake anyway), add
1452 1377 the following to your environment to disable this check:
1453 1378
1454 1379 CHECK_DMAKE=n
1455 1380 EOF
1456 1381 exit 1
1457 1382 fi
1458 1383 export PATH
1459 1384 export MAKE
1460 1385
1461 1386 if [[ "$O_FLAG" = y ]]; then
1462 1387 export TONICBUILD=""
1463 1388 else
1464 1389 export TONICBUILD="#"
1465 1390 fi
1466 1391
1467 1392 if [ "${SUNWSPRO}" != "" ]; then
1468 1393 PATH="${SUNWSPRO}/bin:$PATH"
1469 1394 export PATH
1470 1395 fi
1471 1396
1472 1397 hostname=$(uname -n)
1473 1398 if [[ $DMAKE_MAX_JOBS != +([0-9]) || $DMAKE_MAX_JOBS -eq 0 ]]
1474 1399 then
1475 1400 maxjobs=
1476 1401 if [[ -f $HOME/.make.machines ]]
1477 1402 then
1478 1403 # Note: there is a hard tab and space character in the []s
1479 1404 # below.
1480 1405 egrep -i "^[ ]*$hostname[ \.]" \
1481 1406 $HOME/.make.machines | read host jobs
1482 1407 maxjobs=${jobs##*=}
1483 1408 fi
1484 1409
1485 1410 if [[ $maxjobs != +([0-9]) || $maxjobs -eq 0 ]]
1486 1411 then
1487 1412 # default
1488 1413 maxjobs=4
1489 1414 fi
1490 1415
1491 1416 export DMAKE_MAX_JOBS=$maxjobs
1492 1417 fi
1493 1418
1494 1419 DMAKE_MODE=parallel;
1495 1420 export DMAKE_MODE
1496 1421
1497 1422 if [ -z "${ROOT}" ]; then
1498 1423 echo "ROOT must be set."
1499 1424 exit 1
1500 1425 fi
1501 1426
1502 1427 #
1503 1428 # if -V flag was given, reset VERSION to V_ARG
1504 1429 #
1505 1430 if [ "$V_FLAG" = "y" ]; then
1506 1431 VERSION=$V_ARG
1507 1432 fi
1508 1433
1509 1434 #
1510 1435 # Check for IHV root for copying ihv proto area
1511 1436 #
1512 1437 if [ "$X_FLAG" = "y" ]; then
1513 1438 if [ "$IA32_IHV_ROOT" = "" ]; then
1514 1439 echo "IA32_IHV_ROOT: must be set for copying ihv proto"
1515 1440 args_ok=n
1516 1441 fi
1517 1442 if [ ! -d "$IA32_IHV_ROOT" ]; then
1518 1443 echo "$IA32_IHV_ROOT: not found"
1519 1444 args_ok=n
1520 1445 fi
1521 1446 if [ "$IA32_IHV_WS" = "" ]; then
1522 1447 echo "IA32_IHV_WS: must be set for copying ihv proto"
1523 1448 args_ok=n
1524 1449 fi
1525 1450 if [ ! -d "$IA32_IHV_WS" ]; then
1526 1451 echo "$IA32_IHV_WS: not found"
1527 1452 args_ok=n
1528 1453 fi
1529 1454 fi
1530 1455
1531 1456 # Append source version
1532 1457 if [ "$SE_FLAG" = "y" ]; then
1533 1458 VERSION="${VERSION}:EXPORT"
1534 1459 fi
1535 1460
1536 1461 if [ "$SD_FLAG" = "y" ]; then
1537 1462 VERSION="${VERSION}:DOMESTIC"
1538 1463 fi
1539 1464
1540 1465 if [ "$SH_FLAG" = "y" ]; then
1541 1466 VERSION="${VERSION}:MODIFIED_SOURCE_PRODUCT"
1542 1467 fi
1543 1468
1544 1469 if [ "$SO_FLAG" = "y" ]; then
1545 1470 VERSION="${VERSION}:OPEN_ONLY"
1546 1471 fi
1547 1472
1548 1473 TMPDIR="/tmp/nightly.tmpdir.$$"
1549 1474 export TMPDIR
1550 1475 rm -rf ${TMPDIR}
1551 1476 mkdir -p $TMPDIR || exit 1
1552 1477 chmod 777 $TMPDIR
1553 1478
1554 1479 #
1555 1480 # Keep elfsign's use of pkcs11_softtoken from looking in the user home
1556 1481 # directory, which doesn't always work. Needed until all build machines
1557 1482 # have the fix for 6271754
1558 1483 #
1559 1484 SOFTTOKEN_DIR=$TMPDIR
1560 1485 export SOFTTOKEN_DIR
1561 1486
1562 1487 #
1563 1488 # Tools should only be built non-DEBUG. Keep track of the tools proto
1564 1489 # area path relative to $TOOLS, because the latter changes in an
1565 1490 # export build.
1566 1491 #
1567 1492 # TOOLS_PROTO is included below for builds other than usr/src/tools
1568 1493 # that look for this location. For usr/src/tools, this will be
1569 1494 # overridden on the $MAKE command line in build_tools().
1570 1495 #
1571 1496 TOOLS=${SRC}/tools
1572 1497 TOOLS_PROTO_REL=proto/root_${MACH}-nd
1573 1498 TOOLS_PROTO=${TOOLS}/${TOOLS_PROTO_REL}; export TOOLS_PROTO
1574 1499
1575 1500 unset CFLAGS LD_LIBRARY_PATH LDFLAGS
1576 1501
1577 1502 # create directories that are automatically removed if the nightly script
1578 1503 # fails to start correctly
1579 1504 function newdir {
1580 1505 dir=$1
1581 1506 toadd=
1582 1507 while [ ! -d $dir ]; do
1583 1508 toadd="$dir $toadd"
1584 1509 dir=`dirname $dir`
1585 1510 done
1586 1511 torm=
1587 1512 newlist=
1588 1513 for dir in $toadd; do
1589 1514 if staffer mkdir $dir; then
1590 1515 newlist="$ISUSER $dir $newlist"
1591 1516 torm="$dir $torm"
1592 1517 else
1593 1518 [ -z "$torm" ] || staffer rmdir $torm
1594 1519 return 1
1595 1520 fi
1596 1521 done
1597 1522 newdirlist="$newlist $newdirlist"
1598 1523 return 0
1599 1524 }
1600 1525 newdirlist=
1601 1526
1602 1527 [ -d $CODEMGR_WS ] || newdir $CODEMGR_WS || exit 1
1603 1528
1604 1529 # since this script assumes the build is from full source, it nullifies
1605 1530 # variables likely to have been set by a "ws" script; nullification
1606 1531 # confines the search space for headers and libraries to the proto area
1607 1532 # built from this immediate source.
1608 1533 ENVLDLIBS1=
1609 1534 ENVLDLIBS2=
1610 1535 ENVLDLIBS3=
1611 1536 ENVCPPFLAGS1=
1612 1537 ENVCPPFLAGS2=
1613 1538 ENVCPPFLAGS3=
1614 1539 ENVCPPFLAGS4=
1615 1540 PARENT_ROOT=
1616 1541
1617 1542 export ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \
1618 1543 PARENT_ROOT
1619 1544
1620 1545 PKGARCHIVE_ORIG=$PKGARCHIVE
1621 1546 IA32_IHV_PKGS_ORIG=$IA32_IHV_PKGS
1622 1547
1623 1548 #
1624 1549 # Juggle the logs and optionally send mail on completion.
1625 1550 #
1626 1551
1627 1552 function logshuffle {
1628 1553 LLOG="$ATLOG/log.`date '+%F.%H:%M'`"
1629 1554 if [ -f $LLOG -o -d $LLOG ]; then
1630 1555 LLOG=$LLOG.$$
1631 1556 fi
1632 1557 mkdir $LLOG
1633 1558 export LLOG
1634 1559
1635 1560 if [ "$build_ok" = "y" ]; then
1636 1561 mv $ATLOG/proto_list_${MACH} $LLOG
1637 1562
1638 1563 if [ -f $ATLOG/proto_list_tools_${MACH} ]; then
1639 1564 mv $ATLOG/proto_list_tools_${MACH} $LLOG
1640 1565 fi
1641 1566
1642 1567 if [ -f $TMPDIR/wsdiff.results ]; then
1643 1568 mv $TMPDIR/wsdiff.results $LLOG
1644 1569 fi
1645 1570
1646 1571 if [ -f $TMPDIR/wsdiff-nd.results ]; then
1647 1572 mv $TMPDIR/wsdiff-nd.results $LLOG
1648 1573 fi
1649 1574 fi
1650 1575
1651 1576 #
1652 1577 # Now that we're about to send mail, it's time to check the noise
1653 1578 # file. In the event that an error occurs beyond this point, it will
1654 1579 # be recorded in the nightly.log file, but nowhere else. This would
1655 1580 # include only errors that cause the copying of the noise log to fail
1656 1581 # or the mail itself not to be sent.
1657 1582 #
1658 1583
1659 1584 exec >>$LOGFILE 2>&1
1660 1585 if [ -s $build_noise_file ]; then
1661 1586 echo "\n==== Nightly build noise ====\n" |
1662 1587 tee -a $LOGFILE >>$mail_msg_file
1663 1588 cat $build_noise_file >>$LOGFILE
1664 1589 cat $build_noise_file >>$mail_msg_file
1665 1590 echo | tee -a $LOGFILE >>$mail_msg_file
1666 1591 fi
1667 1592 rm -f $build_noise_file
1668 1593
1669 1594 case "$build_ok" in
1670 1595 y)
1671 1596 state=Completed
1672 1597 ;;
1673 1598 i)
1674 1599 state=Interrupted
1675 1600 ;;
1676 1601 *)
1677 1602 state=Failed
1678 1603 ;;
1679 1604 esac
1680 1605 NIGHTLY_STATUS=$state
1681 1606 export NIGHTLY_STATUS
1682 1607
1683 1608 run_hook POST_NIGHTLY $state
1684 1609 run_hook SYS_POST_NIGHTLY $state
1685 1610
1686 1611 #
1687 1612 # mailx(1) sets From: based on the -r flag
1688 1613 # if it is given.
1689 1614 #
1690 1615 mailx_r=
1691 1616 if [[ -n "${MAILFROM}" ]]; then
1692 1617 mailx_r="-r ${MAILFROM}"
1693 1618 fi
1694 1619
1695 1620 cat $build_time_file $build_environ_file $mail_msg_file \
1696 1621 > ${LLOG}/mail_msg
1697 1622 if [ "$m_FLAG" = "y" ]; then
1698 1623 cat ${LLOG}/mail_msg | /usr/bin/mailx ${mailx_r} -s \
1699 1624 "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \
1700 1625 ${MAILTO}
1701 1626 fi
1702 1627
1703 1628 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
1704 1629 staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH}
1705 1630 staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log
1706 1631 fi
1707 1632
1708 1633 mv $LOGFILE $LLOG
1709 1634 }
1710 1635
1711 1636 #
1712 1637 # Remove the locks and temporary files on any exit
1713 1638 #
1714 1639 function cleanup {
1715 1640 logshuffle
1716 1641
1717 1642 [ -z "$lockfile" ] || staffer rm -f $lockfile
1718 1643 [ -z "$atloglockfile" ] || rm -f $atloglockfile
1719 1644 [ -z "$ulockfile" ] || staffer rm -f $ulockfile
1720 1645 [ -z "$Ulockfile" ] || rm -f $Ulockfile
1721 1646
1722 1647 set -- $newdirlist
1723 1648 while [ $# -gt 0 ]; do
1724 1649 ISUSER=$1 staffer rmdir $2
1725 1650 shift; shift
1726 1651 done
1727 1652 rm -rf $TMPDIR
1728 1653 }
1729 1654
1730 1655 function cleanup_signal {
1731 1656 build_ok=i
1732 1657 # this will trigger cleanup(), above.
1733 1658 exit 1
1734 1659 }
1735 1660
1736 1661 trap cleanup 0
1737 1662 trap cleanup_signal 1 2 3 15
1738 1663
1739 1664 #
1740 1665 # Generic lock file processing -- make sure that the lock file doesn't
1741 1666 # exist. If it does, it should name the build host and PID. If it
1742 1667 # doesn't, then make sure we can create it. Clean up locks that are
1743 1668 # known to be stale (assumes host name is unique among build systems
1744 1669 # for the workspace).
1745 1670 #
1746 1671 function create_lock {
1747 1672 lockf=$1
1748 1673 lockvar=$2
1749 1674
1750 1675 ldir=`dirname $lockf`
1751 1676 [ -d $ldir ] || newdir $ldir || exit 1
1752 1677 eval $lockvar=$lockf
1753 1678
1754 1679 while ! staffer ln -s $hostname.$STAFFER.$$ $lockf 2> /dev/null; do
1755 1680 basews=`basename $CODEMGR_WS`
1756 1681 ls -l $lockf | nawk '{print $NF}' | IFS=. read host user pid
1757 1682 if [ "$host" != "$hostname" ]; then
1758 1683 echo "$MACH build of $basews apparently" \
1759 1684 "already started by $user on $host as $pid."
1760 1685 exit 1
1761 1686 elif kill -s 0 $pid 2>/dev/null; then
1762 1687 echo "$MACH build of $basews already started" \
1763 1688 "by $user as $pid."
1764 1689 exit 1
1765 1690 else
1766 1691 # stale lock; clear it out and try again
1767 1692 rm -f $lockf
1768 1693 fi
1769 1694 done
1770 1695 }
1771 1696
1772 1697 #
1773 1698 # Return the list of interesting proto areas, depending on the current
1774 1699 # options.
1775 1700 #
1776 1701 function allprotos {
1777 1702 typeset roots="$ROOT"
1778 1703
1779 1704 if [[ "$F_FLAG" = n && "$MULTI_PROTO" = yes ]]; then
1780 1705 roots="$roots $ROOT-nd"
1781 1706 fi
1782 1707
1783 1708 if [[ $O_FLAG = y ]]; then
1784 1709 roots="$roots $ROOT-closed"
1785 1710 [ $MULTI_PROTO = yes ] && roots="$roots $ROOT-nd-closed"
1786 1711 fi
1787 1712
1788 1713 echo $roots
1789 1714 }
1790 1715
1791 1716 # Ensure no other instance of this script is running on this host.
1792 1717 # LOCKNAME can be set in <env_file>, and is by default, but is not
1793 1718 # required due to the use of $ATLOG below.
1794 1719 if [ -n "$LOCKNAME" ]; then
1795 1720 create_lock /tmp/$LOCKNAME "lockfile"
1796 1721 fi
1797 1722 #
1798 1723 # Create from one, two, or three other locks:
1799 1724 # $ATLOG/nightly.lock
1800 1725 # - protects against multiple builds in same workspace
1801 1726 # $PARENT_WS/usr/src/nightly.$MACH.lock
1802 1727 # - protects against multiple 'u' copy-backs
1803 1728 # $NIGHTLY_PARENT_ROOT/nightly.lock
1804 1729 # - protects against multiple 'U' copy-backs
1805 1730 #
1806 1731 # Overriding ISUSER to 1 causes the lock to be created as root if the
1807 1732 # script is run as root. The default is to create it as $STAFFER.
1808 1733 ISUSER=1 create_lock $ATLOG/nightly.lock "atloglockfile"
1809 1734 if [ "$u_FLAG" = "y" ]; then
1810 1735 create_lock $PARENT_WS/usr/src/nightly.$MACH.lock "ulockfile"
1811 1736 fi
1812 1737 if [ "$U_FLAG" = "y" ]; then
1813 1738 # NIGHTLY_PARENT_ROOT is written as root if script invoked as root.
1814 1739 ISUSER=1 create_lock $NIGHTLY_PARENT_ROOT/nightly.lock "Ulockfile"
1815 1740 fi
1816 1741
1817 1742 # Locks have been taken, so we're doing a build and we're committed to
1818 1743 # the directories we may have created so far.
1819 1744 newdirlist=
1820 1745
1821 1746 #
1822 1747 # Create mail_msg_file
1823 1748 #
1824 1749 mail_msg_file="${TMPDIR}/mail_msg"
1825 1750 touch $mail_msg_file
1826 1751 build_time_file="${TMPDIR}/build_time"
1827 1752 build_environ_file="${TMPDIR}/build_environ"
1828 1753 touch $build_environ_file
1829 1754 #
1830 1755 # Move old LOGFILE aside
1831 1756 # ATLOG directory already made by 'create_lock' above
1832 1757 #
1833 1758 if [ -f $LOGFILE ]; then
1834 1759 mv -f $LOGFILE ${LOGFILE}-
1835 1760 fi
1836 1761 #
1837 1762 # Build OsNet source
1838 1763 #
1839 1764 START_DATE=`date`
1840 1765 SECONDS=0
1841 1766 echo "\n==== Nightly $maketype build started: $START_DATE ====" \
1842 1767 | tee -a $LOGFILE > $build_time_file
1843 1768
1844 1769 echo "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \
1845 1770 tee -a $mail_msg_file >> $LOGFILE
1846 1771
1847 1772 # make sure we log only to the nightly build file
1848 1773 build_noise_file="${TMPDIR}/build_noise"
1849 1774 exec </dev/null >$build_noise_file 2>&1
1850 1775
1851 1776 run_hook SYS_PRE_NIGHTLY
1852 1777 run_hook PRE_NIGHTLY
1853 1778
1854 1779 echo "\n==== list of environment variables ====\n" >> $LOGFILE
1855 1780 env >> $LOGFILE
1856 1781
1857 1782 echo "\n==== Nightly argument issues ====\n" | tee -a $mail_msg_file >> $LOGFILE
1858 1783
1859 1784 if [ "$P_FLAG" = "y" ]; then
1860 1785 obsolete_build GPROF | tee -a $mail_msg_file >> $LOGFILE
1861 1786 fi
1862 1787
1863 1788 if [ "$T_FLAG" = "y" ]; then
1864 1789 obsolete_build TRACE | tee -a $mail_msg_file >> $LOGFILE
1865 1790 fi
1866 1791
1867 1792 if is_source_build; then
1868 1793 if [ "$i_FLAG" = "y" -o "$i_CMD_LINE_FLAG" = "y" ]; then
1869 1794 echo "WARNING: the -S flags do not support incremental" \
1870 1795 "builds; forcing clobber\n" | tee -a $mail_msg_file >> $LOGFILE
1871 1796 i_FLAG=n
1872 1797 i_CMD_LINE_FLAG=n
1873 1798 fi
1874 1799 if [ "$N_FLAG" = "n" ]; then
1875 1800 echo "WARNING: the -S flags do not support protocmp;" \
1876 1801 "protocmp disabled\n" | \
1877 1802 tee -a $mail_msg_file >> $LOGFILE
1878 1803 N_FLAG=y
1879 1804 fi
1880 1805 if [ "$l_FLAG" = "y" ]; then
1881 1806 echo "WARNING: the -S flags do not support lint;" \
1882 1807 "lint disabled\n" | tee -a $mail_msg_file >> $LOGFILE
1883 1808 l_FLAG=n
1884 1809 fi
1885 1810 if [ "$C_FLAG" = "y" ]; then
1886 1811 echo "WARNING: the -S flags do not support cstyle;" \
1887 1812 "cstyle check disabled\n" | tee -a $mail_msg_file >> $LOGFILE
1888 1813 C_FLAG=n
1889 1814 fi
1890 1815 else
1891 1816 if [ "$N_FLAG" = "y" ]; then
1892 1817 if [ "$p_FLAG" = "y" ]; then
1893 1818 cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
1894 1819 WARNING: the p option (create packages) is set, but so is the N option (do
1895 1820 not run protocmp); this is dangerous; you should unset the N option
1896 1821 EOF
1897 1822 else
1898 1823 cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
1899 1824 Warning: the N option (do not run protocmp) is set; it probably shouldn't be
1900 1825 EOF
1901 1826 fi
1902 1827 echo "" | tee -a $mail_msg_file >> $LOGFILE
1903 1828 fi
1904 1829 fi
1905 1830
1906 1831 if [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then
1907 1832 #
1908 1833 # In the past we just complained but went ahead with the lint
1909 1834 # pass, even though the proto area was built non-DEBUG. It's
1910 1835 # unlikely that non-DEBUG headers will make a difference, but
1911 1836 # rather than assuming it's a safe combination, force the user
1912 1837 # to specify a DEBUG build.
1913 1838 #
1914 1839 echo "WARNING: DEBUG build not requested; disabling lint.\n" \
1915 1840 | tee -a $mail_msg_file >> $LOGFILE
1916 1841 l_FLAG=n
1917 1842 fi
1918 1843
1919 1844 if [ "$f_FLAG" = "y" ]; then
1920 1845 if [ "$i_FLAG" = "y" ]; then
1921 1846 echo "WARNING: the -f flag cannot be used during incremental" \
1922 1847 "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE
1923 1848 f_FLAG=n
1924 1849 fi
1925 1850 if [ "${l_FLAG}${p_FLAG}" != "yy" ]; then
1926 1851 echo "WARNING: the -f flag requires -l, and -p;" \
1927 1852 "ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE
1928 1853 f_FLAG=n
1929 1854 fi
1930 1855 fi
1931 1856
1932 1857 if [ "$w_FLAG" = "y" -a ! -d $ROOT ]; then
1933 1858 echo "WARNING: -w specified, but $ROOT does not exist;" \
1934 1859 "ignoring -w\n" | tee -a $mail_msg_file >> $LOGFILE
1935 1860 w_FLAG=n
1936 1861 fi
1937 1862
1938 1863 if [ "$t_FLAG" = "n" ]; then
1939 1864 #
1940 1865 # We're not doing a tools build, so make sure elfsign(1) is
1941 1866 # new enough to safely sign non-crypto binaries. We test
1942 1867 # debugging output from elfsign to detect the old version.
1943 1868 #
1944 1869 newelfsigntest=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \
1945 1870 -e /usr/lib/security/pkcs11_softtoken.so.1 2>&1 \
1946 1871 | egrep algorithmOID`
1947 1872 if [ -z "$newelfsigntest" ]; then
1948 1873 echo "WARNING: /usr/bin/elfsign out of date;" \
1949 1874 "will only sign crypto modules\n" | \
1950 1875 tee -a $mail_msg_file >> $LOGFILE
1951 1876 export ELFSIGN_OBJECT=true
1952 1877 elif [ "$VERIFY_ELFSIGN" = "y" ]; then
1953 1878 echo "WARNING: VERIFY_ELFSIGN=y requires" \
1954 1879 "the -t flag; ignoring VERIFY_ELFSIGN\n" | \
1955 1880 tee -a $mail_msg_file >> $LOGFILE
1956 1881 fi
1957 1882 fi
1958 1883
1959 1884 [ "$O_FLAG" = y ] && MULTI_PROTO=yes
1960 1885
1961 1886 case $MULTI_PROTO in
1962 1887 yes|no) ;;
1963 1888 *)
1964 1889 echo "WARNING: MULTI_PROTO is \"$MULTI_PROTO\"; " \
1965 1890 "should be \"yes\" or \"no\"." | tee -a $mail_msg_file >> $LOGFILE
1966 1891 echo "Setting MULTI_PROTO to \"no\".\n" | \
1967 1892 tee -a $mail_msg_file >> $LOGFILE
1968 1893 export MULTI_PROTO=no
1969 1894 ;;
1970 1895 esac
1971 1896
1972 1897 echo "\n==== Build version ====\n" | tee -a $mail_msg_file >> $LOGFILE
1973 1898 echo $VERSION | tee -a $mail_msg_file >> $LOGFILE
1974 1899
1975 1900 # Save the current proto area if we're comparing against the last build
1976 1901 if [ "$w_FLAG" = "y" -a -d "$ROOT" ]; then
1977 1902 if [ -d "$ROOT.prev" ]; then
1978 1903 rm -rf $ROOT.prev
1979 1904 fi
1980 1905 mv $ROOT $ROOT.prev
1981 1906 fi
1982 1907
1983 1908 # Same for non-DEBUG proto area
1984 1909 if [ "$w_FLAG" = "y" -a "$MULTI_PROTO" = yes -a -d "$ROOT-nd" ]; then
1985 1910 if [ -d "$ROOT-nd.prev" ]; then
1986 1911 rm -rf $ROOT-nd.prev
1987 1912 fi
1988 1913 mv $ROOT-nd $ROOT-nd.prev
1989 1914 fi
1990 1915
1991 1916 #
1992 1917 # Echo the SCM type of the parent workspace, this can't just be which_scm
1993 1918 # as that does not know how to identify various network repositories.
1994 1919 #
1995 1920 function parent_wstype {
1996 1921 typeset scm_type junk
1997 1922
1998 1923 CODEMGR_WS="$BRINGOVER_WS" "$WHICH_SCM" 2>/dev/null \
1999 1924 | read scm_type junk
2000 1925 if [[ -z "$scm_type" || "$scm_type" == unknown ]]; then
2001 1926 # Probe BRINGOVER_WS to determine its type
2002 1927 if [[ $BRINGOVER_WS == svn*://* ]]; then
2003 1928 scm_type="subversion"
2004 1929 elif [[ $BRINGOVER_WS == file://* ]] &&
2005 1930 egrep -s "This is a Subversion repository" \
2006 1931 ${BRINGOVER_WS#file://}/README.txt 2> /dev/null; then
2007 1932 scm_type="subversion"
2008 1933 elif [[ $BRINGOVER_WS == ssh://* ]]; then
2009 1934 scm_type="mercurial"
2010 1935 elif [[ $BRINGOVER_WS == http://* ]] && \
2011 1936 wget -q -O- --save-headers "$BRINGOVER_WS/?cmd=heads" | \
2012 1937 egrep -s "application/mercurial" 2> /dev/null; then
2013 1938 scm_type="mercurial"
2014 1939 elif svn info $BRINGOVER_WS > /dev/null 2>&1; then
2015 1940 scm_type="subversion"
2016 1941 else
2017 1942 scm_type="none"
2018 1943 fi
2019 1944 fi
2020 1945
2021 1946 # fold both unsupported and unrecognized results into "none"
2022 1947 case "$scm_type" in
2023 1948 none|subversion|teamware|mercurial)
2024 1949 ;;
2025 1950 *) scm_type=none
2026 1951 ;;
2027 1952 esac
2028 1953
2029 1954 echo $scm_type
2030 1955 }
2031 1956
2032 1957 # Echo the SCM types of $CODEMGR_WS and $BRINGOVER_WS
2033 1958 function child_wstype {
2034 1959 typeset scm_type junk
2035 1960
2036 1961 # Probe CODEMGR_WS to determine its type
2037 1962 if [[ -d $CODEMGR_WS ]]; then
2038 1963 $WHICH_SCM | read scm_type junk || exit 1
2039 1964 fi
2040 1965
2041 1966 case "$scm_type" in
2042 1967 none|subversion|git|teamware|mercurial)
2043 1968 ;;
2044 1969 *) scm_type=none
2045 1970 ;;
2046 1971 esac
2047 1972
2048 1973 echo $scm_type
2049 1974 }
2050 1975
2051 1976 SCM_TYPE=$(child_wstype)
2052 1977
2053 1978 #
2054 1979 # Decide whether to clobber
2055 1980 #
2056 1981 if [ "$i_FLAG" = "n" -a -d "$SRC" ]; then
2057 1982 echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE
2058 1983
2059 1984 cd $SRC
2060 1985 # remove old clobber file
2061 1986 rm -f $SRC/clobber.out
2062 1987 rm -f $SRC/clobber-${MACH}.out
2063 1988
2064 1989 # Remove all .make.state* files, just in case we are restarting
2065 1990 # the build after having interrupted a previous 'make clobber'.
2066 1991 find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \
2067 1992 -o -name 'interfaces.*' \) -prune \
2068 1993 -o -name '.make.*' -print | xargs rm -f
2069 1994
2070 1995 $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE
2071 1996 echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file
2072 1997 grep "$MAKE:" $SRC/clobber-${MACH}.out |
2073 1998 egrep -v "Ignoring unknown host" \
2074 1999 >> $mail_msg_file
2075 2000
2076 2001 if [[ "$t_FLAG" = "y" || "$O_FLAG" = "y" ]]; then
2077 2002 echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE
2078 2003 cd ${TOOLS}
2079 2004 rm -f ${TOOLS}/clobber-${MACH}.out
2080 2005 $MAKE TOOLS_PROTO=$TOOLS_PROTO -ek clobber 2>&1 | \
2081 2006 tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE
2082 2007 echo "\n==== Make tools clobber ERRORS ====\n" \
2083 2008 >> $mail_msg_file
2084 2009 grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \
2085 2010 >> $mail_msg_file
2086 2011 rm -rf ${TOOLS_PROTO}
2087 2012 mkdir -p ${TOOLS_PROTO}
2088 2013 fi
2089 2014
2090 2015 typeset roots=$(allprotos)
2091 2016 echo "\n\nClearing $roots" >> "$LOGFILE"
2092 2017 rm -rf $roots
2093 2018
2094 2019 # Get back to a clean workspace as much as possible to catch
2095 2020 # problems that only occur on fresh workspaces.
2096 2021 # Remove all .make.state* files, libraries, and .o's that may
2097 2022 # have been omitted from clobber. A couple of libraries are
2098 2023 # under source code control, so leave them alone.
2099 2024 # We should probably blow away temporary directories too.
2100 2025 cd $SRC
2101 2026 find $relsrcdirs \( -name SCCS -o -name .hg -o -name .svn \
2102 2027 -o -name .git -o -name 'interfaces.*' \) -prune -o \
2103 2028 \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \
2104 2029 -name '*.o' \) -print | \
2105 2030 grep -v 'tools/ctf/dwarf/.*/libdwarf' | xargs rm -f
2106 2031 else
2107 2032 echo "\n==== No clobber at `date` ====\n" >> $LOGFILE
2108 2033 fi
2109 2034
2110 2035 type bringover_teamware > /dev/null 2>&1 || function bringover_teamware {
2111 2036 # sleep on the parent workspace's lock
2112 2037 while egrep -s write $BRINGOVER_WS/Codemgr_wsdata/locks
2113 2038 do
2114 2039 sleep 120
2115 2040 done
2116 2041
2117 2042 if [[ -z $BRINGOVER ]]; then
2118 2043 BRINGOVER=$TEAMWARE/bin/bringover
2119 2044 fi
2120 2045
2121 2046 staffer $BRINGOVER -c "nightly update" -p $BRINGOVER_WS \
2122 2047 -w $CODEMGR_WS $BRINGOVER_FILES < /dev/null 2>&1 ||
2123 2048 touch $TMPDIR/bringover_failed
2124 2049
2125 2050 staffer bringovercheck $CODEMGR_WS >$TMPDIR/bringovercheck.out 2>&1
2126 2051 if [ -s $TMPDIR/bringovercheck.out ]; then
2127 2052 echo "\n==== POST-BRINGOVER CLEANUP NOISE ====\n"
2128 2053 cat $TMPDIR/bringovercheck.out
2129 2054 fi
2130 2055 }
2131 2056
2132 2057 type bringover_mercurial > /dev/null 2>&1 || function bringover_mercurial {
↓ open down ↓ |
727 lines elided |
↑ open up ↑ |
2133 2058 typeset -x PATH=$PATH
2134 2059
2135 2060 # If the repository doesn't exist yet, then we want to populate it.
2136 2061 if [[ ! -d $CODEMGR_WS/.hg ]]; then
2137 2062 staffer hg init $CODEMGR_WS
2138 2063 staffer echo "[paths]" > $CODEMGR_WS/.hg/hgrc
2139 2064 staffer echo "default=$BRINGOVER_WS" >> $CODEMGR_WS/.hg/hgrc
2140 2065 touch $TMPDIR/new_repository
2141 2066 fi
2142 2067
2143 - #
2144 - # If the user set CLOSED_BRINGOVER_WS and didn't set CLOSED_IS_PRESENT
2145 - # to "no," then we'll want to initialise the closed repository
2146 - #
2147 - # We use $orig_closed_is_present instead of $CLOSED_IS_PRESENT,
2148 - # because for newly-created source trees, the latter will be "no"
2149 - # until after the bringover completes.
2150 - #
2151 - if [[ "$orig_closed_is_present" != "no" && \
2152 - -n "$CLOSED_BRINGOVER_WS" && \
2153 - ! -d $CODEMGR_WS/usr/closed/.hg ]]; then
2154 - staffer mkdir -p $CODEMGR_WS/usr/closed
2155 - staffer hg init $CODEMGR_WS/usr/closed
2156 - staffer echo "[paths]" > $CODEMGR_WS/usr/closed/.hg/hgrc
2157 - staffer echo "default=$CLOSED_BRINGOVER_WS" >> $CODEMGR_WS/usr/closed/.hg/hgrc
2158 - touch $TMPDIR/new_closed
2159 - export CLOSED_IS_PRESENT=yes
2160 - fi
2161 -
2162 2068 typeset -x HGMERGE="/bin/false"
2163 2069
2164 2070 #
2165 2071 # If the user has changes, regardless of whether those changes are
2166 2072 # committed, and regardless of whether those changes conflict, then
2167 2073 # we'll attempt to merge them either implicitly (uncommitted) or
2168 2074 # explicitly (committed).
2169 2075 #
2170 2076 # These are the messages we'll use to help clarify mercurial output
2171 2077 # in those cases.
2172 2078 #
2173 2079 typeset mergefailmsg="\
2174 2080 ***\n\
2175 2081 *** nightly was unable to automatically merge your changes. You should\n\
2176 2082 *** redo the full merge manually, following the steps outlined by mercurial\n\
2177 2083 *** above, then restart nightly.\n\
2178 2084 ***\n"
2179 2085 typeset mergepassmsg="\
2180 2086 ***\n\
2181 2087 *** nightly successfully merged your changes. This means that your working\n\
2182 2088 *** directory has been updated, but those changes are not yet committed.\n\
2183 2089 *** After nightly completes, you should validate the results of the merge,\n\
2184 2090 *** then use hg commit manually.\n\
2185 2091 ***\n"
2186 2092
2187 2093 #
2188 2094 # For each repository in turn:
2189 2095 #
2190 2096 # 1. Do the pull. If this fails, dump the output and bail out.
2191 2097 #
2192 2098 # 2. If the pull resulted in an extra head, do an explicit merge.
2193 2099 # If this fails, dump the output and bail out.
2194 2100 #
2195 2101 # Because we can't rely on Mercurial to exit with a failure code
2196 2102 # when a merge fails (Mercurial issue #186), we must grep the
2197 2103 # output of pull/merge to check for attempted and/or failed merges.
2198 2104 #
2199 2105 # 3. If a merge failed, set the message and fail the bringover.
2200 2106 #
2201 2107 # 4. Otherwise, if a merge succeeded, set the message
2202 2108 #
2203 2109 # 5. Dump the output, and any message from step 3 or 4.
2204 2110 #
2205 2111
2206 2112 typeset HG_SOURCE=$BRINGOVER_WS
2207 2113 if [ ! -f $TMPDIR/new_repository ]; then
2208 2114 HG_SOURCE=$TMPDIR/open_bundle.hg
2209 2115 staffer hg --cwd $CODEMGR_WS incoming --bundle $HG_SOURCE \
2210 2116 -v $BRINGOVER_WS > $TMPDIR/incoming_open.out
2211 2117
2212 2118 #
2213 2119 # If there are no incoming changesets, then incoming will
2214 2120 # fail, and there will be no bundle file. Reset the source,
2215 2121 # to allow the remaining logic to complete with no false
2216 2122 # negatives. (Unlike incoming, pull will return success
2217 2123 # for the no-change case.)
2218 2124 #
2219 2125 if (( $? != 0 )); then
2220 2126 HG_SOURCE=$BRINGOVER_WS
2221 2127 fi
2222 2128 fi
2223 2129
2224 2130 staffer hg --cwd $CODEMGR_WS pull -u $HG_SOURCE \
2225 2131 > $TMPDIR/pull_open.out 2>&1
2226 2132 if (( $? != 0 )); then
2227 2133 printf "%s: pull failed as follows:\n\n" "$CODEMGR_WS"
2228 2134 cat $TMPDIR/pull_open.out
2229 2135 if grep "^merging.*failed" $TMPDIR/pull_open.out > /dev/null 2>&1; then
2230 2136 printf "$mergefailmsg"
2231 2137 fi
2232 2138 touch $TMPDIR/bringover_failed
2233 2139 return
2234 2140 fi
2235 2141
2236 2142 if grep "not updating" $TMPDIR/pull_open.out > /dev/null 2>&1; then
2237 2143 staffer hg --cwd $CODEMGR_WS merge \
2238 2144 >> $TMPDIR/pull_open.out 2>&1
2239 2145 if (( $? != 0 )); then
2240 2146 printf "%s: merge failed as follows:\n\n" \
2241 2147 "$CODEMGR_WS"
2242 2148 cat $TMPDIR/pull_open.out
2243 2149 if grep "^merging.*failed" $TMPDIR/pull_open.out \
2244 2150 > /dev/null 2>&1; then
2245 2151 printf "$mergefailmsg"
2246 2152 fi
2247 2153 touch $TMPDIR/bringover_failed
2248 2154 return
2249 2155 fi
↓ open down ↓ |
78 lines elided |
↑ open up ↑ |
2250 2156 fi
2251 2157
2252 2158 printf "updated %s with the following results:\n" "$CODEMGR_WS"
2253 2159 cat $TMPDIR/pull_open.out
2254 2160 if grep "^merging" $TMPDIR/pull_open.out >/dev/null 2>&1; then
2255 2161 printf "$mergepassmsg"
2256 2162 fi
2257 2163 printf "\n"
2258 2164
2259 2165 #
2260 - # We only want to update usr/closed if it exists, and we haven't been
2261 - # told not to via $CLOSED_IS_PRESENT, and we actually know where to
2262 - # pull from ($CLOSED_BRINGOVER_WS).
2263 - #
2264 - if [[ $CLOSED_IS_PRESENT = yes && \
2265 - -d $CODEMGR_WS/usr/closed/.hg && \
2266 - -n $CLOSED_BRINGOVER_WS ]]; then
2267 -
2268 - HG_SOURCE=$CLOSED_BRINGOVER_WS
2269 - if [ ! -f $TMPDIR/new_closed ]; then
2270 - HG_SOURCE=$TMPDIR/closed_bundle.hg
2271 - staffer hg --cwd $CODEMGR_WS/usr/closed incoming \
2272 - --bundle $HG_SOURCE -v $CLOSED_BRINGOVER_WS \
2273 - > $TMPDIR/incoming_closed.out
2274 -
2275 - #
2276 - # If there are no incoming changesets, then incoming will
2277 - # fail, and there will be no bundle file. Reset the source,
2278 - # to allow the remaining logic to complete with no false
2279 - # negatives. (Unlike incoming, pull will return success
2280 - # for the no-change case.)
2281 - #
2282 - if (( $? != 0 )); then
2283 - HG_SOURCE=$CLOSED_BRINGOVER_WS
2284 - fi
2285 - fi
2286 -
2287 - staffer hg --cwd $CODEMGR_WS/usr/closed pull -u \
2288 - $HG_SOURCE > $TMPDIR/pull_closed.out 2>&1
2289 - if (( $? != 0 )); then
2290 - printf "closed pull failed as follows:\n\n"
2291 - cat $TMPDIR/pull_closed.out
2292 - if grep "^merging.*failed" $TMPDIR/pull_closed.out \
2293 - > /dev/null 2>&1; then
2294 - printf "$mergefailmsg"
2295 - fi
2296 - touch $TMPDIR/bringover_failed
2297 - return
2298 - fi
2299 -
2300 - if grep "not updating" $TMPDIR/pull_closed.out > /dev/null 2>&1; then
2301 - staffer hg --cwd $CODEMGR_WS/usr/closed merge \
2302 - >> $TMPDIR/pull_closed.out 2>&1
2303 - if (( $? != 0 )); then
2304 - printf "closed merge failed as follows:\n\n"
2305 - cat $TMPDIR/pull_closed.out
2306 - if grep "^merging.*failed" $TMPDIR/pull_closed.out > /dev/null 2>&1; then
2307 - printf "$mergefailmsg"
2308 - fi
2309 - touch $TMPDIR/bringover_failed
2310 - return
2311 - fi
2312 - fi
2313 -
2314 - printf "updated %s with the following results:\n" \
2315 - "$CODEMGR_WS/usr/closed"
2316 - cat $TMPDIR/pull_closed.out
2317 - if grep "^merging" $TMPDIR/pull_closed.out > /dev/null 2>&1; then
2318 - printf "$mergepassmsg"
2319 - fi
2320 - fi
2321 -
2322 - #
2323 2166 # Per-changeset output is neither useful nor manageable for a
2324 2167 # newly-created repository.
2325 2168 #
2326 2169 if [ -f $TMPDIR/new_repository ]; then
2327 2170 return
2328 2171 fi
2329 2172
2330 2173 printf "\nadded the following changesets to open repository:\n"
2331 2174 cat $TMPDIR/incoming_open.out
2332 2175
2333 2176 #
2334 2177 # The closed repository could have been newly created, even though
2335 2178 # the open one previously existed...
2336 2179 #
2337 2180 if [ -f $TMPDIR/new_closed ]; then
2338 2181 return
2339 2182 fi
2340 2183
2341 2184 if [ -f $TMPDIR/incoming_closed.out ]; then
2342 2185 printf "\nadded the following changesets to closed repository:\n"
2343 2186 cat $TMPDIR/incoming_closed.out
2344 2187 fi
2345 2188 }
2346 2189
2347 2190 type bringover_subversion > /dev/null 2>&1 || function bringover_subversion {
2348 2191 typeset -x PATH=$PATH
2349 2192
2350 2193 if [[ ! -d $CODEMGR_WS/.svn ]]; then
2351 2194 staffer svn checkout $BRINGOVER_WS $CODEMGR_WS ||
2352 2195 touch $TMPDIR/bringover_failed
2353 2196 else
2354 2197 typeset root
2355 2198 root=$(staffer svn info $CODEMGR_WS |
2356 2199 nawk '/^Repository Root:/ {print $NF}')
2357 2200 if [[ $root != $BRINGOVER_WS ]]; then
2358 2201 # We fail here because there's no way to update
2359 2202 # from a named repo.
2360 2203 cat <<-EOF
2361 2204 \$BRINGOVER_WS doesn't match repository root:
2362 2205 \$BRINGOVER_WS: $BRINGOVER_WS
2363 2206 Repository root: $root
2364 2207 EOF
2365 2208 touch $TMPDIR/bringover_failed
2366 2209 else
2367 2210 # If a conflict happens, svn still exits 0.
2368 2211 staffer svn update $CODEMGR_WS | tee $TMPDIR/pull.out ||
2369 2212 touch $TMPDIR/bringover_failed
2370 2213 if grep "^C" $TMPDIR/pull.out > /dev/null 2>&1; then
2371 2214 touch $TMPDIR/bringover_failed
2372 2215 fi
2373 2216 fi
2374 2217 fi
2375 2218 }
2376 2219
2377 2220 type bringover_none > /dev/null 2>&1 || function bringover_none {
2378 2221 echo "Couldn't figure out what kind of SCM to use for $BRINGOVER_WS."
2379 2222 touch $TMPDIR/bringover_failed
2380 2223 }
2381 2224
2382 2225 #
2383 2226 # Decide whether to bringover to the codemgr workspace
2384 2227 #
2385 2228 if [ "$n_FLAG" = "n" ]; then
2386 2229 PARENT_SCM_TYPE=$(parent_wstype)
2387 2230
2388 2231 if [[ $SCM_TYPE != none && $SCM_TYPE != $PARENT_SCM_TYPE ]]; then
2389 2232 echo "cannot bringover from $PARENT_SCM_TYPE to $SCM_TYPE, " \
2390 2233 "quitting at `date`." | tee -a $mail_msg_file >> $LOGFILE
2391 2234 exit 1
2392 2235 fi
2393 2236
2394 2237 run_hook PRE_BRINGOVER
2395 2238
2396 2239 echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE
2397 2240 echo "\n==== BRINGOVER LOG ====\n" >> $mail_msg_file
2398 2241
2399 2242 eval "bringover_${PARENT_SCM_TYPE}" 2>&1 |
2400 2243 tee -a $mail_msg_file >> $LOGFILE
2401 2244
2402 2245 if [ -f $TMPDIR/bringover_failed ]; then
2403 2246 rm -f $TMPDIR/bringover_failed
2404 2247 build_ok=n
2405 2248 echo "trouble with bringover, quitting at `date`." |
2406 2249 tee -a $mail_msg_file >> $LOGFILE
2407 2250 exit 1
2408 2251 fi
↓ open down ↓ |
76 lines elided |
↑ open up ↑ |
2409 2252
2410 2253 #
2411 2254 # It's possible that we used the bringover above to create
2412 2255 # $CODEMGR_WS. If so, then SCM_TYPE was previously "none,"
2413 2256 # but should now be the same as $BRINGOVER_WS.
2414 2257 #
2415 2258 [[ $SCM_TYPE = none ]] && SCM_TYPE=$PARENT_SCM_TYPE
2416 2259
2417 2260 run_hook POST_BRINGOVER
2418 2261
2419 - #
2420 - # Possible transition from pre-split workspace to split
2421 - # workspace. See if the bringover changed anything.
2422 - #
2423 - CLOSED_IS_PRESENT="$orig_closed_is_present"
2424 2262 check_closed_tree
2425 2263
2426 2264 else
2427 2265 echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE
2428 2266 fi
2429 2267
2430 -if [[ "$O_FLAG" = y && "$CLOSED_IS_PRESENT" != "yes" ]]; then
2268 +if [[ "$O_FLAG" = y ]]; then
2431 2269 build_ok=n
2432 2270 echo "OpenSolaris binary deliverables need usr/closed." \
2433 2271 | tee -a "$mail_msg_file" >> $LOGFILE
2434 2272 exit 1
2435 2273 fi
2436 2274
2437 2275 # Safeguards
2438 2276 [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
2439 2277 [[ -d "${CODEMGR_WS}" ]] || fatal_error "Error: ${CODEMGR_WS} is not a directory."
2440 2278 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
2441 2279
2442 2280 echo "\n==== Build environment ====\n" | tee -a $build_environ_file >> $LOGFILE
2443 2281
2444 2282 # System
2445 2283 whence uname | tee -a $build_environ_file >> $LOGFILE
2446 2284 uname -a 2>&1 | tee -a $build_environ_file >> $LOGFILE
2447 2285 echo | tee -a $build_environ_file >> $LOGFILE
2448 2286
2449 2287 # make
2450 2288 whence $MAKE | tee -a $build_environ_file >> $LOGFILE
2451 2289 $MAKE -v | tee -a $build_environ_file >> $LOGFILE
2452 2290 echo "number of concurrent jobs = $DMAKE_MAX_JOBS" |
2453 2291 tee -a $build_environ_file >> $LOGFILE
2454 2292
2455 2293 #
2456 2294 # Report the compiler versions.
2457 2295 #
2458 2296
2459 2297 if [[ ! -f $SRC/Makefile ]]; then
2460 2298 build_ok=n
2461 2299 echo "\nUnable to find \"Makefile\" in $SRC." | \
2462 2300 tee -a $build_environ_file >> $LOGFILE
2463 2301 exit 1
2464 2302 fi
2465 2303
2466 2304 ( cd $SRC
2467 2305 for target in cc-version cc64-version java-version; do
2468 2306 echo
2469 2307 #
2470 2308 # Put statefile somewhere we know we can write to rather than trip
2471 2309 # over a read-only $srcroot.
2472 2310 #
2473 2311 rm -f $TMPDIR/make-state
2474 2312 export SRC
2475 2313 if $MAKE -K $TMPDIR/make-state -e $target 2>/dev/null; then
2476 2314 continue
2477 2315 fi
2478 2316 touch $TMPDIR/nocompiler
2479 2317 done
2480 2318 echo
2481 2319 ) | tee -a $build_environ_file >> $LOGFILE
2482 2320
2483 2321 if [ -f $TMPDIR/nocompiler ]; then
2484 2322 rm -f $TMPDIR/nocompiler
2485 2323 build_ok=n
2486 2324 echo "Aborting due to missing compiler." |
2487 2325 tee -a $build_environ_file >> $LOGFILE
2488 2326 exit 1
2489 2327 fi
2490 2328
2491 2329 # as
2492 2330 whence as | tee -a $build_environ_file >> $LOGFILE
2493 2331 as -V 2>&1 | head -1 | tee -a $build_environ_file >> $LOGFILE
2494 2332 echo | tee -a $build_environ_file >> $LOGFILE
2495 2333
2496 2334 # Check that we're running a capable link-editor
2497 2335 whence ld | tee -a $build_environ_file >> $LOGFILE
2498 2336 LDVER=`ld -V 2>&1`
2499 2337 echo $LDVER | tee -a $build_environ_file >> $LOGFILE
2500 2338 LDVER=`echo $LDVER | sed -e "s/.*-1\.\([0-9]*\).*/\1/"`
2501 2339 if [ `expr $LDVER \< 422` -eq 1 ]; then
2502 2340 echo "The link-editor needs to be at version 422 or higher to build" | \
2503 2341 tee -a $build_environ_file >> $LOGFILE
2504 2342 echo "the latest stuff. Hope your build works." | \
2505 2343 tee -a $build_environ_file >> $LOGFILE
2506 2344 fi
2507 2345
2508 2346 #
2509 2347 # Build and use the workspace's tools if requested
2510 2348 #
2511 2349 if [[ "$t_FLAG" = "y" || "$O_FLAG" = y ]]; then
2512 2350 set_non_debug_build_flags
2513 2351
2514 2352 build_tools ${TOOLS_PROTO}
2515 2353 if [[ $? != 0 && "$t_FLAG" = y ]]; then
2516 2354 use_tools $TOOLS_PROTO
2517 2355 fi
2518 2356 fi
2519 2357
2520 2358 #
2521 2359 # copy ihv proto area in addition to the build itself
2522 2360 #
2523 2361 if [ "$X_FLAG" = "y" ]; then
2524 2362 copy_ihv_proto
2525 2363 fi
2526 2364
2527 2365 if [ "$i_FLAG" = "y" -a "$SH_FLAG" = "y" ]; then
2528 2366 echo "\n==== NOT Building base OS-Net source ====\n" | \
2529 2367 tee -a $LOGFILE >> $mail_msg_file
2530 2368 else
2531 2369 # timestamp the start of the normal build; the findunref tool uses it.
2532 2370 touch $SRC/.build.tstamp
2533 2371
2534 2372 normal_build
2535 2373 fi
2536 2374
2537 2375 #
2538 2376 # Generate the THIRDPARTYLICENSE files if needed. This is done after
2539 2377 # the build, so that dynamically-created license files are there.
2540 2378 # It's done before findunref to help identify license files that need
2541 2379 # to be added to tools/opensolaris/license-list.
2542 2380 #
2543 2381 if [ "$O_FLAG" = y -a "$build_ok" = y ]; then
2544 2382 echo "\n==== Generating THIRDPARTYLICENSE files ====\n" |
2545 2383 tee -a "$mail_msg_file" >> "$LOGFILE"
2546 2384
2547 2385 if [ -d $ROOT/licenses/usr ]; then
2548 2386 ( cd $ROOT/licenses ; \
2549 2387 mktpl $SRC/pkg/license-list ) >> "$LOGFILE" 2>&1
2550 2388 if (( $? != 0 )) ; then
2551 2389 echo "Couldn't create THIRDPARTYLICENSE files" |
2552 2390 tee -a "$mail_msg_file" >> "$LOGFILE"
2553 2391 fi
2554 2392 else
2555 2393 echo "No licenses found under $ROOT/licenses" |
2556 2394 tee -a "$mail_msg_file" >> "$LOGFILE"
2557 2395 fi
2558 2396 fi
2559 2397
2560 2398 ORIG_SRC=$SRC
2561 2399 BINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z
2562 2400
2563 2401 if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then
2564 2402 save_binaries
2565 2403 fi
2566 2404
2567 2405
2568 2406 # EXPORT_SRC comes after CRYPT_SRC since a domestic build will need
2569 2407 # $SRC pointing to the export_source usr/src.
2570 2408
2571 2409 if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then
2572 2410 if [ "$SD_FLAG" = "y" -a $build_ok = y ]; then
2573 2411 set_up_source_build ${CODEMGR_WS} ${CRYPT_SRC} CRYPT_SRC
2574 2412 fi
2575 2413
2576 2414 if [ $build_ok = y ]; then
2577 2415 set_up_source_build ${CODEMGR_WS} ${EXPORT_SRC} EXPORT_SRC
2578 2416 fi
2579 2417 fi
2580 2418
2581 2419 if [ "$SD_FLAG" = "y" -a $build_ok = y ]; then
2582 2420 # drop the crypt files in place.
2583 2421 cd ${EXPORT_SRC}
2584 2422 echo "\nextracting crypt_files.cpio.Z onto export_source.\n" \
2585 2423 >> ${LOGFILE}
2586 2424 zcat ${CODEMGR_WS}/crypt_files.cpio.Z | \
2587 2425 cpio -idmucvB 2>/dev/null >> ${LOGFILE}
2588 2426 if [ "$?" = "0" ]; then
2589 2427 echo "\n==== DOMESTIC extraction succeeded ====\n" \
2590 2428 >> $mail_msg_file
2591 2429 else
2592 2430 echo "\n==== DOMESTIC extraction failed ====\n" \
2593 2431 >> $mail_msg_file
2594 2432 fi
2595 2433
2596 2434 fi
2597 2435
2598 2436 if [ "$SO_FLAG" = "y" -a "$build_ok" = y ]; then
2599 2437 #
↓ open down ↓ |
159 lines elided |
↑ open up ↑ |
2600 2438 # Copy the open sources into their own tree.
2601 2439 # If copy_source fails, it will have already generated an
2602 2440 # error message and set build_ok=n, so we don't need to worry
2603 2441 # about that here.
2604 2442 #
2605 2443 copy_source $CODEMGR_WS $OPEN_SRCDIR OPEN_SOURCE usr/src
2606 2444 fi
2607 2445
2608 2446 if [ "$SO_FLAG" = "y" -a "$build_ok" = y ]; then
2609 2447 SRC=$OPEN_SRCDIR/usr/src
2610 - export CLOSED_IS_PRESENT=no
2611 2448 fi
2612 2449
2613 2450 if is_source_build && [ $build_ok = y ] ; then
2614 2451 # remove proto area(s) here, since we don't clobber
2615 2452 rm -rf `allprotos`
2616 2453 if [ "$t_FLAG" = "y" ]; then
2617 2454 set_non_debug_build_flags
2618 2455 ORIG_TOOLS=$TOOLS
2619 2456 #
2620 2457 # SRC was set earlier to point to the source build
2621 2458 # source tree (e.g., $EXPORT_SRC).
2622 2459 #
2623 2460 TOOLS=${SRC}/tools
2624 2461 TOOLS_PROTO=${TOOLS}/${TOOLS_PROTO_REL}; export TOOLS_PROTO
2625 2462 build_tools ${TOOLS_PROTO}
2626 2463 if [[ $? != 0 ]]; then
2627 2464 use_tools ${TOOLS_PROTO}
2628 2465 fi
2629 2466 fi
2630 2467
2631 2468 normal_build
2632 2469 fi
2633 2470
2634 2471 #
2635 2472 # There are several checks that need to look at the proto area, but
2636 2473 # they only need to look at one, and they don't care whether it's
2637 2474 # DEBUG or non-DEBUG.
2638 2475 #
2639 2476 if [[ "$MULTI_PROTO" = yes && "$D_FLAG" = n ]]; then
2640 2477 checkroot=$ROOT-nd
2641 2478 else
2642 2479 checkroot=$ROOT
2643 2480 fi
2644 2481
2645 2482 if [ "$build_ok" = "y" ]; then
2646 2483 echo "\n==== Creating protolist system file at `date` ====" \
2647 2484 >> $LOGFILE
2648 2485 protolist $checkroot > $ATLOG/proto_list_${MACH}
2649 2486 echo "==== protolist system file created at `date` ====\n" \
2650 2487 >> $LOGFILE
2651 2488
2652 2489 if [ "$N_FLAG" != "y" ]; then
2653 2490
2654 2491 E1=
2655 2492 f1=
2656 2493 if [ -d "$SRC/pkgdefs" ]; then
2657 2494 f1="$SRC/pkgdefs/etc/exception_list_$MACH"
2658 2495 if [ "$X_FLAG" = "y" ]; then
2659 2496 f1="$f1 $IA32_IHV_WS/usr/src/pkgdefs/etc/exception_list_$MACH"
2660 2497 fi
2661 2498 fi
2662 2499
2663 2500 for f in $f1; do
2664 2501 if [ -f "$f" ]; then
2665 2502 E1="$E1 -e $f"
2666 2503 fi
2667 2504 done
2668 2505
2669 2506 E2=
2670 2507 f2=
2671 2508 if [ -d "$SRC/pkg" ]; then
2672 2509 f2="$f2 exceptions/packaging"
2673 2510 fi
2674 2511
2675 2512 for f in $f2; do
2676 2513 if [ -f "$f" ]; then
2677 2514 E2="$E2 -e $f"
2678 2515 fi
2679 2516 done
2680 2517
2681 2518 if [ -f "$REF_PROTO_LIST" ]; then
2682 2519 #
2683 2520 # For builds that copy the IHV proto area (-X), add the
2684 2521 # IHV proto list to the reference list if the reference
2685 2522 # was built without -X.
2686 2523 #
2687 2524 # For builds that don't copy the IHV proto area, add the
2688 2525 # IHV proto list to the build's proto list if the
2689 2526 # reference was built with -X.
2690 2527 #
2691 2528 # Use the presence of the first file entry of the cached
2692 2529 # IHV proto list in the reference list to determine
2693 2530 # whether it was built with -X or not.
2694 2531 #
2695 2532 IHV_REF_PROTO_LIST=$SRC/pkg/proto_list_ihv_$MACH
2696 2533 grepfor=$(nawk '$1 == "f" { print $2; exit }' \
2697 2534 $IHV_REF_PROTO_LIST 2> /dev/null)
2698 2535 if [ $? = 0 -a -n "$grepfor" ]; then
2699 2536 if [ "$X_FLAG" = "y" ]; then
2700 2537 grep -w "$grepfor" \
2701 2538 $REF_PROTO_LIST > /dev/null
2702 2539 if [ ! "$?" = "0" ]; then
2703 2540 REF_IHV_PROTO="-d $IHV_REF_PROTO_LIST"
2704 2541 fi
2705 2542 else
2706 2543 grep -w "$grepfor" \
2707 2544 $REF_PROTO_LIST > /dev/null
2708 2545 if [ "$?" = "0" ]; then
2709 2546 IHV_PROTO_LIST="$IHV_REF_PROTO_LIST"
2710 2547 fi
2711 2548 fi
2712 2549 fi
2713 2550 fi
2714 2551 fi
2715 2552
2716 2553 if [ "$N_FLAG" != "y" -a -f $SRC/pkgdefs/Makefile ]; then
2717 2554 echo "\n==== Impact on SVr4 packages ====\n" >> $mail_msg_file
2718 2555 #
2719 2556 # Compare the build's proto list with current package
2720 2557 # definitions to audit the quality of package
2721 2558 # definitions and makefile install targets. Use the
2722 2559 # current exception list.
2723 2560 #
2724 2561 PKGDEFS_LIST=""
2725 2562 for d in $abssrcdirs; do
2726 2563 if [ -d $d/pkgdefs ]; then
2727 2564 PKGDEFS_LIST="$PKGDEFS_LIST -d $d/pkgdefs"
2728 2565 fi
2729 2566 done
2730 2567 if [ "$X_FLAG" = "y" -a \
2731 2568 -d $IA32_IHV_WS/usr/src/pkgdefs ]; then
2732 2569 PKGDEFS_LIST="$PKGDEFS_LIST -d $IA32_IHV_WS/usr/src/pkgdefs"
2733 2570 fi
2734 2571 $PROTOCMPTERSE \
2735 2572 "Files missing from the proto area:" \
2736 2573 "Files missing from packages:" \
2737 2574 "Inconsistencies between pkgdefs and proto area:" \
2738 2575 ${E1} \
2739 2576 ${PKGDEFS_LIST} \
2740 2577 $ATLOG/proto_list_${MACH} \
2741 2578 >> $mail_msg_file
2742 2579 fi
2743 2580
2744 2581 if [ "$N_FLAG" != "y" -a -d $SRC/pkg ]; then
2745 2582 echo "\n==== Validating manifests against proto area ====\n" \
2746 2583 >> $mail_msg_file
2747 2584 ( cd $SRC/pkg ; $MAKE -e protocmp ROOT="$checkroot" ) \
2748 2585 >> $mail_msg_file
2749 2586
2750 2587 fi
2751 2588
2752 2589 if [ "$N_FLAG" != "y" -a -f "$REF_PROTO_LIST" ]; then
2753 2590 echo "\n==== Impact on proto area ====\n" >> $mail_msg_file
2754 2591 if [ -n "$E2" ]; then
2755 2592 ELIST=$E2
2756 2593 else
2757 2594 ELIST=$E1
2758 2595 fi
2759 2596 $PROTOCMPTERSE \
2760 2597 "Files in yesterday's proto area, but not today's:" \
2761 2598 "Files in today's proto area, but not yesterday's:" \
2762 2599 "Files that changed between yesterday and today:" \
2763 2600 ${ELIST} \
2764 2601 -d $REF_PROTO_LIST \
2765 2602 $REF_IHV_PROTO \
2766 2603 $ATLOG/proto_list_${MACH} \
2767 2604 $IHV_PROTO_LIST \
2768 2605 >> $mail_msg_file
2769 2606 fi
2770 2607 fi
2771 2608
2772 2609 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
2773 2610 staffer cp $ATLOG/proto_list_${MACH} \
2774 2611 $PARENT_WS/usr/src/proto_list_${MACH}
2775 2612 fi
2776 2613
2777 2614 # Update parent proto area if necessary. This is done now
2778 2615 # so that the proto area has either DEBUG or non-DEBUG kernels.
2779 2616 # Note that this clears out the lock file, so we can dispense with
2780 2617 # the variable now.
2781 2618 if [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then
2782 2619 echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \
2783 2620 tee -a $LOGFILE >> $mail_msg_file
2784 2621 rm -rf $NIGHTLY_PARENT_ROOT/*
2785 2622 unset Ulockfile
2786 2623 mkdir -p $NIGHTLY_PARENT_ROOT
2787 2624 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
2788 2625 ( cd $ROOT; tar cf - . |
2789 2626 ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf - ) ) 2>&1 |
2790 2627 tee -a $mail_msg_file >> $LOGFILE
2791 2628 fi
2792 2629 if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n ]]; then
2793 2630 rm -rf $NIGHTLY_PARENT_ROOT-nd/*
2794 2631 mkdir -p $NIGHTLY_PARENT_ROOT-nd
2795 2632 cd $ROOT-nd
2796 2633 ( tar cf - . |
2797 2634 ( cd $NIGHTLY_PARENT_ROOT-nd; umask 0; tar xpf - ) ) 2>&1 |
2798 2635 tee -a $mail_msg_file >> $LOGFILE
2799 2636 fi
2800 2637 if [ -n "${NIGHTLY_PARENT_TOOLS_ROOT}" ]; then
2801 2638 echo "\n==== Copying tools proto area to $NIGHTLY_PARENT_TOOLS_ROOT ====\n" | \
2802 2639 tee -a $LOGFILE >> $mail_msg_file
2803 2640 rm -rf $NIGHTLY_PARENT_TOOLS_ROOT/*
2804 2641 mkdir -p $NIGHTLY_PARENT_TOOLS_ROOT
2805 2642 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
2806 2643 ( cd $TOOLS_PROTO; tar cf - . |
2807 2644 ( cd $NIGHTLY_PARENT_TOOLS_ROOT;
2808 2645 umask 0; tar xpf - ) ) 2>&1 |
2809 2646 tee -a $mail_msg_file >> $LOGFILE
2810 2647 fi
2811 2648 fi
2812 2649 fi
2813 2650
2814 2651 #
2815 2652 # ELF verification: ABI (-A) and runtime (-r) checks
2816 2653 #
2817 2654 if [[ ($build_ok = y) && ( ($A_FLAG = y) || ($r_FLAG = y) ) ]]; then
2818 2655 # Directory ELF-data.$MACH holds the files produced by these tests.
2819 2656 elf_ddir=$SRC/ELF-data.$MACH
2820 2657
2821 2658 # If there is a previous ELF-data backup directory, remove it. Then,
2822 2659 # rotate current ELF-data directory into its place and create a new
2823 2660 # empty directory
2824 2661 rm -rf $elf_ddir.ref
2825 2662 if [[ -d $elf_ddir ]]; then
2826 2663 mv $elf_ddir $elf_ddir.ref
2827 2664 fi
2828 2665 mkdir -p $elf_ddir
2829 2666
2830 2667 # Call find_elf to produce a list of the ELF objects in the proto area.
2831 2668 # This list is passed to check_rtime and interface_check, preventing
2832 2669 # them from separately calling find_elf to do the same work twice.
2833 2670 find_elf -fr $checkroot > $elf_ddir/object_list
2834 2671
2835 2672 if [[ $A_FLAG = y ]]; then
2836 2673 echo "\n==== Check versioning and ABI information ====\n" | \
2837 2674 tee -a $LOGFILE >> $mail_msg_file
2838 2675
2839 2676 # Produce interface description for the proto. Report errors.
2840 2677 interface_check -o -w $elf_ddir -f object_list \
2841 2678 -i interface -E interface.err
2842 2679 if [[ -s $elf_ddir/interface.err ]]; then
2843 2680 tee -a $LOGFILE < $elf_ddir/interface.err \
2844 2681 >> $mail_msg_file
2845 2682 fi
2846 2683
2847 2684 # If ELF_DATA_BASELINE_DIR is defined, compare the new interface
2848 2685 # description file to that from the baseline gate. Issue a
2849 2686 # warning if the baseline is not present, and keep going.
2850 2687 if [[ "$ELF_DATA_BASELINE_DIR" != '' ]]; then
2851 2688 base_ifile="$ELF_DATA_BASELINE_DIR/interface"
2852 2689
2853 2690 echo "\n==== Compare versioning and ABI information" \
2854 2691 "to baseline ====\n" | \
2855 2692 tee -a $LOGFILE >> $mail_msg_file
2856 2693 echo "Baseline: $base_ifile\n" >> $LOGFILE
2857 2694
2858 2695 if [[ -f $base_ifile ]]; then
2859 2696 interface_cmp -d -o $base_ifile \
2860 2697 $elf_ddir/interface > $elf_ddir/interface.cmp
2861 2698 if [[ -s $elf_ddir/interface.cmp ]]; then
2862 2699 echo | tee -a $LOGFILE >> $mail_msg_file
2863 2700 tee -a $LOGFILE < \
2864 2701 $elf_ddir/interface.cmp \
2865 2702 >> $mail_msg_file
2866 2703 fi
2867 2704 else
2868 2705 echo "baseline not available. comparison" \
2869 2706 "skipped" | \
2870 2707 tee -a $LOGFILE >> $mail_msg_file
2871 2708 fi
2872 2709
2873 2710 fi
2874 2711 fi
2875 2712
2876 2713 if [[ $r_FLAG = y ]]; then
2877 2714 echo "\n==== Check ELF runtime attributes ====\n" | \
2878 2715 tee -a $LOGFILE >> $mail_msg_file
2879 2716
2880 2717 # If we're doing a DEBUG build the proto area will be left
2881 2718 # with debuggable objects, thus don't assert -s.
2882 2719 if [[ $D_FLAG = y ]]; then
2883 2720 rtime_sflag=""
2884 2721 else
2885 2722 rtime_sflag="-s"
2886 2723 fi
2887 2724 check_rtime -i -m -v $rtime_sflag -o -w $elf_ddir \
2888 2725 -D object_list -f object_list -E runtime.err \
2889 2726 -I runtime.attr.raw
2890 2727
2891 2728 # check_rtime -I output needs to be sorted in order to
2892 2729 # compare it to that from previous builds.
2893 2730 sort $elf_ddir/runtime.attr.raw > $elf_ddir/runtime.attr
2894 2731 rm $elf_ddir/runtime.attr.raw
2895 2732
2896 2733 # Report errors
2897 2734 if [[ -s $elf_ddir/runtime.err ]]; then
2898 2735 tee -a $LOGFILE < $elf_ddir/runtime.err \
2899 2736 >> $mail_msg_file
2900 2737 fi
2901 2738
2902 2739 # If there is an ELF-data directory from a previous build,
2903 2740 # then diff the attr files. These files contain information
2904 2741 # about dependencies, versioning, and runpaths. There is some
2905 2742 # overlap with the ABI checking done above, but this also
2906 2743 # flushes out non-ABI interface differences along with the
2907 2744 # other information.
2908 2745 echo "\n==== Diff ELF runtime attributes" \
2909 2746 "(since last build) ====\n" | \
2910 2747 tee -a $LOGFILE >> $mail_msg_file >> $mail_msg_file
2911 2748
2912 2749 if [[ -f $elf_ddir.ref/runtime.attr ]]; then
2913 2750 diff $elf_ddir.ref/runtime.attr \
2914 2751 $elf_ddir/runtime.attr \
2915 2752 >> $mail_msg_file
2916 2753 fi
2917 2754 fi
2918 2755
2919 2756 # If -u set, copy contents of ELF-data.$MACH to the parent workspace.
2920 2757 if [[ "$u_FLAG" = "y" ]]; then
2921 2758 p_elf_ddir=$PARENT_WS/usr/src/ELF-data.$MACH
2922 2759
2923 2760 # If parent lacks the ELF-data.$MACH directory, create it
2924 2761 if [[ ! -d $p_elf_ddir ]]; then
2925 2762 staffer mkdir -p $p_elf_ddir
2926 2763 fi
2927 2764
2928 2765 # These files are used asynchronously by other builds for ABI
2929 2766 # verification, as above for the -A option. As such, we require
2930 2767 # the file replacement to be atomic. Copy the data to a temp
2931 2768 # file in the same filesystem and then rename into place.
2932 2769 (
2933 2770 cd $elf_ddir
2934 2771 for elf_dfile in *; do
2935 2772 staffer cp $elf_dfile \
2936 2773 ${p_elf_ddir}/${elf_dfile}.new
2937 2774 staffer mv -f ${p_elf_ddir}/${elf_dfile}.new \
2938 2775 ${p_elf_ddir}/${elf_dfile}
2939 2776 done
2940 2777 )
2941 2778 fi
2942 2779 fi
2943 2780
2944 2781 # DEBUG lint of kernel begins
2945 2782
2946 2783 if [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then
2947 2784 if [ "$LINTDIRS" = "" ]; then
2948 2785 # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y"
2949 2786 LINTDIRS="$SRC y"
2950 2787 fi
2951 2788 set $LINTDIRS
2952 2789 while [ $# -gt 0 ]; do
2953 2790 dolint $1 $2; shift; shift
2954 2791 done
2955 2792 else
2956 2793 echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE
2957 2794 fi
2958 2795
2959 2796 # "make check" begins
2960 2797
2961 2798 if [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then
2962 2799 # remove old check.out
2963 2800 rm -f $SRC/check.out
2964 2801
2965 2802 rm -f $SRC/check-${MACH}.out
2966 2803 cd $SRC
2967 2804 $MAKE -ek check ROOT="$checkroot" 2>&1 | tee -a $SRC/check-${MACH}.out \
2968 2805 >> $LOGFILE
2969 2806 echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file
2970 2807
2971 2808 grep ":" $SRC/check-${MACH}.out |
2972 2809 egrep -v "Ignoring unknown host" | \
2973 2810 sort | uniq >> $mail_msg_file
2974 2811 else
2975 2812 echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE
2976 2813 fi
2977 2814
2978 2815 echo "\n==== Find core files ====\n" | \
2979 2816 tee -a $LOGFILE >> $mail_msg_file
2980 2817
2981 2818 find $abssrcdirs -name core -a -type f -exec file {} \; | \
2982 2819 tee -a $LOGFILE >> $mail_msg_file
2983 2820
2984 2821 if [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then
2985 2822 echo "\n==== Diff unreferenced files (since last build) ====\n" \
2986 2823 | tee -a $LOGFILE >>$mail_msg_file
2987 2824 rm -f $SRC/unref-${MACH}.ref
2988 2825 if [ -f $SRC/unref-${MACH}.out ]; then
2989 2826 mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref
2990 2827 fi
2991 2828
2992 2829 findunref -S $SCM_TYPE -t $SRC/.build.tstamp -s usr $CODEMGR_WS \
2993 2830 ${TOOLS}/findunref/exception_list 2>> $mail_msg_file | \
2994 2831 sort > $SRC/unref-${MACH}.out
2995 2832
2996 2833 if [ ! -f $SRC/unref-${MACH}.ref ]; then
2997 2834 cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref
2998 2835 fi
2999 2836
3000 2837 diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file
3001 2838 fi
3002 2839
3003 2840 #
3004 2841 # Generate the OpenSolaris deliverables if requested. Some of these
3005 2842 # steps need to come after findunref and are commented below.
3006 2843 #
3007 2844
3008 2845 # If we are doing an OpenSolaris _source_ build (-S O) then we do
3009 2846 # not have usr/closed available to us to generate closedbins from,
3010 2847 # so skip this part.
3011 2848 if [ "$SO_FLAG" = n -a "$O_FLAG" = y -a "$build_ok" = y ]; then
3012 2849 echo "\n==== Generating OpenSolaris tarballs ====\n" | \
3013 2850 tee -a $mail_msg_file >> $LOGFILE
3014 2851
3015 2852 cd $CODEMGR_WS
3016 2853
3017 2854 #
3018 2855 # This step grovels through the package manifests, so it
3019 2856 # must come after findunref.
3020 2857 #
3021 2858 # We assume no DEBUG vs non-DEBUG package content variation
3022 2859 # here; if that changes, then the "make all" in $SRC/pkg will
3023 2860 # need to be moved into the conditionals and repeated for each
3024 2861 # different build.
3025 2862 #
3026 2863 echo "Generating closed binaries tarball(s)..." >> $LOGFILE
3027 2864 closed_basename=on-closed-bins
3028 2865 if [ "$D_FLAG" = y ]; then
3029 2866 bindrop "$closed_basename" >>"$LOGFILE" 2>&1
3030 2867 if (( $? != 0 )) ; then
3031 2868 echo "Couldn't create DEBUG closed binaries." |
3032 2869 tee -a $mail_msg_file >> $LOGFILE
3033 2870 build_ok=n
3034 2871 fi
3035 2872 fi
3036 2873 if [ "$F_FLAG" = n ]; then
3037 2874 bindrop -n "$closed_basename-nd" >>"$LOGFILE" 2>&1
3038 2875 if (( $? != 0 )) ; then
3039 2876 echo "Couldn't create non-DEBUG closed binaries." |
3040 2877 tee -a $mail_msg_file >> $LOGFILE
3041 2878 build_ok=n
3042 2879 fi
3043 2880 fi
3044 2881
3045 2882 echo "Generating README.opensolaris..." >> $LOGFILE
3046 2883 cat $SRC/tools/opensolaris/README.opensolaris.tmpl | \
3047 2884 mkreadme_osol $CODEMGR_WS/README.opensolaris >> $LOGFILE 2>&1
3048 2885 if (( $? != 0 )) ; then
3049 2886 echo "Couldn't create README.opensolaris." |
3050 2887 tee -a $mail_msg_file >> $LOGFILE
3051 2888 build_ok=n
3052 2889 fi
3053 2890 fi
3054 2891
3055 2892 # Verify that the usual lists of files, such as exception lists,
3056 2893 # contain only valid references to files. If the build has failed,
3057 2894 # then don't check the proto area.
3058 2895 CHECK_PATHS=${CHECK_PATHS:-y}
3059 2896 if [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then
3060 2897 echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \
3061 2898 >>$mail_msg_file
3062 2899 arg=-b
3063 2900 [ "$build_ok" = y ] && arg=
3064 2901 checkpaths $arg $checkroot 2>&1 | tee -a $LOGFILE >>$mail_msg_file
3065 2902 fi
3066 2903
3067 2904 if [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then
3068 2905 echo "\n==== Impact on file permissions ====\n" \
3069 2906 >> $mail_msg_file
3070 2907
3071 2908 abspkgdefs=
3072 2909 abspkg=
3073 2910 for d in $abssrcdirs; do
3074 2911 if [ -d "$d/pkgdefs" ]; then
3075 2912 abspkgdefs="$abspkgdefs $d"
3076 2913 fi
3077 2914 if [ -d "$d/pkg" ]; then
3078 2915 abspkg="$abspkg $d"
3079 2916 fi
3080 2917 done
3081 2918
3082 2919 if [ -n "$abspkgdefs" ]; then
3083 2920 pmodes -qvdP \
3084 2921 `find $abspkgdefs -name pkginfo.tmpl -print -o \
3085 2922 -name .del\* -prune | sed -e 's:/pkginfo.tmpl$::' | \
3086 2923 sort -u` >> $mail_msg_file
3087 2924 fi
3088 2925
3089 2926 if [ -n "$abspkg" ]; then
3090 2927 for d in "$abspkg"; do
3091 2928 ( cd $d/pkg ; $MAKE -e pmodes ) >> $mail_msg_file
3092 2929 done
3093 2930 fi
3094 2931 fi
3095 2932
3096 2933 if [ "$w_FLAG" = "y" -a "$build_ok" = "y" ]; then
3097 2934 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
3098 2935 do_wsdiff DEBUG $ROOT.prev $ROOT
3099 2936 fi
3100 2937
3101 2938 if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n ]]; then
3102 2939 do_wsdiff non-DEBUG $ROOT-nd.prev $ROOT-nd
3103 2940 fi
3104 2941 fi
3105 2942
3106 2943 END_DATE=`date`
3107 2944 echo "==== Nightly $maketype build completed: $END_DATE ====" | \
3108 2945 tee -a $LOGFILE >> $build_time_file
3109 2946
3110 2947 typeset -i10 hours
3111 2948 typeset -Z2 minutes
3112 2949 typeset -Z2 seconds
3113 2950
3114 2951 elapsed_time=$SECONDS
3115 2952 ((hours = elapsed_time / 3600 ))
3116 2953 ((minutes = elapsed_time / 60 % 60))
3117 2954 ((seconds = elapsed_time % 60))
3118 2955
3119 2956 echo "\n==== Total build time ====" | \
3120 2957 tee -a $LOGFILE >> $build_time_file
3121 2958 echo "\nreal ${hours}:${minutes}:${seconds}" | \
3122 2959 tee -a $LOGFILE >> $build_time_file
3123 2960
3124 2961 if [ "$u_FLAG" = "y" -a "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then
3125 2962 staffer cp ${SRC}/unref-${MACH}.out $PARENT_WS/usr/src/
3126 2963
3127 2964 #
3128 2965 # Produce a master list of unreferenced files -- ideally, we'd
3129 2966 # generate the master just once after all of the nightlies
3130 2967 # have finished, but there's no simple way to know when that
3131 2968 # will be. Instead, we assume that we're the last nightly to
3132 2969 # finish and merge all of the unref-${MACH}.out files in
3133 2970 # $PARENT_WS/usr/src/. If we are in fact the final ${MACH} to
3134 2971 # finish, then this file will be the authoritative master
3135 2972 # list. Otherwise, another ${MACH}'s nightly will eventually
3136 2973 # overwrite ours with its own master, but in the meantime our
3137 2974 # temporary "master" will be no worse than any older master
3138 2975 # which was already on the parent.
3139 2976 #
3140 2977
3141 2978 set -- $PARENT_WS/usr/src/unref-*.out
3142 2979 cp "$1" ${TMPDIR}/unref.merge
3143 2980 shift
3144 2981
3145 2982 for unreffile; do
3146 2983 comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$
3147 2984 mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge
3148 2985 done
3149 2986
3150 2987 staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out
3151 2988 fi
3152 2989
3153 2990 #
3154 2991 # All done save for the sweeping up.
3155 2992 # (whichever exit we hit here will trigger the "cleanup" trap which
3156 2993 # optionally sends mail on completion).
3157 2994 #
3158 2995 if [ "$build_ok" = "y" ]; then
3159 2996 exit 0
3160 2997 fi
3161 2998 exit 1
↓ open down ↓ |
541 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX