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# Note: changes to the option letters here should also be applied to the 1017# bldenv script. 1018# 1019OPTIND=1 1020while getopts ABDFNMPTCGIRafinlmoptuUxdrtzWS:X FLAG $NIGHTLY_OPTIONS 1021do 1022 case $FLAG in 1023 A ) A_FLAG=y 1024 ;; 1025 B ) D_FLAG=y 1026 ;; # old version of D 1027 F ) F_FLAG=y 1028 ;; 1029 D ) D_FLAG=y 1030 ;; 1031 P ) P_FLAG=y 1032 ;; 1033 T ) T_FLAG=y 1034 ;; 1035 C ) C_FLAG=y 1036 ;; 1037 M ) M_FLAG=y 1038 ;; 1039 N ) N_FLAG=y 1040 ;; 1041 G ) a_FLAG=y 1042 u_FLAG=y 1043 ;; 1044 I ) a_FLAG=y 1045 m_FLAG=y 1046 p_FLAG=y 1047 u_FLAG=y 1048 ;; 1049 R ) m_FLAG=y 1050 p_FLAG=y 1051 ;; 1052 a ) a_FLAG=y 1053 ;; 1054 d ) d_FLAG=y 1055 ;; 1056 f ) f_FLAG=y 1057 ;; 1058 i ) i_FLAG=y 1059 ;; 1060 n ) n_FLAG=y 1061 ;; 1062 o ) o_FLAG=y 1063 ;; 1064 l ) l_FLAG=y 1065 ;; 1066 m ) m_FLAG=y 1067 ;; 1068 p ) p_FLAG=y 1069 ;; 1070 r ) r_FLAG=y 1071 ;; 1072 t ) t_FLAG=y 1073 ;; 1074 u ) u_FLAG=y 1075 ;; 1076 z ) z_FLAG=y 1077 ;; 1078 U ) 1079 if [ -z "${PARENT_ROOT}" ]; then 1080 echo "PARENT_ROOT must be set if the U flag is" \ 1081 "present in NIGHTLY_OPTIONS." 1082 exit 1 1083 fi 1084 U_FLAG=y 1085 NIGHTLY_PARENT_ROOT=$PARENT_ROOT 1086 ;; 1087 x ) XMOD_OPT="-x" 1088 ;; 1089 W ) W_FLAG=y 1090 ;; 1091 S ) 1092 if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 1093 echo "Can only build one source variant at a time." 1094 exit 1 1095 fi 1096 if [ "${OPTARG}" = "E" ]; then 1097 SE_FLAG=y 1098 elif [ "${OPTARG}" = "D" ]; then 1099 SD_FLAG=y 1100 elif [ "${OPTARG}" = "H" ]; then 1101 SH_FLAG=y 1102 else 1103 echo "$USAGE" 1104 exit 1 1105 fi 1106 ;; 1107 X ) # now that we no longer need realmode builds, just 1108 # copy IHV packages. only meaningful on x86. 1109 if [ "$MACH" = "i386" ]; then 1110 X_FLAG=y 1111 fi 1112 ;; 1113 \? ) echo "$USAGE" 1114 exit 1 1115 ;; 1116 esac 1117done 1118 1119if [ $ISUSER -ne 0 ]; then 1120 if [ "$o_FLAG" = "y" ]; then 1121 echo "Old-style build requires root permission." 1122 exit 1 1123 fi 1124 1125 # Set default value for STAFFER, if needed. 1126 if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then 1127 STAFFER=`/usr/xpg4/bin/id -un` 1128 export STAFFER 1129 fi 1130fi 1131 1132if [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then 1133 MAILTO=$STAFFER 1134 export MAILTO 1135fi 1136 1137PATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin" 1138PATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb" 1139PATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:." 1140export PATH 1141 1142unset CH 1143if [ "$o_FLAG" = "y" ]; then 1144# root invoked old-style build -- make sure it works as it always has 1145# by exporting 'CH'. The current Makefile.master doesn't use this, but 1146# the old ones still do. 1147 PROTOCMPTERSE="protocmp.terse" 1148 CH= 1149 export CH 1150else 1151 PROTOCMPTERSE="protocmp.terse -gu" 1152fi 1153POUND_SIGN="#" 1154DEF_STRIPFLAG="-s" 1155 1156# we export POUND_SIGN to speed up the build process -- prevents evaluation of 1157# the Makefile.master definitions. 1158# we export DEF_STRIPFLAG to strip debug data from nightly builds; the default 1159# behavior is to include all debug data. 1160export o_FLAG POUND_SIGN DEF_STRIPFLAG 1161 1162if [ "$d_FLAG" = "y" ]; then 1163 maketype="distributed" 1164 MAKE=dmake 1165 # get the dmake version string alone 1166 DMAKE_VERSION=$( $MAKE -v ) 1167 DMAKE_VERSION=${DMAKE_VERSION#*: } 1168 # focus in on just the dotted version number alone 1169 DMAKE_MAJOR=$( echo $DMAKE_VERSION | \ 1170 sed -e 's/.*\<\([^.]*\.[^ ]*\).*$/\1/' ) 1171 # extract the second (or final) integer 1172 DMAKE_MINOR=${DMAKE_MAJOR#*.} 1173 DMAKE_MINOR=${DMAKE_MINOR%%.*} 1174 # extract the first integer 1175 DMAKE_MAJOR=${DMAKE_MAJOR%%.*} 1176 CHECK_DMAKE=${CHECK_DMAKE:-y} 1177 # x86 was built on the 12th, sparc on the 13th. 1178 if [ "$CHECK_DMAKE" = "y" -a \ 1179 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \ 1180 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \( \ 1181 "$DMAKE_MAJOR" -lt 7 -o \ 1182 "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \) ]; then 1183 if [ -z "$DMAKE_VERSION" ]; then 1184 echo "$MAKE is missing." 1185 exit 1 1186 fi 1187 echo `whence $MAKE`" version is:" 1188 echo " ${DMAKE_VERSION}" 1189 cat <<EOF 1190 1191This version may not be safe for use. Either set TEAMWARE to a better 1192path or (if you really want to use this version of dmake anyway), add 1193the following to your environment to disable this check: 1194 1195 CHECK_DMAKE=n 1196EOF 1197 exit 1 1198 fi 1199else 1200 PATH="$TEAMWARE/ParallelMake/bin:$PATH" 1201 maketype="parallel" 1202 MAKE=make 1203fi 1204export PATH 1205export MAKE 1206 1207if [ "${SUNWSPRO}" != "" ]; then 1208 PATH="${SUNWSPRO}/bin:$PATH" 1209 export PATH 1210fi 1211 1212hostname=`uname -n` 1213if [ ! -f $HOME/.make.machines ]; then 1214 DMAKE_MAX_JOBS=4 1215else 1216 DMAKE_MAX_JOBS="`grep $hostname $HOME/.make.machines | \ 1217 tail -1 | awk -F= '{print $ 2;}'`" 1218 if [ "$DMAKE_MAX_JOBS" = "" ]; then 1219 DMAKE_MAX_JOBS=4 1220 fi 1221fi 1222DMAKE_MODE=parallel; 1223export DMAKE_MODE 1224export DMAKE_MAX_JOBS 1225 1226if [ -z "${ROOT}" ]; then 1227 echo "ROOT must be set." 1228 exit 1 1229fi 1230 1231if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" ]; then 1232 if [ -z "${EXPORT_SRC}" ]; then 1233 echo "EXPORT_SRC must be set for a source build." 1234 exit 1 1235 fi 1236 if [ -z "${CRYPT_SRC}" ]; then 1237 echo "CRYPT_SRC must be set for a source build." 1238 exit 1 1239 fi 1240fi 1241 1242if [ "$SH_FLAG" = "y" ]; then 1243 if [ -z "${EXPORT_SRC}" ]; then 1244 echo "EXPORT_SRC must be set for a source build." 1245 exit 1 1246 fi 1247fi 1248 1249# 1250# if -V flag was given, reset VERSION to V_ARG 1251# 1252if [ "$V_FLAG" = "y" ]; then 1253 VERSION=$V_ARG 1254fi 1255 1256# Append source version 1257if [ "$SE_FLAG" = "y" ]; then 1258 VERSION="${VERSION}:EXPORT" 1259fi 1260 1261if [ "$SD_FLAG" = "y" ]; then 1262 VERSION="${VERSION}:DOMESTIC" 1263fi 1264 1265if [ "$SH_FLAG" = "y" ]; then 1266 VERSION="${VERSION}:MODIFIED_SOURCE_PRODUCT" 1267fi 1268 1269TMPDIR="/tmp/nightly.tmpdir.$$" 1270export TMPDIR 1271rm -rf ${TMPDIR} 1272mkdir -p $TMPDIR || exit 1 1273 1274# 1275# Keep elfsign's use of pkcs11_softtoken from looking in the user home 1276# directory, which doesn't always work. Needed until all build machines 1277# have the fix for 6271754 1278# 1279SOFTTOKEN_DIR=$TMPDIR 1280export SOFTTOKEN_DIR 1281 1282TOOLS=${SRC}/tools 1283TOOLS_PROTO=${TOOLS}/proto 1284 1285unset CFLAGS LD_LIBRARY_PATH LDFLAGS 1286 1287# create directories that are automatically removed if the nightly script 1288# fails to start correctly 1289newdir() { 1290 dir=$1 1291 toadd= 1292 while [ ! -d $dir ]; do 1293 toadd="$dir $toadd" 1294 dir=`dirname $dir` 1295 done 1296 torm= 1297 newlist= 1298 for dir in $toadd; do 1299 if staffer mkdir $dir; then 1300 newlist="$ISUSER $dir $newlist" 1301 torm="$dir $torm" 1302 else 1303 [ -z "$torm" ] || staffer rmdir $torm 1304 return 1 1305 fi 1306 done 1307 newdirlist="$newlist $newdirlist" 1308 return 0 1309} 1310newdirlist= 1311 1312[ -d $CODEMGR_WS ] || newdir $CODEMGR_WS || exit 1 1313 1314# since this script assumes the build is from full source, it nullifies 1315# variables likely to have been set by a "ws" script; nullification 1316# confines the search space for headers and libraries to the proto area 1317# built from this immediate source. 1318ENVLDLIBS1= 1319ENVLDLIBS2= 1320ENVLDLIBS3= 1321ENVCPPFLAGS1= 1322ENVCPPFLAGS2= 1323ENVCPPFLAGS3= 1324ENVCPPFLAGS4= 1325PARENT_ROOT= 1326 1327export ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \ 1328 PARENT_ROOT 1329 1330ENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib" 1331ENVCPPFLAGS1="-I$ROOT/usr/include" 1332 1333export ENVLDLIBS1 ENVLDLIBS2 1334 1335CPIODIR_ORIG=$CPIODIR 1336PKGARCHIVE_ORIG=$PKGARCHIVE 1337IA32_IHV_PKGS_ORIG=$IA32_IHV_PKGS 1338if [ "$SPARC_RM_PKGARCHIVE" ]; then 1339 SPARC_RM_PKGARCHIVE_ORIG=$SPARC_RM_PKGARCHIVE 1340fi 1341 1342# 1343# Juggle the logs and optionally send mail on completion. 1344# 1345 1346logshuffle() { 1347 LLOG="$ATLOG/log.`date '+%m%d'`" 1348 rm -rf $ATLOG/log.??`date '+%d'` 1349 if [ -f $LLOG -o -d $LLOG ]; then 1350 LLOG=$LLOG.$$ 1351 fi 1352 mkdir $LLOG 1353 1354 if [ "$build_ok" = "y" ]; then 1355 mv $ATLOG/proto_list_${MACH} $LLOG 1356 fi 1357 1358 # 1359 # Now that we're about to send mail, it's time to check the noise 1360 # file. In the event that an error occurs beyond this point, it will 1361 # be recorded in the nightly.log file, but nowhere else. This would 1362 # include only errors that cause the copying of the noise log to fail 1363 # or the mail itself not to be sent. 1364 # 1365 1366 exec >>$LOGFILE 2>&1 1367 if [ -s $build_noise_file ]; then 1368 echo "\n==== Nightly build noise ====\n" | 1369 tee -a $LOGFILE >>$mail_msg_file 1370 cat $build_noise_file >>$LOGFILE 1371 cat $build_noise_file >>$mail_msg_file 1372 echo | tee -a $LOGFILE >>$mail_msg_file 1373 fi 1374 rm -f $build_noise_file 1375 1376 case "$build_ok" in 1377 y) 1378 state=Completed 1379 ;; 1380 i) 1381 state=Interrupted 1382 ;; 1383 *) 1384 state=Failed 1385 ;; 1386 esac 1387 1388 cat $build_time_file $mail_msg_file > ${LLOG}/mail_msg 1389 if [ "$m_FLAG" = "y" ]; then 1390 cat $build_time_file $mail_msg_file | 1391 /usr/bin/mailx -s \ 1392 "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \ 1393 ${MAILTO} 1394 fi 1395 1396 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 1397 staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH} 1398 staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log 1399 fi 1400 1401 mv $LOGFILE $LLOG 1402} 1403 1404# 1405# Remove the locks and temporary files on any exit 1406# 1407cleanup() { 1408 logshuffle 1409 1410 [ -z "$lockfile" ] || staffer rm -f $lockfile 1411 [ -z "$atloglockfile" ] || rm -f $atloglockfile 1412 [ -z "$ulockfile" ] || staffer rm -f $ulockfile 1413 [ -z "$Ulockfile" ] || rm -f $Ulockfile 1414 1415 set -- $newdirlist 1416 while [ $# -gt 0 ]; do 1417 ISUSER=$1 staffer rmdir $2 1418 shift; shift 1419 done 1420 rm -rf $TMPDIR 1421} 1422 1423cleanup_signal() { 1424 build_ok=i 1425 # this will trigger cleanup(), above. 1426 exit 1 1427} 1428 1429trap cleanup 0 1430trap cleanup_signal 1 2 3 15 1431 1432# 1433# Generic lock file processing -- make sure that the lock file doesn't 1434# exist. If it does, it should name the build host and PID. If it 1435# doesn't, then make sure we can create it. Clean up locks that are 1436# known to be stale (assumes host name is unique among build systems 1437# for the workspace). 1438create_lock() { 1439 lockf=$1 1440 lockvar=$2 1441 if [ -f $lockf ]; then 1442 basews=`basename $CODEMGR_WS` 1443 if read host user pid < $lockf; then 1444 if [ "$host" != "$hostname" ]; then 1445 echo "$MACH build of $basews apparently" \ 1446 "already started by $user on $host as $pid." 1447 elif kill -s 0 $pid 2>/dev/null; then 1448 echo "$MACH build of $basews already started" \ 1449 "by $user as $pid." 1450 else 1451 # stale lock; clear it out and continue 1452 rm -f $lockf 1453 fi 1454 else 1455 echo "$MACH build of $basews already running." 1456 fi 1457 fi 1458 if [ -f $lockf ]; then 1459 echo "Lock file is $lockf." 1460 exit 1 1461 fi 1462 ldir=`dirname $lockf` 1463 [ -d $ldir ] || newdir $ldir || exit 1 1464 eval $lockvar=$lockf 1465 staffer sh -c "echo $hostname $STAFFER $$ > $lockf" || exit 1 1466} 1467 1468# Ensure no other instance of this script is running on this host. 1469# LOCKNAME can be set in <env_file>, and is by default, but is not 1470# required due to the use of $ATLOG below. 1471if [ -n "$LOCKNAME" ]; then 1472 create_lock /tmp/$LOCKNAME "lockfile" 1473fi 1474# 1475# Create from one, two, or three other locks: 1476# $ATLOG/nightly.lock 1477# - protects against multiple builds in same workspace 1478# $PARENT_WS/usr/src/nightly.$MACH.lock 1479# - protects against multiple 'u' copy-backs 1480# $NIGHTLY_PARENT_ROOT/nightly.lock 1481# - protects against multiple 'U' copy-backs 1482# 1483# Overriding ISUSER to 1 causes the lock to be created as root if the 1484# script is run as root. The default is to create it as $STAFFER. 1485ISUSER=1 create_lock $ATLOG/nightly.lock "atloglockfile" 1486if [ "$u_FLAG" = "y" ]; then 1487 create_lock $PARENT_WS/usr/src/nightly.$MACH.lock "ulockfile" 1488fi 1489if [ "$U_FLAG" = "y" ]; then 1490 # NIGHTLY_PARENT_ROOT is written as root if script invoked as root. 1491 ISUSER=1 create_lock $NIGHTLY_PARENT_ROOT/nightly.lock "Ulockfile" 1492fi 1493 1494# Locks have been taken, so we're doing a build and we're committed to 1495# the directories we may have created so far. 1496newdirlist= 1497 1498# 1499# Create mail_msg_file 1500# 1501mail_msg_file="${TMPDIR}/mail_msg" 1502touch $mail_msg_file 1503build_time_file="${TMPDIR}/build_time" 1504# 1505# Move old LOGFILE aside 1506# ATLOG directory already made by 'create_lock' above 1507# 1508if [ -f $LOGFILE ]; then 1509 mv -f $LOGFILE ${LOGFILE}- 1510fi 1511# 1512# Build OsNet source 1513# 1514START_DATE=`date` 1515SECONDS=0 1516echo "\n==== Nightly $maketype build started: $START_DATE ====" \ 1517 | tee -a $LOGFILE > $build_time_file 1518 1519# make sure we log only to the nightly build file 1520build_noise_file="${TMPDIR}/build_noise" 1521exec </dev/null >$build_noise_file 2>&1 1522 1523echo "\n==== list of environment variables ====\n" >> $LOGFILE 1524env >> $LOGFILE 1525 1526echo "\n==== Nightly argument issues ====\n" | tee -a $mail_msg_file >> $LOGFILE 1527 1528if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 1529 if [ "$i_FLAG" = "y" -o "$i_CMD_LINE_FLAG" = "y" ]; then 1530 echo "WARNING: the -S flags do not support incremental" \ 1531 "builds; forcing clobber\n" | tee -a $mail_msg_file >> $LOGFILE 1532 i_FLAG=n 1533 i_CMD_LINE_FLAG=n 1534 fi 1535 if [ "$N_FLAG" = "n" ]; then 1536 echo "WARNING: the -S flags do not support protocmp;" \ 1537 "protocmp disabled\n" | \ 1538 tee -a $mail_msg_file >> $LOGFILE 1539 N_FLAG=y 1540 fi 1541 if [ "$l_FLAG" = "y" ]; then 1542 echo "WARNING: the -S flags do not support lint;" \ 1543 "lint disabled\n" | tee -a $mail_msg_file >> $LOGFILE 1544 l_FLAG=n 1545 fi 1546 if [ "$C_FLAG" = "y" ]; then 1547 echo "WARNING: the -S flags do not support cstyle;" \ 1548 "cstyle check disabled\n" | tee -a $mail_msg_file >> $LOGFILE 1549 C_FLAG=n 1550 fi 1551else 1552 if [ "$N_FLAG" = "y" ]; then 1553 if [ "$p_FLAG" = "y" ]; then 1554 cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 1555WARNING: the p option (create packages) is set, but so is the N option (do 1556 not run protocmp); this is dangerous; you should unset the N option 1557EOF 1558 else 1559 cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 1560Warning: the N option (do not run protocmp) is set; it probably shouldn't be 1561EOF 1562 fi 1563 echo "" | tee -a $mail_msg_file >> $LOGFILE 1564 fi 1565fi 1566 1567if [ "$a_FLAG" = "y" -a "$D_FLAG" = "n" -a "$F_FLAG" = "y" ]; then 1568 echo "WARNING: Neither DEBUG nor non-DEBUG build requested, but the" \ 1569 "'a' option was set." | tee -a $mail_msg_file >> $LOGFILE 1570fi 1571 1572if [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 1573 echo "WARNING: DEBUG build not requested, but lint will be with" \ 1574 "DEBUG enabled.\n" \ 1575 | tee -a $mail_msg_file >> $LOGFILE 1576fi 1577 1578if [ "$f_FLAG" = "y" ]; then 1579 if [ "$i_FLAG" = "y" ]; then 1580 echo "WARNING: the -f flag cannot be used during incremental" \ 1581 "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE 1582 f_FLAG=n 1583 fi 1584 if [ "$p_FLAG" != "y" -o "$l_FLAG" != "y" ]; then 1585 echo "WARNING: the -f flag requires -l and -p; ignoring -f\n" | \ 1586 tee -a $mail_msg_file >> $LOGFILE 1587 f_FLAG=n 1588 fi 1589fi 1590 1591if [ "$T_FLAG" = "y" -a -d $SRC/uts/common/dtrace ]; then 1592 echo "WARNING: TRACE build requested but workspace contains DTrace;" \ 1593 "-T will have no effect\n" | tee -a $mail_msg_file >> $LOGFILE 1594fi 1595 1596if [ "$t_FLAG" = "n" ]; then 1597 # 1598 # We're not doing a tools build, so make sure elfsign(1) is 1599 # new enough to safely sign non-crypto binaries. We test 1600 # debugging output from elfsign to detect the old version. 1601 # 1602 newelfsigntest=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \ 1603 -e /usr/lib/security/pkcs11_softtoken.so.1 2>&1 \ 1604 | egrep algorithmOID` 1605 if [ -z "$newelfsigntest" ]; then 1606 echo "WARNING: /usr/bin/elfsign out of date;" \ 1607 "will only sign crypto modules\n" | \ 1608 tee -a $mail_msg_file >> $LOGFILE 1609 export ELFSIGN_OBJECT=true 1610 elif [ "$VERIFY_ELFSIGN" = "y" ]; then 1611 echo "WARNING: VERIFY_ELFSIGN=y requires" \ 1612 "the -t flag; ignoring VERIFY_ELFSIGN\n" | \ 1613 tee -a $mail_msg_file >> $LOGFILE 1614 fi 1615fi 1616 1617echo "==== Build environment ====\n" | tee -a $mail_msg_file >> $LOGFILE 1618 1619# System 1620whence uname | tee -a $mail_msg_file >> $LOGFILE 1621uname -a 2>&1 | tee -a $mail_msg_file >> $LOGFILE 1622echo | tee -a $mail_msg_file >> $LOGFILE 1623 1624# nightly (will fail in year 2100 due to SCCS flaw) 1625echo "$0 $@" | tee -a $mail_msg_file >> $LOGFILE 1626echo "%M% version %I% 20%E%\n" | tee -a $mail_msg_file >> $LOGFILE 1627 1628# make 1629whence $MAKE | tee -a $mail_msg_file >> $LOGFILE 1630if [ "$d_FLAG" = "y" ]; then 1631 $MAKE -v | tee -a $mail_msg_file >> $LOGFILE 1632fi 1633echo "number of concurrent jobs = $DMAKE_MAX_JOBS" | 1634 tee -a $mail_msg_file >> $LOGFILE 1635 1636# 1637# Report the compiler versions. 1638# 1639if [ -f $SRC/Makefile ]; then 1640 srcroot=$SRC 1641elif [ -f $BRINGOVER_WS/usr/src/Makefile ]; then 1642 srcroot=$BRINGOVER_WS/usr/src 1643else 1644 echo "\nUnable to find \"Makefile\" in $BRINGOVER_WS/usr/src or $SRC." | 1645 tee -a $mail_msg_file >> $LOGFILE 1646 exit 1 1647fi 1648 1649( cd $srcroot 1650 for target in cc-version cc64-version java-version; do 1651 echo 1652 # 1653 # Put statefile somewhere we know we can write to rather than trip 1654 # over a read-only $srcroot. Use /usr/ccs/bin/make here because 1655 # it supports -K and ParallelMake doesn't. 1656 # 1657 rm -f $TMPDIR/make-state 1658 if /usr/ccs/bin/make -K $TMPDIR/make-state -e $target 2>/dev/null; then 1659 continue 1660 fi 1661 touch $TMPDIR/nocompiler 1662 done 1663 echo 1664) | tee -a $mail_msg_file >> $LOGFILE 1665 1666if [ -f $TMPDIR/nocompiler ]; then 1667 rm -f $TMPDIR/nocompiler 1668 build_ok=n 1669 echo "Aborting due to missing compiler." | 1670 tee -a $mail_msg_file >> $LOGFILE 1671 exit 1 1672fi 1673 1674# as 1675whence as | tee -a $mail_msg_file >> $LOGFILE 1676as -V 2>&1 | head -1 | tee -a $mail_msg_file >> $LOGFILE 1677echo | tee -a $mail_msg_file >> $LOGFILE 1678 1679# Check that we're running a capable link-editor 1680whence ld | tee -a $mail_msg_file >> $LOGFILE 1681LDVER=`ld -V 2>&1` 1682echo $LDVER | tee -a $mail_msg_file >> $LOGFILE 1683LDVER=`echo $LDVER | sed -e "s/.*-1\.//" -e "s/:.*//"` 1684if [ `expr $LDVER \< 422` -eq 1 ]; then 1685 echo "The link-editor needs to be at version 422 or higher to build" | \ 1686 tee -a $mail_msg_file >> $LOGFILE 1687 echo "the latest stuff, hope your build works." | \ 1688 tee -a $mail_msg_file >> $LOGFILE 1689fi 1690 1691echo "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \ 1692 tee -a $mail_msg_file >> $LOGFILE 1693 1694echo "\n==== Build version ====\n" | tee -a $mail_msg_file >> $LOGFILE 1695echo $VERSION | tee -a $mail_msg_file >> $LOGFILE 1696 1697# 1698# Decide whether to clobber 1699# 1700if [ "$i_FLAG" = "n" -a -d "$SRC" ]; then 1701 echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE 1702 1703 cd $SRC 1704 # remove old clobber file 1705 rm -f $SRC/clobber.out 1706 rm -f $SRC/clobber-${MACH}.out 1707 1708 # Remove all .make.state* files, just in case we are restarting 1709 # the build after having interrupted a previous 'make clobber'. 1710 find . \( -name SCCS -o -name 'interfaces.*' \) -prune \ 1711 -o -name '.make.*' -print | xargs rm -f 1712 1713 $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE 1714 echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file 1715 grep "$MAKE:" $SRC/clobber-${MACH}.out | 1716 egrep -v "Ignoring unknown host" \ 1717 >> $mail_msg_file 1718 1719 if [ "$t_FLAG" = "y" ]; then 1720 echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE 1721 cd ${TOOLS} 1722 rm -f ${TOOLS}/clobber-${MACH}.out 1723 $MAKE -ek clobber 2>&1 | \ 1724 tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE 1725 echo "\n==== Make tools clobber ERRORS ====\n" \ 1726 >> $mail_msg_file 1727 grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \ 1728 >> $mail_msg_file 1729 rm -rf ${TOOLS_PROTO} 1730 mkdir -p ${TOOLS_PROTO} 1731 fi 1732 rm -rf $ROOT 1733 1734 # Get back to a clean workspace as much as possible to catch 1735 # problems that only occur on fresh workspaces. 1736 # Remove all .make.state* files, libraries, and .o's that may 1737 # have been ommitted from clobber. 1738 # We should probably blow away temporary directories too. 1739 cd $SRC 1740 find . \( -name SCCS -o -name 'interfaces.*' \) -prune -o \ 1741 \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \ 1742 -name '*.o' \) -print | xargs rm -f 1743else 1744 echo "\n==== No clobber at `date` ====\n" >> $LOGFILE 1745fi 1746 1747# 1748# Decide whether to bringover to the codemgr workspace 1749# 1750if [ "$n_FLAG" = "n" ]; then 1751 echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE 1752 # sleep on the parent workspace's lock 1753 while egrep -s write $BRINGOVER_WS/Codemgr_wsdata/locks 1754 do 1755 sleep 120 1756 done 1757 1758 echo "\n==== BRINGOVER LOG ====\n" >> $mail_msg_file 1759 staffer $TEAMWARE/bin/bringover -c "nightly update" -p $BRINGOVER_WS \ 1760 -w $CODEMGR_WS usr/src < /dev/null 2>&1 | \ 1761 tee -a $mail_msg_file >> $LOGFILE 1762 if [ $? -eq 1 ] 1763 then 1764 echo "trouble with bringover, quitting at `date`." >> $LOGFILE 1765 exit 1 1766 fi 1767 if [ -d $SRC/cmd/lp/cmd/lpsched/lpsched -a \ 1768 ! -f $SRC/cmd/lp/cmd/lpsched/lpsched/Makefile ]; then 1769 # on297 printing 1770 rm -rf $SRC/cmd/lp/cmd/lpsched/lpsched 1771 fi 1772 if [ -d $SRC/cmd/localedef/localedef -a \ 1773 ! -f $SRC/cmd/localedef/localedef/Makefile ]; then 1774 # on297 CSI project 1775 rm -rf $SRC/cmd/localedef/localedef 1776 fi 1777else 1778 echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE 1779fi 1780 1781# 1782# Build tools if requested 1783# 1784if [ "$t_FLAG" = "y" ]; then 1785 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 1786 export RELEASE_BUILD ; RELEASE_BUILD= 1787 unset EXTRA_OPTIONS 1788 unset EXTRA_CFLAGS 1789 1790 export ONBLD_TOOLS=${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld} 1791 build_tools ${TOOLS_PROTO} 1792fi 1793 1794if [ "$i_FLAG" = "y" -a "$SH_FLAG" = "y" ]; then 1795 echo "\n==== NOT Building base OS-Net source ====\n" | \ 1796 tee -a $LOGFILE >> $mail_msg_file 1797else 1798 normal_build 1799fi 1800 1801ORIG_SRC=$SRC 1802BINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z 1803 1804if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 1805 save_binaries 1806 1807 echo "\n==== Retrieving SCCS files at `date` ====\n" >> $LOGFILE 1808 SCCSHELPER=${TMPDIR}/sccs-helper 1809 rm -f ${SCCSHELPER} 1810cat >${SCCSHELPER} <<EOF 1811#!/bin/ksh 1812cd \$1 1813cd .. 1814sccs get SCCS >/dev/null 2>&1 1815EOF 1816 cd $SRC 1817 chmod +x ${SCCSHELPER} 1818 find . -name SCCS | xargs -L 1 ${SCCSHELPER} 1819 rm -f ${SCCSHELPER} 1820fi 1821 1822if [ "$SD_FLAG" = "y" ]; then 1823 clone_source ${CODEMGR_WS} ${CRYPT_SRC} CRYPT_SRC 1824fi 1825 1826# EXPORT_SRC comes after CRYPT_SRC since a domestic build will need 1827# $SRC pointing to the export_source usr/src. 1828if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 1829 clone_source ${CODEMGR_WS} ${EXPORT_SRC} EXPORT_SRC 1830fi 1831 1832if [ "$SD_FLAG" = "y" ]; then 1833 # drop the crypt files in place. 1834 cd ${EXPORT_SRC} 1835 echo "\nextracting crypt_files.cpio.Z onto export_source.\n" \ 1836 >> ${LOGFILE} 1837 zcat ${CODEMGR_WS}/crypt_files.cpio.Z | \ 1838 cpio -idmucvB 2>/dev/null >> ${LOGFILE} 1839 if [ "$?" = "0" ]; then 1840 echo "\n==== DOMESTIC extraction succeeded ====\n" \ 1841 >> $mail_msg_file 1842 else 1843 echo "\n==== DOMESTIC extraction failed ====\n" \ 1844 >> $mail_msg_file 1845 fi 1846 1847fi 1848 1849if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 1850 # remove proto area here, since we don't clobber 1851 rm -rf "$ROOT" 1852 if [ "$t_FLAG" = "y" ]; then 1853 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 1854 export RELEASE_BUILD ; RELEASE_BUILD= 1855 unset EXTRA_OPTIONS 1856 unset EXTRA_CFLAGS 1857 1858 build_tools ${EXPORT_SRC}/usr/src/tools/proto 1859 fi 1860 1861 export EXPORT_RELEASE_BUILD ; EXPORT_RELEASE_BUILD=# 1862 normal_build 1863fi 1864 1865if [ "$build_ok" = "y" ]; then 1866 echo "\n==== Creating protolist system file at `date` ====" \ 1867 >> $LOGFILE 1868 protolist $ROOT > $ATLOG/proto_list_${MACH} 1869 echo "==== protolist system file created at `date` ====\n" \ 1870 >> $LOGFILE 1871 1872 if [ "$N_FLAG" != "y" ]; then 1873 echo "\n==== Impact on packages ====\n" >> $mail_msg_file 1874 1875 # If there is a reference proto list, compare the build's proto 1876 # list with the reference to see changes in proto areas. 1877 # Use the current exception list. 1878 exc=etc/exception_list_$MACH 1879 if [ -f $SRC/pkgdefs/$exc ]; then 1880 ELIST="-e $SRC/pkgdefs/$exc" 1881 fi 1882 1883 if [ -f "$REF_PROTO_LIST" ]; then 1884 $PROTOCMPTERSE \ 1885 "Files in yesterday's proto area, but not today's:" \ 1886 "Files in today's proto area, but not yesterday's:" \ 1887 "Files that changed between yesterday and today:" \ 1888 ${ELIST} \ 1889 -d $REF_PROTO_LIST \ 1890 $ATLOG/proto_list_${MACH} \ 1891 >> $mail_msg_file 1892 fi 1893 # Compare the build's proto list with current package 1894 # definitions to audit the quality of package definitions 1895 # and makefile install targets. Use the current exception list. 1896 PKGDEFS_LIST="-d $SRC/pkgdefs" 1897 1898 $PROTOCMPTERSE \ 1899 "Files missing from the proto area:" \ 1900 "Files missing from packages:" \ 1901 "Inconsistencies between pkgdefs and proto area:" \ 1902 ${ELIST} \ 1903 ${PKGDEFS_LIST} \ 1904 $ATLOG/proto_list_${MACH} \ 1905 >> $mail_msg_file 1906 fi 1907fi 1908 1909if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 1910 staffer cp $ATLOG/proto_list_${MACH} \ 1911 $PARENT_WS/usr/src/proto_list_${MACH} 1912fi 1913 1914# Update parent proto area if necessary. This is done now 1915# so that the proto area has either DEBUG or non-DEBUG kernels. 1916# Note that this clears out the lock file, so we can dispense with 1917# the variable now. 1918if [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then 1919 echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \ 1920 tee -a $LOGFILE >> $mail_msg_file 1921 # The rm -rf command below produces predictable errors if 1922 # nightly is invoked from the parent's $ROOT/opt/onbld/bin, 1923 # and that directory is accessed via NFS. This is because 1924 # deleted-but-still-open files don't actually disappear as 1925 # expected, but rather turn into .nfsXXXX junk files, leaving 1926 # the directory non-empty. Since this is a not-unusual usage 1927 # pattern, and we still want to catch other errors here, we 1928 # take the unusal step of moving aside 'nightly' from that 1929 # directory (if we're using it). 1930 mypath=${0##*/root_$MACH/} 1931 if [ "$mypath" = $0 ]; then 1932 mypath=opt/onbld/bin/${0##*/} 1933 fi 1934 if [ $0 -ef $PARENT_WS/proto/root_$MACH/$mypath ]; then 1935 mv -f $0 $PARENT_WS/proto/root_$MACH 1936 fi 1937 rm -rf $PARENT_WS/proto/root_$MACH/* 1938 unset Ulockfile 1939 mkdir -p $NIGHTLY_PARENT_ROOT 1940 cd $ROOT 1941 ( tar cf - . | ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf - ) ) 2>&1 | 1942 tee -a $mail_msg_file >> $LOGFILE 1943fi 1944 1945# 1946# do shared library interface verification 1947# 1948 1949if [ "$A_FLAG" = "y" -a "$build_ok" = "y" ]; then 1950 echo "\n==== Check versioning and ABI information ====\n" | \ 1951 tee -a $LOGFILE >> $mail_msg_file 1952 1953 rm -rf $SRC/interfaces.ref 1954 if [ -d $SRC/interfaces.out ]; then 1955 mv $SRC/interfaces.out $SRC/interfaces.ref 1956 fi 1957 rm -rf $SRC/interfaces.out 1958 mkdir -p $SRC/interfaces.out 1959 1960 intf_check -V -m -o -b $SRC/tools/abi/etc \ 1961 -d $SRC/interfaces.out $ROOT 2>&1 | sort \ 1962 > $SRC/interfaces.out/log 1963 1964 # report any ERROR found in log file 1965 fgrep 'ERROR' $SRC/interfaces.out/log | sed 's/^ERROR: //' | \ 1966 tee -a $LOGFILE >> $mail_msg_file 1967 1968 if [ ! -d $SRC/interfaces.ref ] ; then 1969 mkdir -p $SRC/interfaces.ref 1970 if [ -d $SRC/interfaces.out ]; then 1971 cp -r $SRC/interfaces.out/* $SRC/interfaces.ref 1972 fi 1973 fi 1974 1975 echo "\n==== Diff versioning warnings (since last build) ====\n" | \ 1976 tee -a $LOGFILE >> $mail_msg_file 1977 1978 out_vers=`grep ^VERSION $SRC/interfaces.out/log`; 1979 ref_vers=`grep ^VERSION $SRC/interfaces.ref/log`; 1980 1981 # Report any differences in WARNING messages between last 1982 # and current build. 1983 if [ "$out_vers" = "$ref_vers" ]; then 1984 diff $SRC/interfaces.ref/log $SRC/interfaces.out/log | \ 1985 fgrep 'WARNING' | sed 's/WARNING: //' | \ 1986 tee -a $LOGFILE >> $mail_msg_file 1987 fi 1988fi 1989 1990if [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then 1991 echo "\n==== Check ELF runtime attributes ====\n" | \ 1992 tee -a $LOGFILE >> $mail_msg_file 1993 1994 LDDUSAGE="^ldd: does not support -e" 1995 LDDWRONG="wrong class" 1996 CRLERROR="^crle:" 1997 CRLECONF="^crle: configuration file:" 1998 1999 rm -f $SRC/runtime.ref 2000 if [ -f $SRC/runtime.out ]; then 2001 egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 2002 $SRC/runtime.out > $SRC/runtime.ref 2003 fi 2004 2005 # If we're doing a debug build the proto area will be left with 2006 # debuggable objects, thus don't assert -s. 2007 if [ "$D_FLAG" = "y" ]; then 2008 rtime_sflag="" 2009 else 2010 rtime_sflag="-s" 2011 fi 2012 check_rtime -d $ROOT -i -m -o $rtime_sflag $ROOT 2>&1 | \ 2013 egrep -v ": unreferenced object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \ 2014 egrep -v ": unused object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \ 2015 sort >$SRC/runtime.out 2016 2017 # Determine any processing errors that will affect the final output 2018 # and display these first. 2019 grep -l "$LDDUSAGE" $SRC/runtime.out > /dev/null 2020 if [ $? -eq 0 ]; then 2021 echo "WARNING: ldd(1) does not support -e. The version of ldd(1)" | \ 2022 tee -a $LOGFILE >> $mail_msg_file 2023 echo "on your system is old - 4390308 (s81_30) is required.\n" | \ 2024 tee -a $LOGFILE >> $mail_msg_file 2025 fi 2026 grep -l "$LDDWRONG" $SRC/runtime.out > /dev/null 2027 if [ $? -eq 0 ]; then 2028 echo "WARNING: wrong class message detected. ldd(1) was unable" | \ 2029 tee -a $LOGFILE >> $mail_msg_file 2030 echo "to execute an object, thus it could not be checked fully." | \ 2031 tee -a $LOGFILE >> $mail_msg_file 2032 echo "Perhaps a 64-bit object was encountered on a 32-bit system," | \ 2033 tee -a $LOGFILE >> $mail_msg_file 2034 echo "or an i386 object was encountered on a sparc system?\n" | \ 2035 tee -a $LOGFILE >> $mail_msg_file 2036 fi 2037 grep -l "$CRLECONF" $SRC/runtime.out > /dev/null 2038 if [ $? -eq 0 ]; then 2039 echo "WARNING: creation of an alternative dependency cache failed." | \ 2040 tee -a $LOGFILE >> $mail_msg_file 2041 echo "Dependencies will bind to the base system libraries.\n" | \ 2042 tee -a $LOGFILE >> $mail_msg_file 2043 grep "$CRLECONF" $SRC/runtime.out | \ 2044 tee -a $LOGFILE >> $mail_msg_file 2045 grep "$CRLERROR" $SRC/runtime.out | grep -v "$CRLECONF" | \ 2046 tee -a $LOGFILE >> $mail_msg_file 2047 echo "\n" | tee -a $LOGFILE >> $mail_msg_file 2048 fi 2049 2050 egrep '<dependency no longer necessary>' $SRC/runtime.out | \ 2051 tee -a $LOGFILE >> $mail_msg_file 2052 2053 # NEEDED= and RPATH= are informational; report anything else that we 2054 # haven't already. 2055 egrep -v "NEEDED=|RPATH=|$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 2056 $SRC/runtime.out | tee -a $LOGFILE >> $mail_msg_file 2057 2058 # probably should compare against a 'known ok runpaths' list 2059 if [ ! -f $SRC/runtime.ref ]; then 2060 egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 2061 $SRC/runtime.out > $SRC/runtime.ref 2062 fi 2063 2064 echo "\n==== Diff ELF runtime attributes (since last build) ====\n" \ 2065 >> $mail_msg_file 2066 2067 egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" $SRC/runtime.out | \ 2068 diff $SRC/runtime.ref - >> $mail_msg_file 2069fi 2070 2071# For now, don't make archives or packages for GPROF/TRACE builds 2072a_FLAG=n 2073p_FLAG=n 2074 2075# GPROF build begins 2076 2077if [ "$i_CMD_LINE_FLAG" = "n" -a "$P_FLAG" = "y" ]; then 2078 2079 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 2080 export RELEASE_BUILD ; RELEASE_BUILD= 2081 export EXTRA_OPTIONS ; EXTRA_OPTIONS="-DGPROF" 2082 export EXTRA_CFLAGS ; EXTRA_CFLAGS="-xpg" 2083 2084 build GPROF -prof 2085 2086else 2087 echo "\n==== No GPROF build ====\n" >> $LOGFILE 2088fi 2089 2090# GPROF build ends 2091 2092# TRACE build begins 2093 2094if [ "$i_CMD_LINE_FLAG" = "n" -a "$T_FLAG" = "y" ]; then 2095 2096 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 2097 export RELEASE_BUILD ; RELEASE_BUILD= 2098 export EXTRA_OPTIONS ; EXTRA_OPTIONS="-DTRACE" 2099 unset EXTRA_CFLAGS 2100 2101 build TRACE -trace 2102 2103else 2104 echo "\n==== No TRACE build ====\n" >> $LOGFILE 2105fi 2106 2107# TRACE build ends 2108 2109# DEBUG lint of kernel begins 2110 2111if [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 2112 if [ "$LINTDIRS" = "" ]; then 2113 # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y" 2114 LINTDIRS="$SRC y" 2115 fi 2116 set $LINTDIRS 2117 while [ $# -gt 0 ]; do 2118 dolint $1 $2; shift; shift 2119 done 2120else 2121 echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE 2122fi 2123 2124# "make check" begins 2125 2126if [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then 2127 # remove old check.out 2128 rm -f $SRC/check.out 2129 2130 rm -f $SRC/check-${MACH}.out 2131 cd $SRC 2132 $MAKE -ek check 2>&1 | tee -a $SRC/check-${MACH}.out >> $LOGFILE 2133 echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file 2134 2135 grep ":" $SRC/check-${MACH}.out | 2136 egrep -v "Ignoring unknown host" | \ 2137 sort | uniq >> $mail_msg_file 2138else 2139 echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE 2140fi 2141 2142echo "\n==== Find core files ====\n" | \ 2143 tee -a $LOGFILE >> $mail_msg_file 2144 2145find $SRC -name core -a -type f -exec file {} \; | \ 2146 tee -a $LOGFILE >> $mail_msg_file 2147 2148if [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 2149 echo "\n==== Diff unreferenced files (since last build) ====\n" \ 2150 | tee -a $LOGFILE >>$mail_msg_file 2151 rm -f $SRC/unref-${MACH}.ref 2152 if [ -f $SRC/unref-${MACH}.out ]; then 2153 mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 2154 fi 2155 2156 findunref $SRC ${TOOLS}/findunref/exception_list \ 2157 2>> $mail_msg_file | sort > $SRC/unref-${MACH}.out 2158 2159 if [ ! -f $SRC/unref-${MACH}.ref ]; then 2160 cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 2161 fi 2162 2163 diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file 2164fi 2165 2166# Verify that the usual lists of files, such as exception lists, 2167# contain only valid references to files. If the build has failed, 2168# then don't check the proto area. 2169CHECK_PATHS=${CHECK_PATHS:-y} 2170if [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then 2171 echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \ 2172 >>$mail_msg_file 2173 arg=-b 2174 [ "$build_ok" = y ] && arg= 2175 checkpaths $arg $ROOT 2>&1 | tee -a $LOGFILE >>$mail_msg_file 2176fi 2177 2178if [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then 2179 echo "\n==== Impact on file permissions ====\n" \ 2180 >> $mail_msg_file 2181 # 2182 # Get pkginfo files from usr/src/pkgdefs 2183 # 2184 pmodes -qvdP \ 2185 `for d in $SRC/pkgdefs; do 2186 if [ -d "$d" ] 2187 then 2188 find $d -name pkginfo.tmpl -print -o -name .del\* -prune 2189 fi 2190 done | sed -e 's:/pkginfo.tmpl$::' | sort -u ` >> $mail_msg_file 2191fi 2192 2193END_DATE=`date` 2194echo "==== Nightly $maketype build completed: $END_DATE ====" | \ 2195 tee -a $LOGFILE >> $build_time_file 2196 2197typeset -Z2 minutes 2198typeset -Z2 seconds 2199 2200elapsed_time=$SECONDS 2201((hours = elapsed_time / 3600 )) 2202((minutes = elapsed_time / 60 % 60)) 2203((seconds = elapsed_time % 60)) 2204 2205echo "\n==== Total build time ====" | \ 2206 tee -a $LOGFILE >> $build_time_file 2207echo "\nreal ${hours}:${minutes}:${seconds}" | \ 2208 tee -a $LOGFILE >> $build_time_file 2209 2210if [ "$u_FLAG" = "y" -a "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 2211 staffer cp ${SRC}/unref-${MACH}.out $PARENT_WS/usr/src/ 2212 2213 # 2214 # Produce a master list of unreferenced files -- ideally, we'd 2215 # generate the master just once after all of the nightlies 2216 # have finished, but there's no simple way to know when that 2217 # will be. Instead, we assume that we're the last nightly to 2218 # finish and merge all of the unref-${MACH}.out files in 2219 # $PARENT_WS/usr/src/. If we are in fact the final ${MACH} to 2220 # finish, then this file will be the authoritative master 2221 # list. Otherwise, another ${MACH}'s nightly will eventually 2222 # overwrite ours with its own master, but in the meantime our 2223 # temporary "master" will be no worse than any older master 2224 # which was already on the parent. 2225 # 2226 2227 set -- $PARENT_WS/usr/src/unref-*.out 2228 cp "$1" ${TMPDIR}/unref.merge 2229 shift 2230 2231 for unreffile; do 2232 comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$ 2233 mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge 2234 done 2235 2236 staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out 2237fi 2238 2239# 2240# All done save for the sweeping up. 2241# (whichever exit we hit here will trigger the "cleanup" trap which 2242# optionally sends mail on completion). 2243# 2244if [ "$build_ok" = "y" ]; then 2245 exit 0 2246fi 2247exit 1 2248