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, Version 1.0 only 7# (the "License"). You may not use this file except in compliance 8# with the License. 9# 10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11# or http://www.opensolaris.org/os/licensing. 12# See the License for the specific language governing permissions 13# and limitations under the License. 14# 15# When distributing Covered Code, include this CDDL HEADER in each 16# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17# If applicable, add the following below this CDDL HEADER, with the 18# fields enclosed by brackets "[]" replaced with your own identifying 19# information: Portions Copyright [yyyy] [name of copyright owner] 20# 21# CDDL HEADER END 22# 23# 24# Copyright 2005 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27# ident "%Z%%M% %I% %E% SMI" 28# 29# Based on the nightly script from the integration folks, 30# Mostly modified and owned by mike_s. 31# Changes also by kjc, dmk. 32# 33# BRINGOVER_WS may be specified in the env file. 34# The default is the old behavior of CLONE_WS 35# 36# -i on the command line, means fast options, so when it's on the 37# command line (only), lint, check, GPROF and TRACE builds are skipped 38# no matter what the setting of their individual flags are in NIGHTLY_OPTIONS. 39# 40# LINTDIRS can be set in the env file, format is a list of: 41# 42# /dirname-to-run-lint-on flag 43# 44# Where flag is: y - enable lint noise diff output 45# n - disable lint noise diff output 46# 47# For example: LINTDIRS="$SRC/uts n $SRC/stand y $SRC/psm y" 48# 49# -A flag in NIGHTLY_OPTIONS checks ABI diffs in .so files 50# This option requires a couple of scripts. 51# 52# OPTHOME and TEAMWARE may be set in the environment to override /opt 53# and /opt/teamware defaults. 54# 55 56# 57# The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout 58# under certain circumstances, which can really screw things up; unset it. 59# 60unset CDPATH 61 62# function to do a DEBUG and non-DEBUG build. Needed because we might 63# need to do another for the source build, and since we only deliver DEBUG or 64# non-DEBUG packages. 65 66normal_build() { 67 68 # timestamp the start of a nightly build; the findunref tool uses it. 69 touch $SRC/.build.tstamp 70 71 # non-DEBUG build begins 72 73 if [ "$F_FLAG" = "n" ]; then 74 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 75 export RELEASE_BUILD ; RELEASE_BUILD= 76 unset EXTRA_OPTIONS 77 unset EXTRA_CFLAGS 78 79 build non-DEBUG -nd 80 81 if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a "$p_FLAG" = "y" ]; then 82 copy_ihv_pkgs non-DEBUG -nd 83 fi 84 else 85 echo "\n==== No non-DEBUG build ====\n" >> $LOGFILE 86 fi 87 88 # non-DEBUG build ends 89 90 # DEBUG build begins 91 92 if [ "$D_FLAG" = "y" ]; then 93 94 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 95 unset RELEASE_BUILD 96 unset EXTRA_OPTIONS 97 unset EXTRA_CFLAGS 98 99 build DEBUG "" 100 101 if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a "$p_FLAG" = "y" ]; then 102 copy_ihv_pkgs DEBUG "" 103 fi 104 105 else 106 echo "\n==== No DEBUG build ====\n" >> $LOGFILE 107 fi 108 109 # DEBUG build ends 110} 111 112filelist() { 113 if [ $# -ne 2 ]; then 114 echo "usage: filelist DESTDIR PATTERN" 115 exit 1; 116 fi 117 DEST=$1 118 PATTERN=$2 119 cd ${DEST} 120 121 OBJFILES=${ORIG_SRC}/xmod/obj_files 122 if [ ! -f ${OBJFILES} ]; then 123 return; 124 fi 125 for i in `grep -v '^#' ${ORIG_SRC}/xmod/obj_files | \ 126 grep ${PATTERN} | cut -d: -f2 | tr -d ' \t'` 127 do 128 # wildcard expansion 129 for j in $i 130 do 131 if [ -f "$j" ]; then 132 echo $j 133 fi 134 if [ -d "$j" ]; then 135 echo $j 136 fi 137 done 138 done | sort | uniq 139} 140 141# function to save off binaries after a full build for later 142# restoration 143save_binaries() { 144 # save off list of binaries 145 echo "\n==== Saving binaries from build at `date` ====\n" | \ 146 tee -a $mail_msg_file >> $LOGFILE 147 rm -f ${BINARCHIVE} 148 cd ${CODEMGR_WS} 149 filelist ${CODEMGR_WS} '^preserve:' >> $LOGFILE 150 filelist ${CODEMGR_WS} '^preserve:' | \ 151 cpio -ocB 2>/dev/null | compress \ 152 > ${BINARCHIVE} 153} 154 155# delete files 156hybridize_files() { 157 if [ $# -ne 2 ]; then 158 echo "usage: hybridize_files DESTDIR MAKE_TARGET" 159 exit 1; 160 fi 161 162 DEST=$1 163 MAKETARG=$2 164 165 echo "\n==== Hybridizing files at `date` ====\n" | \ 166 tee -a $mail_msg_file >> $LOGFILE 167 for i in `filelist ${DEST} '^delete:'` 168 do 169 echo "removing ${i}." | tee -a $mail_msg_file >> $LOGFILE 170 rm -rf "${i}" 171 done 172 for i in `filelist ${DEST} '^hybridize:' ` 173 do 174 echo "hybridizing ${i}." | tee -a $mail_msg_file >> $LOGFILE 175 rm -f ${i}+ 176 sed -e "/^# HYBRID DELETE START/,/^# HYBRID DELETE END/d" \ 177 < ${i} > ${i}+ 178 mv ${i}+ ${i} 179 done 180} 181 182# restore binaries into the proper source tree. 183restore_binaries() { 184 if [ $# -ne 2 ]; then 185 echo "usage: restore_binaries DESTDIR MAKE_TARGET" 186 exit 1; 187 fi 188 189 DEST=$1 190 MAKETARG=$2 191 192 echo "\n==== Restoring binaries to ${MAKETARG} at `date` ====\n" | \ 193 tee -a $mail_msg_file >> $LOGFILE 194 cd ${DEST} 195 zcat ${BINARCHIVE} | \ 196 cpio -idmucvB 2>/dev/null | tee -a $mail_msg_file >> ${LOGFILE} 197} 198 199# rename files we save binaries of 200rename_files() { 201 if [ $# -ne 2 ]; then 202 echo "usage: rename_files DESTDIR MAKE_TARGET" 203 exit 1; 204 fi 205 206 DEST=$1 207 MAKETARG=$2 208 echo "\n==== Renaming source files in ${MAKETARG} at `date` ====\n" | \ 209 tee -a $mail_msg_file >> $LOGFILE 210 for i in `filelist ${DEST} '^rename:'` 211 do 212 echo ${i} | tee -a $mail_msg_file >> ${LOGFILE} 213 rm -f ${i}.export 214 mv ${i} ${i}.export 215 done 216} 217 218# function to create the export/crypt source tree 219# usage: clone_source CODEMGR_WS DESTDIR MAKE_TARGET 220 221clone_source() { 222 223 if [ $# -ne 3 ]; then 224 echo "usage: clone_source CODEMGR_WS DESTDIR MAKE_TARGET" 225 exit 1; 226 fi 227 WS=$1 228 DEST=$2 229 MAKETARG=$3 230 231 echo "\n==== Creating ${DEST} source from ${WS} (${MAKETARG}) ====\n" | \ 232 tee -a $mail_msg_file >> $LOGFILE 233 234 echo "cleaning out ${DEST}." >> $LOGFILE 235 rm -rf "${DEST}" >> $LOGFILE 2>&1 236 237 mkdir -p ${DEST} 238 cd ${WS} 239 240 echo "creating ${DEST}." >> $LOGFILE 241 find usr/src -name 's\.*' -a -type f -print | \ 242 sed -e 's,SCCS\/s.,,' | \ 243 grep -v '/\.del-*' | \ 244 cpio -pd ${DEST} >>$LOGFILE 2>&1 245 246 SRC=${DEST}/usr/src 247 248 cd $SRC 249 rm -f ${MAKETARG}.out 250 echo "making ${MAKETARG} in ${SRC}." >> $LOGFILE 251 /bin/time $MAKE -e ${MAKETARG} 2>&1 | \ 252 tee -a $SRC/${MAKETARG}.out >> $LOGFILE 253 echo "\n==== ${MAKETARG} build errors ====\n" >> $mail_msg_file 254 egrep ":" $SRC/${MAKETARG}.out | \ 255 egrep -e "(^${MAKE}:|[ ]error[: \n])" | \ 256 egrep -v "Ignoring unknown host" | \ 257 egrep -v "warning" >> $mail_msg_file 258 259 echo "clearing state files." >> $LOGFILE 260 find . -name '.make*' -exec rm -f {} \; 261 262 cd ${DEST} 263 if [ "${MAKETARG}" = "CRYPT_SRC" ]; then 264 rm -f ${CODEMGR_WS}/crypt_files.cpio.Z 265 echo "\n==== xmod/cry_files that don't exist ====\n" | \ 266 tee -a $mail_msg_file >> $LOGFILE 267 CRYPT_FILES=${WS}/usr/src/xmod/cry_files 268 for i in `cat ${CRYPT_FILES}` 269 do 270 # make sure the files exist 271 if [ -f "$i" ]; then 272 continue 273 fi 274 if [ -d "$i" ]; then 275 continue 276 fi 277 echo "$i" | tee -a $mail_msg_file >> $LOGFILE 278 done 279 find `cat ${CRYPT_FILES}` -print 2>/dev/null | \ 280 cpio -ocB 2>/dev/null | \ 281 compress > ${CODEMGR_WS}/crypt_files.cpio.Z 282 fi 283 284 if [ "${MAKETARG}" = "EXPORT_SRC" ]; then 285 # rename first, since we might restore a file 286 # of the same name (mapfiles) 287 rename_files ${EXPORT_SRC} EXPORT_SRC 288 if [ "$SH_FLAG" = "y" ]; then 289 hybridize_files ${EXPORT_SRC} EXPORT_SRC 290 fi 291 fi 292 293 # save the cleartext 294 echo "\n==== Creating ${MAKETARG}.cpio.Z ====\n" | \ 295 tee -a $mail_msg_file >> $LOGFILE 296 cd ${DEST} 297 rm -f ${MAKETARG}.cpio.Z 298 find usr/src -depth -print | \ 299 grep -v usr/src/${MAKETARG}.out | \ 300 cpio -ocB 2>/dev/null | \ 301 compress > ${CODEMGR_WS}/${MAKETARG}.cpio.Z 302 if [ "${MAKETARG}" = "EXPORT_SRC" ]; then 303 restore_binaries ${EXPORT_SRC} EXPORT_SRC 304 fi 305 306 if [ "${MAKETARG}" = "CRYPT_SRC" ]; then 307 restore_binaries ${CRYPT_SRC} CRYPT_SRC 308 fi 309 310} 311 312# function to do the build. 313# usage: build LABEL SUFFIX 314 315build() { 316 317 if [ $# -ne 2 ]; then 318 echo "usage: build LABEL SUFFIX" 319 exit 1; 320 fi 321 322 LABEL=$1 323 SUFFIX=$2 324 INSTALLOG=install${SUFFIX}-${MACH} 325 NOISE=noise${SUFFIX}-${MACH} 326 CPIODIR=${CPIODIR_ORIG}${SUFFIX} 327 PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX} 328 if [ "$SPARC_RM_PKGARCHIVE_ORIG" ]; then 329 SPARC_RM_PKGARCHIVE=${SPARC_RM_PKGARCHIVE_ORIG}${SUFFIX} 330 fi 331 332 #remove old logs 333 OLDINSTALLOG=install${SUFFIX} 334 OLDNOISE=noise${SUFFIX} 335 rm -f $SRC/${OLDINSTALLOG}.out 336 rm -f $SRC/${OLDNOISE}.ref 337 if [ -f $SRC/${OLDNOISE}.out ]; then 338 mv $SRC/${OLDNOISE}.out $SRC/${NOISE}.ref 339 fi 340 341 this_build_ok=y 342 # 343 # Build OS-Networking source 344 # 345 echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \ 346 >> $LOGFILE 347 348 rm -f $SRC/${INSTALLOG}.out 349 cd $SRC 350 /bin/time $MAKE -e install 2>&1 | \ 351 tee -a $SRC/${INSTALLOG}.out >> $LOGFILE 352 echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file 353 egrep ":" $SRC/${INSTALLOG}.out | 354 egrep -e "(^${MAKE}:|[ ]error[: \n])" | \ 355 egrep -v "Ignoring unknown host" | \ 356 egrep -v "cc .* -o error " | \ 357 egrep -v "warning" >> $mail_msg_file 358 if [ "$?" = "0" ]; then 359 build_ok=n 360 this_build_ok=n 361 fi 362 grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \ 363 >> $mail_msg_file 364 if [ "$?" = "0" ]; then 365 build_ok=n 366 this_build_ok=n 367 fi 368 369 if [ "$W_FLAG" = "n" ]; then 370 echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file 371 # should be none, but there are a few that are pmake 372 # related, and a couple of silly ones. 373 egrep -i warning: $SRC/${INSTALLOG}.out \ 374 | egrep -v '^tic:' \ 375 | egrep -v '^mcs:' \ 376 | egrep -v '^LD_LIBRARY_PATH=' \ 377 | egrep -v 'multiple use of -K option' \ 378 | egrep -v 'option -I appears more than once' \ 379 | egrep -v 'ar: creating' \ 380 | egrep -v 'ar: writing' \ 381 | egrep -v 'conflicts:' \ 382 | egrep -v ':saved created' \ 383 | egrep -v '^stty.*c:' \ 384 | egrep -v '^mfgname.c:' \ 385 | egrep -v '^uname-i.c:' \ 386 | egrep -v '^volumes.c:' \ 387 | egrep -v '^lint library construction:' \ 388 | egrep -v 'tsort: INFORM:' \ 389 | egrep -v 'stripalign:' \ 390 | egrep -v 'chars, width' \ 391 | egrep -v 'option -zdefs/nodefs appears more than' \ 392 | egrep -v "symbol \`timezone' has differing types:" \ 393 | egrep -v "parameter <PSTAMP> set to" \ 394 | egrep -v "^Manifying" \ 395 | egrep -v "Ignoring unknown host" \ 396 | egrep -v "redefining segment flags attribute for" \ 397 >> $mail_msg_file 398 fi 399 400 echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \ 401 >> $LOGFILE 402 403 echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file 404 tail -3 $SRC/${INSTALLOG}.out >>$mail_msg_file 405 406 if [ "$i_FLAG" = "n" -a "$W_FLAG" = "n" ]; then 407 rm -f $SRC/${NOISE}.ref 408 if [ -f $SRC/${NOISE}.out ]; then 409 mv $SRC/${NOISE}.out $SRC/${NOISE}.ref 410 fi 411 grep : $SRC/${INSTALLOG}.out \ 412 | egrep -v '^/' \ 413 | egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \ 414 | egrep -v '^tic:' \ 415 | egrep -v '^mcs' \ 416 | egrep -v '^LD_LIBRARY_PATH=' \ 417 | egrep -v 'multiple use of -K option' \ 418 | egrep -v 'option -I appears more than once' \ 419 | egrep -v 'ar: creating' \ 420 | egrep -v 'ar: writing' \ 421 | egrep -v 'conflicts:' \ 422 | egrep -v ':saved created' \ 423 | egrep -v '^stty.*c:' \ 424 | egrep -v '^mfgname.c:' \ 425 | egrep -v '^uname-i.c:' \ 426 | egrep -v '^volumes.c:' \ 427 | egrep -v '^lint library construction:' \ 428 | egrep -v 'tsort: INFORM:' \ 429 | egrep -v 'stripalign:' \ 430 | egrep -v 'chars, width' \ 431 | egrep -v 'option -zdefs/nodefs appears more than' \ 432 | egrep -v "symbol \`timezone' has differing types:" \ 433 | egrep -v 'PSTAMP' \ 434 | egrep -v '|%WHOANDWHERE%|' \ 435 | egrep -v '^Manifying' \ 436 | egrep -v 'Ignoring unknown host' \ 437 | egrep -v 'Processing method:' \ 438 | egrep -v '^Writing' \ 439 | egrep -v 'spellin1:' \ 440 | egrep -v '^adding:' \ 441 | egrep -v "^echo 'msgid" \ 442 | egrep -v '^echo ' \ 443 | egrep -v '\.c:$' \ 444 | egrep -v '^Adding file:' \ 445 | egrep -v 'CLASSPATH=' \ 446 | egrep -v '\/var\/mail\/:saved' \ 447 | egrep -v -- '-DUTS_VERSION=' \ 448 | egrep -v '^Running Mkbootstrap' \ 449 | egrep -v '^Applet length read:' \ 450 | egrep -v 'bytes written:' \ 451 | egrep -v '^File:SolarisAuthApplet.bin' \ 452 | egrep -v -i 'jibversion' \ 453 | egrep -v '^Output size:' \ 454 | egrep -v '^Solo size statistics:' \ 455 | egrep -v '^Using ROM API Version' \ 456 | egrep -v '^Zero Signature length:' \ 457 | egrep -v '^Note \(probably harmless\):' \ 458 | egrep -v '::' \ 459 | egrep -v -- '-xcache' \ 460 | egrep -v '^\+' \ 461 | sort | uniq >$SRC/${NOISE}.out 462 if [ ! -f $SRC/${NOISE}.ref ]; then 463 cp $SRC/${NOISE}.out $SRC/${NOISE}.ref 464 fi 465 echo "\n==== Build noise differences ($LABEL) ====\n" \ 466 >>$mail_msg_file 467 diff $SRC/${NOISE}.ref $SRC/${NOISE}.out >>$mail_msg_file 468 fi 469 470 # 471 # Create cpio archives for preintegration testing (PIT) 472 # 473 if [ "$a_FLAG" = "y" -a "$this_build_ok" = "y" ]; then 474 echo "\n==== Creating $LABEL cpio archives at `date` ====\n" \ 475 >> $LOGFILE 476 makebfu_file="${TMPDIR}/makebfu" 477 rm -f ${makebfu_file} 478 makebfu 2>&1 | \ 479 tee -a ${makebfu_file} >> $LOGFILE 480 echo "\n==== cpio archives build errors ($LABEL) ====\n" \ 481 >> $mail_msg_file 482 grep -v "^Creating .* archive:" ${makebfu_file} | \ 483 grep -v "^Making" | \ 484 grep -v "^$" | \ 485 sort | uniq >> $mail_msg_file 486 rm -f ${makebfu_file} 487 # hack for test folks 488 if [ -z "`echo $PARENT_WS|egrep '^\/ws\/'`" ]; then 489 X=/net/`uname -n`${CPIODIR} 490 else 491 X=${CPIODIR} 492 fi 493 echo "Archive_directory: ${X}" >${TMPDIR}/f 494 cp ${TMPDIR}/f ${CPIODIR}/../../.${MACH}_wgtrun 495 rm -f ${TMPDIR}/f 496 497 else 498 echo "\n==== Not creating $LABEL cpio archives ====\n" \ 499 >> $LOGFILE 500 fi 501 502 # 503 # Building Packages 504 # 505 if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then 506 echo "\n==== Creating $LABEL packages at `date` ====\n" \ 507 >> $LOGFILE 508 rm -f $SRC/pkgdefs/${INSTALLOG}.out 509 echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE 510 rm -rf $PKGARCHIVE 511 mkdir -p $PKGARCHIVE 512 513 # 514 # Optional build of sparc realmode on i386 515 # 516 if [ "$MACH" = "i386" ] && [ "${SPARC_RM_PKGARCHIVE}" ]; then 517 echo "Clearing out ${SPARC_RM_PKGARCHIVE} ..." \ 518 >> $LOGFILE 519 rm -rf ${SPARC_RM_PKGARCHIVE} 520 mkdir -p ${SPARC_RM_PKGARCHIVE} 521 fi 522 523 cd $SRC/pkgdefs 524 $MAKE -e install 2>&1 | \ 525 tee -a $SRC/pkgdefs/${INSTALLOG}.out >> $LOGFILE 526 echo "\n==== Package build errors ($LABEL) ====\n" \ 527 >> $mail_msg_file 528 egrep "${MAKE}|ERROR|WARNING" $SRC/pkgdefs/${INSTALLOG}.out | \ 529 grep ':' | \ 530 grep -v PSTAMP | \ 531 egrep -v "Ignoring unknown host" \ 532 >> $mail_msg_file 533 else 534 echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE 535 fi 536} 537 538dolint() { 539 540 # 541 # Arg. 2 is a flag to turn on/off the lint diff output 542 # 543 dl_usage="Usage: dolint /dir y|n" 544 545 if [ $# -ne 2 ]; then 546 echo $dl_usage 547 exit 1 548 fi 549 550 if [ ! -d "$1" ]; then 551 echo $dl_usage 552 exit 1 553 fi 554 555 if [ "$2" != "y" -a "$2" != "n" ]; then 556 echo $dl_usage 557 exit 1 558 fi 559 560 lintdir=$1 561 dodiff=$2 562 base=`basename $lintdir` 563 LINTOUT=$lintdir/lint-${MACH}.out 564 LINTNOISE=$lintdir/lint-noise-${MACH} 565 566 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 567 unset RELEASE_BUILD 568 unset EXTRA_OPTIONS 569 unset EXTRA_CFLAGS 570 571 # 572 # '$MAKE lint' in $lintdir 573 # 574 echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE 575 576 # remove old lint.out 577 rm -f $lintdir/lint.out $lintdir/lint-noise.out 578 if [ -f $lintdir/lint-noise.ref ]; then 579 mv $lintdir/lint-noise.ref ${LINTNOISE}.ref 580 fi 581 582 rm -f $LINTOUT 583 cd $lintdir 584 # 585 # Remove all .ln files to ensure a full reference file 586 # 587 rm -f Nothing_to_remove \ 588 `find . -name SCCS -prune -o -type f -name '*.ln' -print ` 589 590 /bin/time $MAKE -ek lint 2>&1 | \ 591 tee -a $LINTOUT >> $LOGFILE 592 echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file 593 grep "$MAKE:" $LINTOUT | 594 egrep -v "Ignoring unknown host" \ 595 >> $mail_msg_file 596 597 echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE 598 599 echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \ 600 >>$mail_msg_file 601 tail -3 $LINTOUT >>$mail_msg_file 602 603 rm -f ${LINTNOISE}.ref 604 if [ -f ${LINTNOISE}.out ]; then 605 mv ${LINTNOISE}.out ${LINTNOISE}.ref 606 fi 607 #grep : $LINTOUT | 608 #egrep -v '^(name|function|value|argument|real|user|sys)' | 609 #egrep -v 'warning: (name|function|value|possibly)' | 610 #egrep -v 'warning: argument used' | 611 grep : $LINTOUT | \ 612 egrep -v '^(real|user|sys)' | 613 egrep -v '(library construction)' | \ 614 egrep -v ': global crosschecks' | \ 615 egrep -v 'Ignoring unknown host' | \ 616 egrep -v '\.c:$' | \ 617 sort | uniq > ${LINTNOISE}.out 618 if [ ! -f ${LINTNOISE}.ref ]; then 619 cp ${LINTNOISE}.out ${LINTNOISE}.ref 620 fi 621 if [ "$dodiff" != "n" ]; then 622 echo "\n==== lint warnings $base ====\n" \ 623 >>$mail_msg_file 624 # should be none, though there are a few that were filtered out 625 # above 626 egrep -i '(warning|lint):' ${LINTNOISE}.out \ 627 | sort | uniq >> $mail_msg_file 628 echo "\n==== lint noise differences $base ====\n" \ 629 >> $mail_msg_file 630 diff ${LINTNOISE}.ref ${LINTNOISE}.out \ 631 >> $mail_msg_file 632 fi 633} 634 635# Install proto area from IHV build 636 637copy_ihv_proto() { 638 639 echo "\n==== Installing $IA32_IHV_ROOT ====\n" \ 640 >> $LOGFILE 641 if [ -d "$IA32_IHV_ROOT" ]; then 642 if [ ! -d "$ROOT" ]; then 643 echo "mkdir -p $ROOT" >> $LOGFILE 644 mkdir -p $ROOT 645 fi 646 echo "cd $IA32_IHV_ROOT\n" >> $LOGFILE 647 cd $IA32_IHV_ROOT 648 tar -cf - . | (cd $ROOT; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 649 else 650 echo "$IA32_IHV_ROOT: not found" >> $LOGFILE 651 fi 652} 653 654# Install IHV packages in PKGARCHIVE 655 656copy_ihv_pkgs() { 657 658 if [ $# -ne 2 ]; then 659 echo "usage: copy_ihv_pkgs LABEL SUFFIX" 660 exit 1; 661 fi 662 663 LABEL=$1 664 SUFFIX=$2 665 # always use non-DEBUG IHV packages 666 IA32_IHV_PKGS=${IA32_IHV_PKGS_ORIG}-nd 667 PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX} 668 669 echo "\n==== Installing IHV packages from $IA32_IHV_PKGS ($LABEL) ====\n" \ 670 >> $LOGFILE 671 if [ -d "$IA32_IHV_PKGS" ]; then 672 cd $IA32_IHV_PKGS 673 tar -cf - * | \ 674 (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 675 else 676 echo "$IA32_IHV_PKGS: not found" >> $LOGFILE 677 fi 678 679 echo "\n==== Installing IHV packages from $IA32_IHV_BINARY_PKGS ($LABEL) ====\n" \ 680 >> $LOGFILE 681 if [ -d "$IA32_IHV_BINARY_PKGS" ]; then 682 cd $IA32_IHV_BINARY_PKGS 683 tar -cf - * | \ 684 (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 685 else 686 echo "$IA32_IHV_BINARY_PKGS: not found" >> $LOGFILE 687 fi 688} 689 690build_tools() { 691 692 if [ $# -ne 1 ]; then 693 echo "usage: build_tools DESTROOT" 694 exit 1; 695 fi 696 697 DESTROOT=$1 698 699 INSTALLOG=install-${MACH} 700 701 echo "\n==== Building tools at `date` ====\n" \ 702 >> $LOGFILE 703 704 rm -f ${TOOLS}/${INSTALLOG}.out 705 cd ${TOOLS} 706 /bin/time $MAKE ROOT=${DESTROOT} -e install 2>&1 | \ 707 tee -a ${TOOLS}/${INSTALLOG}.out >> $LOGFILE 708 709 echo "\n==== Tools build errors ====\n" >> $mail_msg_file 710 711 egrep ":" ${TOOLS}/${INSTALLOG}.out | 712 egrep -e "(${MAKE}:|[ ]error[: \n])" | \ 713 egrep -v "Ignoring unknown host" | \ 714 egrep -v warning >> $mail_msg_file 715 if [ "$?" != "0" ]; then 716 STABS=${DESTROOT}/opt/onbld/bin/${MACH}/stabs 717 export STABS 718 CTFSTABS=${DESTROOT}/opt/onbld/bin/${MACH}/ctfstabs 719 export CTFSTABS 720 GENOFFSETS=${DESTROOT}/opt/onbld/bin/genoffsets 721 export GENOFFSETS 722 723 CTFCONVERT=${DESTROOT}/opt/onbld/bin/${MACH}/ctfconvert 724 export CTFCONVERT 725 CTFMERGE=${DESTROOT}/opt/onbld/bin/${MACH}/ctfmerge 726 export CTFMERGE 727 728 CTFCVTPTBL=${DESTROOT}/opt/onbld/bin/ctfcvtptbl 729 export CTFCVTPTBL 730 CTFFINDMOD=${DESTROOT}/opt/onbld/bin/ctffindmod 731 export CTFFINDMOD 732 733 if [ "$VERIFY_ELFSIGN" = "y" ]; then 734 ELFSIGN=${DESTROOT}/opt/onbld/bin/elfsigncmp 735 else 736 ELFSIGN=${DESTROOT}/opt/onbld/bin/${MACH}/elfsign 737 fi 738 export ELFSIGN 739 740 PATH="${DESTROOT}/opt/onbld/bin/${MACH}:${PATH}" 741 PATH="${DESTROOT}/opt/onbld/bin:${PATH}" 742 export PATH 743 744 echo "\n==== New environment settings. ====\n" >> $LOGFILE 745 echo "STABS=${STABS}" >> $LOGFILE 746 echo "CTFSTABS=${CTFSTABS}" >> $LOGFILE 747 echo "CTFCONVERT=${CTFCONVERT}" >> $LOGFILE 748 echo "CTFMERGE=${CTFMERGE}" >> $LOGFILE 749 echo "CTFCVTPTBL=${CTFCVTPTBL}" >> $LOGFILE 750 echo "CTFFINDMOD=${CTFFINDMOD}" >> $LOGFILE 751 echo "ELFSIGN=${ELFSIGN}" >> $LOGFILE 752 echo "PATH=${PATH}" >> $LOGFILE 753 fi 754} 755 756staffer() { 757 if [ $ISUSER -ne 0 ]; then 758 "$@" 759 else 760 arg="\"$1\"" 761 shift 762 for i 763 do 764 arg="$arg \"$i\"" 765 done 766 eval su $STAFFER -c \'$arg\' 767 fi 768} 769 770 771MACH=`uname -p` 772 773if [ "$OPTHOME" = "" ]; then 774 OPTHOME=/opt 775 export OPTHOME 776fi 777if [ "$TEAMWARE" = "" ]; then 778 TEAMWARE=$OPTHOME/teamware 779 export TEAMWARE 780fi 781 782USAGE='Usage: nightly [-in] [-V VERS ] [ -S E|D|H ] <env_file> 783 784Where: 785 -i Fast incremental options (no clobber, lint, check, gprof, trace) 786 -n Do not do a bringover 787 -V VERS set the build version string to VERS 788 -S Build a variant of the source product 789 E - build exportable source 790 D - build domestic source (exportable + crypt) 791 H - build hybrid source (binaries + deleted source) 792 793 <env_file> file in Bourne shell syntax that sets and exports 794 variables that configure the operation of this script and many of 795 the scripts this one calls. If <env_file> does not exist, 796 it will be looked for in $OPTHOME/onbld/env. 797 798non-DEBUG is the default build type. Build options can be set in the 799NIGHTLY_OPTIONS variable in the <env_file> as follows: 800 801 -A check for ABI differences in .so files 802 -C check for cstyle/hdrchk errors 803 -D do a build with DEBUG on 804 -F do _not_ do a non-DEBUG build 805 -G gate keeper default group of options (-au) 806 -I integration engineer default group of options (-ampu) 807 -M do not run pmodes (safe file permission checker) 808 -N do not run protocmp 809 -P do a build with GPROF on 810 -R default group of options for building a release (-mp) 811 -T do a build with TRACE on 812 -U update proto area in the parent 813 -V VERS set the build version string to VERS 814 -X copy x86 IHV packages 815 -a create cpio archives 816 -d use Distributed Make (default uses Parallel Make) 817 -f find unreferenced files 818 -i do an incremental build (no "make clobber") 819 -l do "make lint" in $LINTDIRS (default: $SRC y) 820 -m send mail to $MAILTO at end of build 821 -n do not do a bringover 822 -o build using root privileges to set OWNER/GROUP (old style) 823 -p create packages 824 -r check ELF runtime attributes in the proto area 825 -t build and use the tools in $SRC/tools 826 -u update proto_list_$MACH and friends in the parent workspace; 827 when used with -f, also build an unrefmaster.out in the parent 828 -z compress cpio archives with gzip 829 -W Do not report warnings (freeware gate ONLY) 830 -S Build a variant of the source product 831 E - build exportable source 832 D - build domestic source (exportable + crypt) 833 H - build hybrid source (binaries + deleted source) 834' 835# 836# -x less public handling of xmod source for the source product 837# 838# A log file will be generated under the name $LOGFILE 839# for partially completed build and log.`date '+%m%d%y'` 840# in the same directory for fully completed builds. 841# 842 843# default values for low-level FLAGS; G I R are group FLAGS 844A_FLAG=n 845a_FLAG=n 846d_FLAG=n 847C_FLAG=n 848F_FLAG=n 849f_FLAG=n 850D_FLAG=n 851P_FLAG=n 852T_FLAG=n 853n_FLAG=n 854o_FLAG=n 855i_FLAG=n; i_CMD_LINE_FLAG=n 856l_FLAG=n 857m_FLAG=n 858p_FLAG=n 859r_FLAG=n 860t_FLAG=n 861u_FLAG=n 862U_FLAG=n 863V_FLAG=n 864M_FLAG=n 865N_FLAG=n 866z_FLAG=n 867W_FLAG=n 868SE_FLAG=n 869SD_FLAG=n 870SH_FLAG=n 871X_FLAG=n 872# 873XMOD_OPT= 874# 875build_ok=y 876# 877# examine arguments 878# 879 880OPTIND=1 881while getopts inV:S:t FLAG 882do 883 case $FLAG in 884 i ) i_FLAG=y; i_CMD_LINE_FLAG=y 885 ;; 886 n ) n_FLAG=y 887 ;; 888 V ) V_FLAG=y 889 V_ARG="$OPTARG" 890 ;; 891 S ) 892 if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 893 echo "Can only build one source variant at a time." 894 exit 1 895 fi 896 if [ "${OPTARG}" = "E" ]; then 897 SE_FLAG=y 898 elif [ "${OPTARG}" = "D" ]; then 899 SD_FLAG=y 900 elif [ "${OPTARG}" = "H" ]; then 901 SH_FLAG=y 902 else 903 echo "$USAGE" 904 exit 1 905 fi 906 ;; 907 t ) t_FLAG=y 908 ;; 909 \? ) echo "$USAGE" 910 exit 1 911 ;; 912 esac 913done 914 915# correct argument count after options 916shift `expr $OPTIND - 1` 917 918# test that the path to the environment-setting file was given 919if [ $# -ne 1 ]; then 920 echo "$USAGE" 921 exit 1 922fi 923 924# check if user is running nightly as root 925# ISUSER is set non-zero if an ordinary user runs nightly, or is zero 926# when root invokes nightly. 927/usr/bin/id | grep '^uid=0(' >/dev/null 2>&1 928ISUSER=$?; export ISUSER 929 930# 931# force locale to C 932LC_COLLATE=C; export LC_COLLATE 933LC_CTYPE=C; export LC_CTYPE 934LC_MESSAGES=C; export LC_MESSAGES 935LC_MONETARY=C; export LC_MONETARY 936LC_NUMERIC=C; export LC_NUMERIC 937LC_TIME=C; export LC_TIME 938 939# clear environment variables we know to be bad for the build 940unset LD_OPTIONS 941unset LD_AUDIT LD_AUDIT_32 LD_AUDIT_64 942unset LD_BIND_NOW LD_BIND_NOW_32 LD_BIND_NOW_64 943unset LD_BREADTH LD_BREADTH_32 LD_BREADTH_64 944unset LD_CONFIG LD_CONFIG_32 LD_CONFIG_64 945unset LD_DEBUG LD_DEBUG_32 LD_DEBUG_64 946unset LD_DEMANGLE LD_DEMANGLE_32 LD_DEMANGLE_64 947unset LD_FLAGS LD_FLAGS_32 LD_FLAGS_64 948unset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 949unset LD_LOADFLTR LD_LOADFLTR_32 LD_LOADFLTR_64 950unset LD_NOAUDIT LD_NOAUDIT_32 LD_NOAUDIT_64 951unset LD_NOAUXFLTR LD_NOAUXFLTR_32 LD_NOAUXFLTR_64 952unset LD_NOCONFIG LD_NOCONFIG_32 LD_NOCONFIG_64 953unset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64 954unset LD_NODIRECT LD_NODIRECT_32 LD_NODIRECT_64 955unset LD_NOLAZYLOAD LD_NOLAZYLOAD_32 LD_NOLAZYLOAD_64 956unset LD_NOOBJALTER LD_NOOBJALTER_32 LD_NOOBJALTER_64 957unset LD_NOVERSION LD_NOVERSION_32 LD_NOVERSION_64 958unset LD_ORIGIN LD_ORIGIN_32 LD_ORIGIN_64 959unset LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64 960unset LD_PROFILE LD_PROFILE_32 LD_PROFILE_64 961 962unset CONFIG 963unset GROUP 964unset OWNER 965unset REMOTE 966unset ENV 967unset ARCH 968unset CLASSPATH 969unset NAME 970 971# 972# Setup environmental variables 973# 974if [ -f $1 ]; then 975 if [[ $1 = */* ]]; then 976 . $1 977 else 978 . ./$1 979 fi 980else 981 if [ -f $OPTHOME/onbld/env/$1 ]; then 982 . $OPTHOME/onbld/env/$1 983 else 984 echo "Cannot find env file as either $1 or $OPTHOME/onbld/env/$1" 985 exit 1 986 fi 987fi 988 989# 990# place ourselves in a new task, respecting BUILD_PROJECT if set. 991# 992if [ -z "$BUILD_PROJECT" ]; then 993 /usr/bin/newtask -c $$ 994else 995 /usr/bin/newtask -c $$ -p $BUILD_PROJECT 996fi 997 998ps -o taskid= -p $$ | read build_taskid 999ps -o project= -p $$ | read build_project 1000 1001# 1002# See if NIGHTLY_OPTIONS is set 1003# 1004if [ "$NIGHTLY_OPTIONS" = "" ]; then 1005 NIGHTLY_OPTIONS="-aBm" 1006fi 1007 1008# 1009# If BRINGOVER_WS was not specified, let it default to CLONE_WS 1010# 1011if [ "$BRINGOVER_WS" = "" ]; then 1012 BRINGOVER_WS=$CLONE_WS 1013fi 1014 1015# 1016# If BRINGOVER_FILES was not specified, default to usr/src 1017# 1018if [ "$BRINGOVER_FILES" = "" ]; then 1019 BRINGOVER_FILES="usr/src" 1020fi 1021 1022# 1023# Note: changes to the option letters here should also be applied to the 1024# bldenv script. 1025# 1026OPTIND=1 1027while getopts ABDFNMPTCGIRafinlmoptuUxdrtzWS:X FLAG $NIGHTLY_OPTIONS 1028do 1029 case $FLAG in 1030 A ) A_FLAG=y 1031 ;; 1032 B ) D_FLAG=y 1033 ;; # old version of D 1034 F ) F_FLAG=y 1035 ;; 1036 D ) D_FLAG=y 1037 ;; 1038 P ) P_FLAG=y 1039 ;; 1040 T ) T_FLAG=y 1041 ;; 1042 C ) C_FLAG=y 1043 ;; 1044 M ) M_FLAG=y 1045 ;; 1046 N ) N_FLAG=y 1047 ;; 1048 G ) a_FLAG=y 1049 u_FLAG=y 1050 ;; 1051 I ) a_FLAG=y 1052 m_FLAG=y 1053 p_FLAG=y 1054 u_FLAG=y 1055 ;; 1056 R ) m_FLAG=y 1057 p_FLAG=y 1058 ;; 1059 a ) a_FLAG=y 1060 ;; 1061 d ) d_FLAG=y 1062 ;; 1063 f ) f_FLAG=y 1064 ;; 1065 i ) i_FLAG=y 1066 ;; 1067 n ) n_FLAG=y 1068 ;; 1069 o ) o_FLAG=y 1070 ;; 1071 l ) l_FLAG=y 1072 ;; 1073 m ) m_FLAG=y 1074 ;; 1075 p ) p_FLAG=y 1076 ;; 1077 r ) r_FLAG=y 1078 ;; 1079 t ) t_FLAG=y 1080 ;; 1081 u ) u_FLAG=y 1082 ;; 1083 z ) z_FLAG=y 1084 ;; 1085 U ) 1086 if [ -z "${PARENT_ROOT}" ]; then 1087 echo "PARENT_ROOT must be set if the U flag is" \ 1088 "present in NIGHTLY_OPTIONS." 1089 exit 1 1090 fi 1091 U_FLAG=y 1092 NIGHTLY_PARENT_ROOT=$PARENT_ROOT 1093 ;; 1094 x ) XMOD_OPT="-x" 1095 ;; 1096 W ) W_FLAG=y 1097 ;; 1098 S ) 1099 if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 1100 echo "Can only build one source variant at a time." 1101 exit 1 1102 fi 1103 if [ "${OPTARG}" = "E" ]; then 1104 SE_FLAG=y 1105 elif [ "${OPTARG}" = "D" ]; then 1106 SD_FLAG=y 1107 elif [ "${OPTARG}" = "H" ]; then 1108 SH_FLAG=y 1109 else 1110 echo "$USAGE" 1111 exit 1 1112 fi 1113 ;; 1114 X ) # now that we no longer need realmode builds, just 1115 # copy IHV packages. only meaningful on x86. 1116 if [ "$MACH" = "i386" ]; then 1117 X_FLAG=y 1118 fi 1119 ;; 1120 \? ) echo "$USAGE" 1121 exit 1 1122 ;; 1123 esac 1124done 1125 1126if [ $ISUSER -ne 0 ]; then 1127 if [ "$o_FLAG" = "y" ]; then 1128 echo "Old-style build requires root permission." 1129 exit 1 1130 fi 1131 1132 # Set default value for STAFFER, if needed. 1133 if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then 1134 STAFFER=`/usr/xpg4/bin/id -un` 1135 export STAFFER 1136 fi 1137fi 1138 1139if [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then 1140 MAILTO=$STAFFER 1141 export MAILTO 1142fi 1143 1144PATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin" 1145PATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb" 1146PATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:." 1147export PATH 1148 1149unset CH 1150if [ "$o_FLAG" = "y" ]; then 1151# root invoked old-style build -- make sure it works as it always has 1152# by exporting 'CH'. The current Makefile.master doesn't use this, but 1153# the old ones still do. 1154 PROTOCMPTERSE="protocmp.terse" 1155 CH= 1156 export CH 1157else 1158 PROTOCMPTERSE="protocmp.terse -gu" 1159fi 1160POUND_SIGN="#" 1161DEF_STRIPFLAG="-s" 1162 1163# we export POUND_SIGN to speed up the build process -- prevents evaluation of 1164# the Makefile.master definitions. 1165# we export DEF_STRIPFLAG to strip debug data from nightly builds; the default 1166# behavior is to include all debug data. 1167export o_FLAG POUND_SIGN DEF_STRIPFLAG 1168 1169if [ "$d_FLAG" = "y" ]; then 1170 maketype="distributed" 1171 MAKE=dmake 1172 # get the dmake version string alone 1173 DMAKE_VERSION=$( $MAKE -v ) 1174 DMAKE_VERSION=${DMAKE_VERSION#*: } 1175 # focus in on just the dotted version number alone 1176 DMAKE_MAJOR=$( echo $DMAKE_VERSION | \ 1177 sed -e 's/.*\<\([^.]*\.[^ ]*\).*$/\1/' ) 1178 # extract the second (or final) integer 1179 DMAKE_MINOR=${DMAKE_MAJOR#*.} 1180 DMAKE_MINOR=${DMAKE_MINOR%%.*} 1181 # extract the first integer 1182 DMAKE_MAJOR=${DMAKE_MAJOR%%.*} 1183 CHECK_DMAKE=${CHECK_DMAKE:-y} 1184 # x86 was built on the 12th, sparc on the 13th. 1185 if [ "$CHECK_DMAKE" = "y" -a \ 1186 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \ 1187 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \( \ 1188 "$DMAKE_MAJOR" -lt 7 -o \ 1189 "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \) ]; then 1190 if [ -z "$DMAKE_VERSION" ]; then 1191 echo "$MAKE is missing." 1192 exit 1 1193 fi 1194 echo `whence $MAKE`" version is:" 1195 echo " ${DMAKE_VERSION}" 1196 cat <<EOF 1197 1198This version may not be safe for use. Either set TEAMWARE to a better 1199path or (if you really want to use this version of dmake anyway), add 1200the following to your environment to disable this check: 1201 1202 CHECK_DMAKE=n 1203EOF 1204 exit 1 1205 fi 1206else 1207 PATH="$TEAMWARE/ParallelMake/bin:$PATH" 1208 maketype="parallel" 1209 MAKE=make 1210fi 1211export PATH 1212export MAKE 1213 1214if [ "${SUNWSPRO}" != "" ]; then 1215 PATH="${SUNWSPRO}/bin:$PATH" 1216 export PATH 1217fi 1218 1219hostname=`uname -n` 1220if [ ! -f $HOME/.make.machines ]; then 1221 DMAKE_MAX_JOBS=4 1222else 1223 DMAKE_MAX_JOBS="`grep $hostname $HOME/.make.machines | \ 1224 tail -1 | awk -F= '{print $ 2;}'`" 1225 if [ "$DMAKE_MAX_JOBS" = "" ]; then 1226 DMAKE_MAX_JOBS=4 1227 fi 1228fi 1229DMAKE_MODE=parallel; 1230export DMAKE_MODE 1231export DMAKE_MAX_JOBS 1232 1233if [ -z "${ROOT}" ]; then 1234 echo "ROOT must be set." 1235 exit 1 1236fi 1237 1238if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" ]; then 1239 if [ -z "${EXPORT_SRC}" ]; then 1240 echo "EXPORT_SRC must be set for a source build." 1241 exit 1 1242 fi 1243 if [ -z "${CRYPT_SRC}" ]; then 1244 echo "CRYPT_SRC must be set for a source build." 1245 exit 1 1246 fi 1247fi 1248 1249if [ "$SH_FLAG" = "y" ]; then 1250 if [ -z "${EXPORT_SRC}" ]; then 1251 echo "EXPORT_SRC must be set for a source build." 1252 exit 1 1253 fi 1254fi 1255 1256# 1257# if -V flag was given, reset VERSION to V_ARG 1258# 1259if [ "$V_FLAG" = "y" ]; then 1260 VERSION=$V_ARG 1261fi 1262 1263# Append source version 1264if [ "$SE_FLAG" = "y" ]; then 1265 VERSION="${VERSION}:EXPORT" 1266fi 1267 1268if [ "$SD_FLAG" = "y" ]; then 1269 VERSION="${VERSION}:DOMESTIC" 1270fi 1271 1272if [ "$SH_FLAG" = "y" ]; then 1273 VERSION="${VERSION}:MODIFIED_SOURCE_PRODUCT" 1274fi 1275 1276TMPDIR="/tmp/nightly.tmpdir.$$" 1277export TMPDIR 1278rm -rf ${TMPDIR} 1279mkdir -p $TMPDIR || exit 1 1280 1281# 1282# Keep elfsign's use of pkcs11_softtoken from looking in the user home 1283# directory, which doesn't always work. Needed until all build machines 1284# have the fix for 6271754 1285# 1286SOFTTOKEN_DIR=$TMPDIR 1287export SOFTTOKEN_DIR 1288 1289TOOLS=${SRC}/tools 1290TOOLS_PROTO=${TOOLS}/proto 1291 1292unset CFLAGS LD_LIBRARY_PATH LDFLAGS 1293 1294# create directories that are automatically removed if the nightly script 1295# fails to start correctly 1296newdir() { 1297 dir=$1 1298 toadd= 1299 while [ ! -d $dir ]; do 1300 toadd="$dir $toadd" 1301 dir=`dirname $dir` 1302 done 1303 torm= 1304 newlist= 1305 for dir in $toadd; do 1306 if staffer mkdir $dir; then 1307 newlist="$ISUSER $dir $newlist" 1308 torm="$dir $torm" 1309 else 1310 [ -z "$torm" ] || staffer rmdir $torm 1311 return 1 1312 fi 1313 done 1314 newdirlist="$newlist $newdirlist" 1315 return 0 1316} 1317newdirlist= 1318 1319[ -d $CODEMGR_WS ] || newdir $CODEMGR_WS || exit 1 1320 1321# since this script assumes the build is from full source, it nullifies 1322# variables likely to have been set by a "ws" script; nullification 1323# confines the search space for headers and libraries to the proto area 1324# built from this immediate source. 1325ENVLDLIBS1= 1326ENVLDLIBS2= 1327ENVLDLIBS3= 1328ENVCPPFLAGS1= 1329ENVCPPFLAGS2= 1330ENVCPPFLAGS3= 1331ENVCPPFLAGS4= 1332PARENT_ROOT= 1333 1334export ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \ 1335 PARENT_ROOT 1336 1337ENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib" 1338ENVCPPFLAGS1="-I$ROOT/usr/include" 1339 1340export ENVLDLIBS1 ENVLDLIBS2 1341 1342CPIODIR_ORIG=$CPIODIR 1343PKGARCHIVE_ORIG=$PKGARCHIVE 1344IA32_IHV_PKGS_ORIG=$IA32_IHV_PKGS 1345if [ "$SPARC_RM_PKGARCHIVE" ]; then 1346 SPARC_RM_PKGARCHIVE_ORIG=$SPARC_RM_PKGARCHIVE 1347fi 1348 1349# 1350# Juggle the logs and optionally send mail on completion. 1351# 1352 1353logshuffle() { 1354 LLOG="$ATLOG/log.`date '+%m%d'`" 1355 rm -rf $ATLOG/log.??`date '+%d'` 1356 if [ -f $LLOG -o -d $LLOG ]; then 1357 LLOG=$LLOG.$$ 1358 fi 1359 mkdir $LLOG 1360 1361 if [ "$build_ok" = "y" ]; then 1362 mv $ATLOG/proto_list_${MACH} $LLOG 1363 fi 1364 1365 # 1366 # Now that we're about to send mail, it's time to check the noise 1367 # file. In the event that an error occurs beyond this point, it will 1368 # be recorded in the nightly.log file, but nowhere else. This would 1369 # include only errors that cause the copying of the noise log to fail 1370 # or the mail itself not to be sent. 1371 # 1372 1373 exec >>$LOGFILE 2>&1 1374 if [ -s $build_noise_file ]; then 1375 echo "\n==== Nightly build noise ====\n" | 1376 tee -a $LOGFILE >>$mail_msg_file 1377 cat $build_noise_file >>$LOGFILE 1378 cat $build_noise_file >>$mail_msg_file 1379 echo | tee -a $LOGFILE >>$mail_msg_file 1380 fi 1381 rm -f $build_noise_file 1382 1383 case "$build_ok" in 1384 y) 1385 state=Completed 1386 ;; 1387 i) 1388 state=Interrupted 1389 ;; 1390 *) 1391 state=Failed 1392 ;; 1393 esac 1394 1395 cat $build_time_file $mail_msg_file > ${LLOG}/mail_msg 1396 if [ "$m_FLAG" = "y" ]; then 1397 cat $build_time_file $mail_msg_file | 1398 /usr/bin/mailx -s \ 1399 "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \ 1400 ${MAILTO} 1401 fi 1402 1403 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 1404 staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH} 1405 staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log 1406 fi 1407 1408 mv $LOGFILE $LLOG 1409} 1410 1411# 1412# Remove the locks and temporary files on any exit 1413# 1414cleanup() { 1415 logshuffle 1416 1417 [ -z "$lockfile" ] || staffer rm -f $lockfile 1418 [ -z "$atloglockfile" ] || rm -f $atloglockfile 1419 [ -z "$ulockfile" ] || staffer rm -f $ulockfile 1420 [ -z "$Ulockfile" ] || rm -f $Ulockfile 1421 1422 set -- $newdirlist 1423 while [ $# -gt 0 ]; do 1424 ISUSER=$1 staffer rmdir $2 1425 shift; shift 1426 done 1427 rm -rf $TMPDIR 1428} 1429 1430cleanup_signal() { 1431 build_ok=i 1432 # this will trigger cleanup(), above. 1433 exit 1 1434} 1435 1436trap cleanup 0 1437trap cleanup_signal 1 2 3 15 1438 1439# 1440# Generic lock file processing -- make sure that the lock file doesn't 1441# exist. If it does, it should name the build host and PID. If it 1442# doesn't, then make sure we can create it. Clean up locks that are 1443# known to be stale (assumes host name is unique among build systems 1444# for the workspace). 1445create_lock() { 1446 lockf=$1 1447 lockvar=$2 1448 if [ -f $lockf ]; then 1449 basews=`basename $CODEMGR_WS` 1450 if read host user pid < $lockf; then 1451 if [ "$host" != "$hostname" ]; then 1452 echo "$MACH build of $basews apparently" \ 1453 "already started by $user on $host as $pid." 1454 elif kill -s 0 $pid 2>/dev/null; then 1455 echo "$MACH build of $basews already started" \ 1456 "by $user as $pid." 1457 else 1458 # stale lock; clear it out and continue 1459 rm -f $lockf 1460 fi 1461 else 1462 echo "$MACH build of $basews already running." 1463 fi 1464 fi 1465 if [ -f $lockf ]; then 1466 echo "Lock file is $lockf." 1467 exit 1 1468 fi 1469 ldir=`dirname $lockf` 1470 [ -d $ldir ] || newdir $ldir || exit 1 1471 eval $lockvar=$lockf 1472 staffer sh -c "echo $hostname $STAFFER $$ > $lockf" || exit 1 1473} 1474 1475# Ensure no other instance of this script is running on this host. 1476# LOCKNAME can be set in <env_file>, and is by default, but is not 1477# required due to the use of $ATLOG below. 1478if [ -n "$LOCKNAME" ]; then 1479 create_lock /tmp/$LOCKNAME "lockfile" 1480fi 1481# 1482# Create from one, two, or three other locks: 1483# $ATLOG/nightly.lock 1484# - protects against multiple builds in same workspace 1485# $PARENT_WS/usr/src/nightly.$MACH.lock 1486# - protects against multiple 'u' copy-backs 1487# $NIGHTLY_PARENT_ROOT/nightly.lock 1488# - protects against multiple 'U' copy-backs 1489# 1490# Overriding ISUSER to 1 causes the lock to be created as root if the 1491# script is run as root. The default is to create it as $STAFFER. 1492ISUSER=1 create_lock $ATLOG/nightly.lock "atloglockfile" 1493if [ "$u_FLAG" = "y" ]; then 1494 create_lock $PARENT_WS/usr/src/nightly.$MACH.lock "ulockfile" 1495fi 1496if [ "$U_FLAG" = "y" ]; then 1497 # NIGHTLY_PARENT_ROOT is written as root if script invoked as root. 1498 ISUSER=1 create_lock $NIGHTLY_PARENT_ROOT/nightly.lock "Ulockfile" 1499fi 1500 1501# Locks have been taken, so we're doing a build and we're committed to 1502# the directories we may have created so far. 1503newdirlist= 1504 1505# 1506# Create mail_msg_file 1507# 1508mail_msg_file="${TMPDIR}/mail_msg" 1509touch $mail_msg_file 1510build_time_file="${TMPDIR}/build_time" 1511# 1512# Move old LOGFILE aside 1513# ATLOG directory already made by 'create_lock' above 1514# 1515if [ -f $LOGFILE ]; then 1516 mv -f $LOGFILE ${LOGFILE}- 1517fi 1518# 1519# Build OsNet source 1520# 1521START_DATE=`date` 1522SECONDS=0 1523echo "\n==== Nightly $maketype build started: $START_DATE ====" \ 1524 | tee -a $LOGFILE > $build_time_file 1525 1526# make sure we log only to the nightly build file 1527build_noise_file="${TMPDIR}/build_noise" 1528exec </dev/null >$build_noise_file 2>&1 1529 1530echo "\n==== list of environment variables ====\n" >> $LOGFILE 1531env >> $LOGFILE 1532 1533echo "\n==== Nightly argument issues ====\n" | tee -a $mail_msg_file >> $LOGFILE 1534 1535if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 1536 if [ "$i_FLAG" = "y" -o "$i_CMD_LINE_FLAG" = "y" ]; then 1537 echo "WARNING: the -S flags do not support incremental" \ 1538 "builds; forcing clobber\n" | tee -a $mail_msg_file >> $LOGFILE 1539 i_FLAG=n 1540 i_CMD_LINE_FLAG=n 1541 fi 1542 if [ "$N_FLAG" = "n" ]; then 1543 echo "WARNING: the -S flags do not support protocmp;" \ 1544 "protocmp disabled\n" | \ 1545 tee -a $mail_msg_file >> $LOGFILE 1546 N_FLAG=y 1547 fi 1548 if [ "$l_FLAG" = "y" ]; then 1549 echo "WARNING: the -S flags do not support lint;" \ 1550 "lint disabled\n" | tee -a $mail_msg_file >> $LOGFILE 1551 l_FLAG=n 1552 fi 1553 if [ "$C_FLAG" = "y" ]; then 1554 echo "WARNING: the -S flags do not support cstyle;" \ 1555 "cstyle check disabled\n" | tee -a $mail_msg_file >> $LOGFILE 1556 C_FLAG=n 1557 fi 1558else 1559 if [ "$N_FLAG" = "y" ]; then 1560 if [ "$p_FLAG" = "y" ]; then 1561 cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 1562WARNING: the p option (create packages) is set, but so is the N option (do 1563 not run protocmp); this is dangerous; you should unset the N option 1564EOF 1565 else 1566 cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 1567Warning: the N option (do not run protocmp) is set; it probably shouldn't be 1568EOF 1569 fi 1570 echo "" | tee -a $mail_msg_file >> $LOGFILE 1571 fi 1572fi 1573 1574if [ "$a_FLAG" = "y" -a "$D_FLAG" = "n" -a "$F_FLAG" = "y" ]; then 1575 echo "WARNING: Neither DEBUG nor non-DEBUG build requested, but the" \ 1576 "'a' option was set." | tee -a $mail_msg_file >> $LOGFILE 1577fi 1578 1579if [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 1580 echo "WARNING: DEBUG build not requested, but lint will be with" \ 1581 "DEBUG enabled.\n" \ 1582 | tee -a $mail_msg_file >> $LOGFILE 1583fi 1584 1585if [ "$f_FLAG" = "y" ]; then 1586 if [ "$i_FLAG" = "y" ]; then 1587 echo "WARNING: the -f flag cannot be used during incremental" \ 1588 "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE 1589 f_FLAG=n 1590 fi 1591 if [ "$p_FLAG" != "y" -o "$l_FLAG" != "y" ]; then 1592 echo "WARNING: the -f flag requires -l and -p; ignoring -f\n" | \ 1593 tee -a $mail_msg_file >> $LOGFILE 1594 f_FLAG=n 1595 fi 1596fi 1597 1598if [ "$T_FLAG" = "y" -a -d $SRC/uts/common/dtrace ]; then 1599 echo "WARNING: TRACE build requested but workspace contains DTrace;" \ 1600 "-T will have no effect\n" | tee -a $mail_msg_file >> $LOGFILE 1601fi 1602 1603if [ "$t_FLAG" = "n" ]; then 1604 # 1605 # We're not doing a tools build, so make sure elfsign(1) is 1606 # new enough to safely sign non-crypto binaries. We test 1607 # debugging output from elfsign to detect the old version. 1608 # 1609 newelfsigntest=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \ 1610 -e /usr/lib/security/pkcs11_softtoken.so.1 2>&1 \ 1611 | egrep algorithmOID` 1612 if [ -z "$newelfsigntest" ]; then 1613 echo "WARNING: /usr/bin/elfsign out of date;" \ 1614 "will only sign crypto modules\n" | \ 1615 tee -a $mail_msg_file >> $LOGFILE 1616 export ELFSIGN_OBJECT=true 1617 elif [ "$VERIFY_ELFSIGN" = "y" ]; then 1618 echo "WARNING: VERIFY_ELFSIGN=y requires" \ 1619 "the -t flag; ignoring VERIFY_ELFSIGN\n" | \ 1620 tee -a $mail_msg_file >> $LOGFILE 1621 fi 1622fi 1623 1624echo "==== Build environment ====\n" | tee -a $mail_msg_file >> $LOGFILE 1625 1626# System 1627whence uname | tee -a $mail_msg_file >> $LOGFILE 1628uname -a 2>&1 | tee -a $mail_msg_file >> $LOGFILE 1629echo | tee -a $mail_msg_file >> $LOGFILE 1630 1631# nightly (will fail in year 2100 due to SCCS flaw) 1632echo "$0 $@" | tee -a $mail_msg_file >> $LOGFILE 1633echo "%M% version %I% 20%E%\n" | tee -a $mail_msg_file >> $LOGFILE 1634 1635# make 1636whence $MAKE | tee -a $mail_msg_file >> $LOGFILE 1637if [ "$d_FLAG" = "y" ]; then 1638 $MAKE -v | tee -a $mail_msg_file >> $LOGFILE 1639fi 1640echo "number of concurrent jobs = $DMAKE_MAX_JOBS" | 1641 tee -a $mail_msg_file >> $LOGFILE 1642 1643# 1644# Report the compiler versions. 1645# 1646if [ -f $SRC/Makefile ]; then 1647 srcroot=$SRC 1648elif [ -f $BRINGOVER_WS/usr/src/Makefile ]; then 1649 srcroot=$BRINGOVER_WS/usr/src 1650else 1651 echo "\nUnable to find \"Makefile\" in $BRINGOVER_WS/usr/src or $SRC." | 1652 tee -a $mail_msg_file >> $LOGFILE 1653 exit 1 1654fi 1655 1656( cd $srcroot 1657 for target in cc-version cc64-version java-version; do 1658 echo 1659 # 1660 # Put statefile somewhere we know we can write to rather than trip 1661 # over a read-only $srcroot. Use /usr/ccs/bin/make here because 1662 # it supports -K and ParallelMake doesn't. 1663 # 1664 rm -f $TMPDIR/make-state 1665 if /usr/ccs/bin/make -K $TMPDIR/make-state -e $target 2>/dev/null; then 1666 continue 1667 fi 1668 touch $TMPDIR/nocompiler 1669 done 1670 echo 1671) | tee -a $mail_msg_file >> $LOGFILE 1672 1673if [ -f $TMPDIR/nocompiler ]; then 1674 rm -f $TMPDIR/nocompiler 1675 build_ok=n 1676 echo "Aborting due to missing compiler." | 1677 tee -a $mail_msg_file >> $LOGFILE 1678 exit 1 1679fi 1680 1681# as 1682whence as | tee -a $mail_msg_file >> $LOGFILE 1683as -V 2>&1 | head -1 | tee -a $mail_msg_file >> $LOGFILE 1684echo | tee -a $mail_msg_file >> $LOGFILE 1685 1686# Check that we're running a capable link-editor 1687whence ld | tee -a $mail_msg_file >> $LOGFILE 1688LDVER=`ld -V 2>&1` 1689echo $LDVER | tee -a $mail_msg_file >> $LOGFILE 1690LDVER=`echo $LDVER | sed -e "s/.*-1\.//" -e "s/:.*//"` 1691if [ `expr $LDVER \< 422` -eq 1 ]; then 1692 echo "The link-editor needs to be at version 422 or higher to build" | \ 1693 tee -a $mail_msg_file >> $LOGFILE 1694 echo "the latest stuff, hope your build works." | \ 1695 tee -a $mail_msg_file >> $LOGFILE 1696fi 1697 1698echo "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \ 1699 tee -a $mail_msg_file >> $LOGFILE 1700 1701echo "\n==== Build version ====\n" | tee -a $mail_msg_file >> $LOGFILE 1702echo $VERSION | tee -a $mail_msg_file >> $LOGFILE 1703 1704# 1705# Decide whether to clobber 1706# 1707if [ "$i_FLAG" = "n" -a -d "$SRC" ]; then 1708 echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE 1709 1710 cd $SRC 1711 # remove old clobber file 1712 rm -f $SRC/clobber.out 1713 rm -f $SRC/clobber-${MACH}.out 1714 1715 # Remove all .make.state* files, just in case we are restarting 1716 # the build after having interrupted a previous 'make clobber'. 1717 find . \( -name SCCS -o -name 'interfaces.*' \) -prune \ 1718 -o -name '.make.*' -print | xargs rm -f 1719 1720 $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE 1721 echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file 1722 grep "$MAKE:" $SRC/clobber-${MACH}.out | 1723 egrep -v "Ignoring unknown host" \ 1724 >> $mail_msg_file 1725 1726 if [ "$t_FLAG" = "y" ]; then 1727 echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE 1728 cd ${TOOLS} 1729 rm -f ${TOOLS}/clobber-${MACH}.out 1730 $MAKE -ek clobber 2>&1 | \ 1731 tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE 1732 echo "\n==== Make tools clobber ERRORS ====\n" \ 1733 >> $mail_msg_file 1734 grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \ 1735 >> $mail_msg_file 1736 rm -rf ${TOOLS_PROTO} 1737 mkdir -p ${TOOLS_PROTO} 1738 fi 1739 rm -rf $ROOT 1740 1741 # Get back to a clean workspace as much as possible to catch 1742 # problems that only occur on fresh workspaces. 1743 # Remove all .make.state* files, libraries, and .o's that may 1744 # have been ommitted from clobber. 1745 # We should probably blow away temporary directories too. 1746 cd $SRC 1747 find . \( -name SCCS -o -name 'interfaces.*' \) -prune -o \ 1748 \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \ 1749 -name '*.o' \) -print | xargs rm -f 1750else 1751 echo "\n==== No clobber at `date` ====\n" >> $LOGFILE 1752fi 1753 1754# 1755# Decide whether to bringover to the codemgr workspace 1756# 1757if [ "$n_FLAG" = "n" ]; then 1758 echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE 1759 # sleep on the parent workspace's lock 1760 while egrep -s write $BRINGOVER_WS/Codemgr_wsdata/locks 1761 do 1762 sleep 120 1763 done 1764 1765 echo "\n==== BRINGOVER LOG ====\n" >> $mail_msg_file 1766 staffer $TEAMWARE/bin/bringover -c "nightly update" -p $BRINGOVER_WS \ 1767 -w $CODEMGR_WS $BRINGOVER_FILES < /dev/null 2>&1 | \ 1768 tee -a $mail_msg_file >> $LOGFILE 1769 if [ $? -eq 1 ] 1770 then 1771 echo "trouble with bringover, quitting at `date`." >> $LOGFILE 1772 exit 1 1773 fi 1774 if [ -d $SRC/cmd/lp/cmd/lpsched/lpsched -a \ 1775 ! -f $SRC/cmd/lp/cmd/lpsched/lpsched/Makefile ]; then 1776 # on297 printing 1777 rm -rf $SRC/cmd/lp/cmd/lpsched/lpsched 1778 fi 1779 if [ -d $SRC/cmd/localedef/localedef -a \ 1780 ! -f $SRC/cmd/localedef/localedef/Makefile ]; then 1781 # on297 CSI project 1782 rm -rf $SRC/cmd/localedef/localedef 1783 fi 1784else 1785 echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE 1786fi 1787 1788# 1789# Build tools if requested 1790# 1791if [ "$t_FLAG" = "y" ]; then 1792 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 1793 export RELEASE_BUILD ; RELEASE_BUILD= 1794 unset EXTRA_OPTIONS 1795 unset EXTRA_CFLAGS 1796 1797 export ONBLD_TOOLS=${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld} 1798 build_tools ${TOOLS_PROTO} 1799fi 1800 1801if [ "$i_FLAG" = "y" -a "$SH_FLAG" = "y" ]; then 1802 echo "\n==== NOT Building base OS-Net source ====\n" | \ 1803 tee -a $LOGFILE >> $mail_msg_file 1804else 1805 normal_build 1806fi 1807 1808ORIG_SRC=$SRC 1809BINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z 1810 1811if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 1812 save_binaries 1813 1814 echo "\n==== Retrieving SCCS files at `date` ====\n" >> $LOGFILE 1815 SCCSHELPER=${TMPDIR}/sccs-helper 1816 rm -f ${SCCSHELPER} 1817cat >${SCCSHELPER} <<EOF 1818#!/bin/ksh 1819cd \$1 1820cd .. 1821sccs get SCCS >/dev/null 2>&1 1822EOF 1823 cd $SRC 1824 chmod +x ${SCCSHELPER} 1825 find . -name SCCS | xargs -L 1 ${SCCSHELPER} 1826 rm -f ${SCCSHELPER} 1827fi 1828 1829if [ "$SD_FLAG" = "y" ]; then 1830 clone_source ${CODEMGR_WS} ${CRYPT_SRC} CRYPT_SRC 1831fi 1832 1833# EXPORT_SRC comes after CRYPT_SRC since a domestic build will need 1834# $SRC pointing to the export_source usr/src. 1835if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 1836 clone_source ${CODEMGR_WS} ${EXPORT_SRC} EXPORT_SRC 1837fi 1838 1839if [ "$SD_FLAG" = "y" ]; then 1840 # drop the crypt files in place. 1841 cd ${EXPORT_SRC} 1842 echo "\nextracting crypt_files.cpio.Z onto export_source.\n" \ 1843 >> ${LOGFILE} 1844 zcat ${CODEMGR_WS}/crypt_files.cpio.Z | \ 1845 cpio -idmucvB 2>/dev/null >> ${LOGFILE} 1846 if [ "$?" = "0" ]; then 1847 echo "\n==== DOMESTIC extraction succeeded ====\n" \ 1848 >> $mail_msg_file 1849 else 1850 echo "\n==== DOMESTIC extraction failed ====\n" \ 1851 >> $mail_msg_file 1852 fi 1853 1854fi 1855 1856if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 1857 # remove proto area here, since we don't clobber 1858 rm -rf "$ROOT" 1859 if [ "$t_FLAG" = "y" ]; then 1860 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 1861 export RELEASE_BUILD ; RELEASE_BUILD= 1862 unset EXTRA_OPTIONS 1863 unset EXTRA_CFLAGS 1864 1865 build_tools ${EXPORT_SRC}/usr/src/tools/proto 1866 fi 1867 1868 export EXPORT_RELEASE_BUILD ; EXPORT_RELEASE_BUILD=# 1869 normal_build 1870fi 1871 1872if [ "$build_ok" = "y" ]; then 1873 echo "\n==== Creating protolist system file at `date` ====" \ 1874 >> $LOGFILE 1875 protolist $ROOT > $ATLOG/proto_list_${MACH} 1876 echo "==== protolist system file created at `date` ====\n" \ 1877 >> $LOGFILE 1878 1879 if [ "$N_FLAG" != "y" ]; then 1880 echo "\n==== Impact on packages ====\n" >> $mail_msg_file 1881 1882 # If there is a reference proto list, compare the build's proto 1883 # list with the reference to see changes in proto areas. 1884 # Use the current exception list. 1885 exc=etc/exception_list_$MACH 1886 if [ -f $SRC/pkgdefs/$exc ]; then 1887 ELIST="-e $SRC/pkgdefs/$exc" 1888 fi 1889 1890 if [ -f "$REF_PROTO_LIST" ]; then 1891 $PROTOCMPTERSE \ 1892 "Files in yesterday's proto area, but not today's:" \ 1893 "Files in today's proto area, but not yesterday's:" \ 1894 "Files that changed between yesterday and today:" \ 1895 ${ELIST} \ 1896 -d $REF_PROTO_LIST \ 1897 $ATLOG/proto_list_${MACH} \ 1898 >> $mail_msg_file 1899 fi 1900 # Compare the build's proto list with current package 1901 # definitions to audit the quality of package definitions 1902 # and makefile install targets. Use the current exception list. 1903 PKGDEFS_LIST="-d $SRC/pkgdefs" 1904 1905 $PROTOCMPTERSE \ 1906 "Files missing from the proto area:" \ 1907 "Files missing from packages:" \ 1908 "Inconsistencies between pkgdefs and proto area:" \ 1909 ${ELIST} \ 1910 ${PKGDEFS_LIST} \ 1911 $ATLOG/proto_list_${MACH} \ 1912 >> $mail_msg_file 1913 fi 1914fi 1915 1916if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 1917 staffer cp $ATLOG/proto_list_${MACH} \ 1918 $PARENT_WS/usr/src/proto_list_${MACH} 1919fi 1920 1921# Update parent proto area if necessary. This is done now 1922# so that the proto area has either DEBUG or non-DEBUG kernels. 1923# Note that this clears out the lock file, so we can dispense with 1924# the variable now. 1925if [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then 1926 echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \ 1927 tee -a $LOGFILE >> $mail_msg_file 1928 # The rm -rf command below produces predictable errors if 1929 # nightly is invoked from the parent's $ROOT/opt/onbld/bin, 1930 # and that directory is accessed via NFS. This is because 1931 # deleted-but-still-open files don't actually disappear as 1932 # expected, but rather turn into .nfsXXXX junk files, leaving 1933 # the directory non-empty. Since this is a not-unusual usage 1934 # pattern, and we still want to catch other errors here, we 1935 # take the unusal step of moving aside 'nightly' from that 1936 # directory (if we're using it). 1937 mypath=${0##*/root_$MACH/} 1938 if [ "$mypath" = $0 ]; then 1939 mypath=opt/onbld/bin/${0##*/} 1940 fi 1941 if [ $0 -ef $PARENT_WS/proto/root_$MACH/$mypath ]; then 1942 mv -f $0 $PARENT_WS/proto/root_$MACH 1943 fi 1944 rm -rf $PARENT_WS/proto/root_$MACH/* 1945 unset Ulockfile 1946 mkdir -p $NIGHTLY_PARENT_ROOT 1947 cd $ROOT 1948 ( tar cf - . | ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf - ) ) 2>&1 | 1949 tee -a $mail_msg_file >> $LOGFILE 1950fi 1951 1952# 1953# do shared library interface verification 1954# 1955 1956if [ "$A_FLAG" = "y" -a "$build_ok" = "y" ]; then 1957 echo "\n==== Check versioning and ABI information ====\n" | \ 1958 tee -a $LOGFILE >> $mail_msg_file 1959 1960 rm -rf $SRC/interfaces.ref 1961 if [ -d $SRC/interfaces.out ]; then 1962 mv $SRC/interfaces.out $SRC/interfaces.ref 1963 fi 1964 rm -rf $SRC/interfaces.out 1965 mkdir -p $SRC/interfaces.out 1966 1967 intf_check -V -m -o -b $SRC/tools/abi/etc \ 1968 -d $SRC/interfaces.out $ROOT 2>&1 | sort \ 1969 > $SRC/interfaces.out/log 1970 1971 # report any ERROR found in log file 1972 fgrep 'ERROR' $SRC/interfaces.out/log | sed 's/^ERROR: //' | \ 1973 tee -a $LOGFILE >> $mail_msg_file 1974 1975 if [ ! -d $SRC/interfaces.ref ] ; then 1976 mkdir -p $SRC/interfaces.ref 1977 if [ -d $SRC/interfaces.out ]; then 1978 cp -r $SRC/interfaces.out/* $SRC/interfaces.ref 1979 fi 1980 fi 1981 1982 echo "\n==== Diff versioning warnings (since last build) ====\n" | \ 1983 tee -a $LOGFILE >> $mail_msg_file 1984 1985 out_vers=`grep ^VERSION $SRC/interfaces.out/log`; 1986 ref_vers=`grep ^VERSION $SRC/interfaces.ref/log`; 1987 1988 # Report any differences in WARNING messages between last 1989 # and current build. 1990 if [ "$out_vers" = "$ref_vers" ]; then 1991 diff $SRC/interfaces.ref/log $SRC/interfaces.out/log | \ 1992 fgrep 'WARNING' | sed 's/WARNING: //' | \ 1993 tee -a $LOGFILE >> $mail_msg_file 1994 fi 1995fi 1996 1997if [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then 1998 echo "\n==== Check ELF runtime attributes ====\n" | \ 1999 tee -a $LOGFILE >> $mail_msg_file 2000 2001 LDDUSAGE="^ldd: does not support -e" 2002 LDDWRONG="wrong class" 2003 CRLERROR="^crle:" 2004 CRLECONF="^crle: configuration file:" 2005 2006 rm -f $SRC/runtime.ref 2007 if [ -f $SRC/runtime.out ]; then 2008 egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 2009 $SRC/runtime.out > $SRC/runtime.ref 2010 fi 2011 2012 # If we're doing a debug build the proto area will be left with 2013 # debuggable objects, thus don't assert -s. 2014 if [ "$D_FLAG" = "y" ]; then 2015 rtime_sflag="" 2016 else 2017 rtime_sflag="-s" 2018 fi 2019 check_rtime -d $ROOT -i -m -o $rtime_sflag $ROOT 2>&1 | \ 2020 egrep -v ": unreferenced object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \ 2021 egrep -v ": unused object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \ 2022 sort >$SRC/runtime.out 2023 2024 # Determine any processing errors that will affect the final output 2025 # and display these first. 2026 grep -l "$LDDUSAGE" $SRC/runtime.out > /dev/null 2027 if [ $? -eq 0 ]; then 2028 echo "WARNING: ldd(1) does not support -e. The version of ldd(1)" | \ 2029 tee -a $LOGFILE >> $mail_msg_file 2030 echo "on your system is old - 4390308 (s81_30) is required.\n" | \ 2031 tee -a $LOGFILE >> $mail_msg_file 2032 fi 2033 grep -l "$LDDWRONG" $SRC/runtime.out > /dev/null 2034 if [ $? -eq 0 ]; then 2035 echo "WARNING: wrong class message detected. ldd(1) was unable" | \ 2036 tee -a $LOGFILE >> $mail_msg_file 2037 echo "to execute an object, thus it could not be checked fully." | \ 2038 tee -a $LOGFILE >> $mail_msg_file 2039 echo "Perhaps a 64-bit object was encountered on a 32-bit system," | \ 2040 tee -a $LOGFILE >> $mail_msg_file 2041 echo "or an i386 object was encountered on a sparc system?\n" | \ 2042 tee -a $LOGFILE >> $mail_msg_file 2043 fi 2044 grep -l "$CRLECONF" $SRC/runtime.out > /dev/null 2045 if [ $? -eq 0 ]; then 2046 echo "WARNING: creation of an alternative dependency cache failed." | \ 2047 tee -a $LOGFILE >> $mail_msg_file 2048 echo "Dependencies will bind to the base system libraries.\n" | \ 2049 tee -a $LOGFILE >> $mail_msg_file 2050 grep "$CRLECONF" $SRC/runtime.out | \ 2051 tee -a $LOGFILE >> $mail_msg_file 2052 grep "$CRLERROR" $SRC/runtime.out | grep -v "$CRLECONF" | \ 2053 tee -a $LOGFILE >> $mail_msg_file 2054 echo "\n" | tee -a $LOGFILE >> $mail_msg_file 2055 fi 2056 2057 egrep '<dependency no longer necessary>' $SRC/runtime.out | \ 2058 tee -a $LOGFILE >> $mail_msg_file 2059 2060 # NEEDED= and RPATH= are informational; report anything else that we 2061 # haven't already. 2062 egrep -v "NEEDED=|RPATH=|$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 2063 $SRC/runtime.out | tee -a $LOGFILE >> $mail_msg_file 2064 2065 # probably should compare against a 'known ok runpaths' list 2066 if [ ! -f $SRC/runtime.ref ]; then 2067 egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 2068 $SRC/runtime.out > $SRC/runtime.ref 2069 fi 2070 2071 echo "\n==== Diff ELF runtime attributes (since last build) ====\n" \ 2072 >> $mail_msg_file 2073 2074 egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" $SRC/runtime.out | \ 2075 diff $SRC/runtime.ref - >> $mail_msg_file 2076fi 2077 2078# For now, don't make archives or packages for GPROF/TRACE builds 2079a_FLAG=n 2080p_FLAG=n 2081 2082# GPROF build begins 2083 2084if [ "$i_CMD_LINE_FLAG" = "n" -a "$P_FLAG" = "y" ]; then 2085 2086 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 2087 export RELEASE_BUILD ; RELEASE_BUILD= 2088 export EXTRA_OPTIONS ; EXTRA_OPTIONS="-DGPROF" 2089 export EXTRA_CFLAGS ; EXTRA_CFLAGS="-xpg" 2090 2091 build GPROF -prof 2092 2093else 2094 echo "\n==== No GPROF build ====\n" >> $LOGFILE 2095fi 2096 2097# GPROF build ends 2098 2099# TRACE build begins 2100 2101if [ "$i_CMD_LINE_FLAG" = "n" -a "$T_FLAG" = "y" ]; then 2102 2103 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 2104 export RELEASE_BUILD ; RELEASE_BUILD= 2105 export EXTRA_OPTIONS ; EXTRA_OPTIONS="-DTRACE" 2106 unset EXTRA_CFLAGS 2107 2108 build TRACE -trace 2109 2110else 2111 echo "\n==== No TRACE build ====\n" >> $LOGFILE 2112fi 2113 2114# TRACE build ends 2115 2116# DEBUG lint of kernel begins 2117 2118if [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 2119 if [ "$LINTDIRS" = "" ]; then 2120 # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y" 2121 LINTDIRS="$SRC y" 2122 fi 2123 set $LINTDIRS 2124 while [ $# -gt 0 ]; do 2125 dolint $1 $2; shift; shift 2126 done 2127else 2128 echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE 2129fi 2130 2131# "make check" begins 2132 2133if [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then 2134 # remove old check.out 2135 rm -f $SRC/check.out 2136 2137 rm -f $SRC/check-${MACH}.out 2138 cd $SRC 2139 $MAKE -ek check 2>&1 | tee -a $SRC/check-${MACH}.out >> $LOGFILE 2140 echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file 2141 2142 grep ":" $SRC/check-${MACH}.out | 2143 egrep -v "Ignoring unknown host" | \ 2144 sort | uniq >> $mail_msg_file 2145else 2146 echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE 2147fi 2148 2149echo "\n==== Find core files ====\n" | \ 2150 tee -a $LOGFILE >> $mail_msg_file 2151 2152find $SRC -name core -a -type f -exec file {} \; | \ 2153 tee -a $LOGFILE >> $mail_msg_file 2154 2155if [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 2156 echo "\n==== Diff unreferenced files (since last build) ====\n" \ 2157 | tee -a $LOGFILE >>$mail_msg_file 2158 rm -f $SRC/unref-${MACH}.ref 2159 if [ -f $SRC/unref-${MACH}.out ]; then 2160 mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 2161 fi 2162 2163 findunref $SRC ${TOOLS}/findunref/exception_list \ 2164 2>> $mail_msg_file | sort > $SRC/unref-${MACH}.out 2165 2166 if [ ! -f $SRC/unref-${MACH}.ref ]; then 2167 cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 2168 fi 2169 2170 diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file 2171fi 2172 2173# Verify that the usual lists of files, such as exception lists, 2174# contain only valid references to files. If the build has failed, 2175# then don't check the proto area. 2176CHECK_PATHS=${CHECK_PATHS:-y} 2177if [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then 2178 echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \ 2179 >>$mail_msg_file 2180 arg=-b 2181 [ "$build_ok" = y ] && arg= 2182 checkpaths $arg $ROOT 2>&1 | tee -a $LOGFILE >>$mail_msg_file 2183fi 2184 2185if [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then 2186 echo "\n==== Impact on file permissions ====\n" \ 2187 >> $mail_msg_file 2188 # 2189 # Get pkginfo files from usr/src/pkgdefs 2190 # 2191 pmodes -qvdP \ 2192 `for d in $SRC/pkgdefs; do 2193 if [ -d "$d" ] 2194 then 2195 find $d -name pkginfo.tmpl -print -o -name .del\* -prune 2196 fi 2197 done | sed -e 's:/pkginfo.tmpl$::' | sort -u ` >> $mail_msg_file 2198fi 2199 2200END_DATE=`date` 2201echo "==== Nightly $maketype build completed: $END_DATE ====" | \ 2202 tee -a $LOGFILE >> $build_time_file 2203 2204typeset -Z2 minutes 2205typeset -Z2 seconds 2206 2207elapsed_time=$SECONDS 2208((hours = elapsed_time / 3600 )) 2209((minutes = elapsed_time / 60 % 60)) 2210((seconds = elapsed_time % 60)) 2211 2212echo "\n==== Total build time ====" | \ 2213 tee -a $LOGFILE >> $build_time_file 2214echo "\nreal ${hours}:${minutes}:${seconds}" | \ 2215 tee -a $LOGFILE >> $build_time_file 2216 2217if [ "$u_FLAG" = "y" -a "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 2218 staffer cp ${SRC}/unref-${MACH}.out $PARENT_WS/usr/src/ 2219 2220 # 2221 # Produce a master list of unreferenced files -- ideally, we'd 2222 # generate the master just once after all of the nightlies 2223 # have finished, but there's no simple way to know when that 2224 # will be. Instead, we assume that we're the last nightly to 2225 # finish and merge all of the unref-${MACH}.out files in 2226 # $PARENT_WS/usr/src/. If we are in fact the final ${MACH} to 2227 # finish, then this file will be the authoritative master 2228 # list. Otherwise, another ${MACH}'s nightly will eventually 2229 # overwrite ours with its own master, but in the meantime our 2230 # temporary "master" will be no worse than any older master 2231 # which was already on the parent. 2232 # 2233 2234 set -- $PARENT_WS/usr/src/unref-*.out 2235 cp "$1" ${TMPDIR}/unref.merge 2236 shift 2237 2238 for unreffile; do 2239 comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$ 2240 mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge 2241 done 2242 2243 staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out 2244fi 2245 2246# 2247# All done save for the sweeping up. 2248# (whichever exit we hit here will trigger the "cleanup" trap which 2249# optionally sends mail on completion). 2250# 2251if [ "$build_ok" = "y" ]; then 2252 exit 0 2253fi 2254exit 1 2255