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