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