17c478bd9Sstevel@tonic-gate#!/bin/ksh -p 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6fb23a357Skupfer# Common Development and Distribution License (the "License"). 7fb23a357Skupfer# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 227c478bd9Sstevel@tonic-gate# 23*6c3c9007Sstevel# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate# 287c478bd9Sstevel@tonic-gate# Based on the nightly script from the integration folks, 297c478bd9Sstevel@tonic-gate# Mostly modified and owned by mike_s. 307c478bd9Sstevel@tonic-gate# Changes also by kjc, dmk. 317c478bd9Sstevel@tonic-gate# 327c478bd9Sstevel@tonic-gate# BRINGOVER_WS may be specified in the env file. 337c478bd9Sstevel@tonic-gate# The default is the old behavior of CLONE_WS 347c478bd9Sstevel@tonic-gate# 357c478bd9Sstevel@tonic-gate# -i on the command line, means fast options, so when it's on the 36d77e7149Ssommerfe# command line (only), lint and check builds are skipped no matter what 37d77e7149Ssommerfe# the setting of their individual flags are in NIGHTLY_OPTIONS. 387c478bd9Sstevel@tonic-gate# 397c478bd9Sstevel@tonic-gate# LINTDIRS can be set in the env file, format is a list of: 407c478bd9Sstevel@tonic-gate# 417c478bd9Sstevel@tonic-gate# /dirname-to-run-lint-on flag 427c478bd9Sstevel@tonic-gate# 437c478bd9Sstevel@tonic-gate# Where flag is: y - enable lint noise diff output 447c478bd9Sstevel@tonic-gate# n - disable lint noise diff output 457c478bd9Sstevel@tonic-gate# 467c478bd9Sstevel@tonic-gate# For example: LINTDIRS="$SRC/uts n $SRC/stand y $SRC/psm y" 477c478bd9Sstevel@tonic-gate# 487c478bd9Sstevel@tonic-gate# -A flag in NIGHTLY_OPTIONS checks ABI diffs in .so files 497c478bd9Sstevel@tonic-gate# This option requires a couple of scripts. 507c478bd9Sstevel@tonic-gate# 517c478bd9Sstevel@tonic-gate# OPTHOME and TEAMWARE may be set in the environment to override /opt 527c478bd9Sstevel@tonic-gate# and /opt/teamware defaults. 537c478bd9Sstevel@tonic-gate# 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate# 567c478bd9Sstevel@tonic-gate# The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout 577c478bd9Sstevel@tonic-gate# under certain circumstances, which can really screw things up; unset it. 587c478bd9Sstevel@tonic-gate# 597c478bd9Sstevel@tonic-gateunset CDPATH 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate# function to do a DEBUG and non-DEBUG build. Needed because we might 627c478bd9Sstevel@tonic-gate# need to do another for the source build, and since we only deliver DEBUG or 637c478bd9Sstevel@tonic-gate# non-DEBUG packages. 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gatenormal_build() { 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate # timestamp the start of a nightly build; the findunref tool uses it. 687c478bd9Sstevel@tonic-gate touch $SRC/.build.tstamp 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate # non-DEBUG build begins 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate if [ "$F_FLAG" = "n" ]; then 737c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 747c478bd9Sstevel@tonic-gate export RELEASE_BUILD ; RELEASE_BUILD= 757c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 767c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate build non-DEBUG -nd 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a "$p_FLAG" = "y" ]; then 817c478bd9Sstevel@tonic-gate copy_ihv_pkgs non-DEBUG -nd 827c478bd9Sstevel@tonic-gate fi 837c478bd9Sstevel@tonic-gate else 847c478bd9Sstevel@tonic-gate echo "\n==== No non-DEBUG build ====\n" >> $LOGFILE 857c478bd9Sstevel@tonic-gate fi 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate # non-DEBUG build ends 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate # DEBUG build begins 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate if [ "$D_FLAG" = "y" ]; then 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 947c478bd9Sstevel@tonic-gate unset RELEASE_BUILD 957c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 967c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate build DEBUG "" 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a "$p_FLAG" = "y" ]; then 1017c478bd9Sstevel@tonic-gate copy_ihv_pkgs DEBUG "" 1027c478bd9Sstevel@tonic-gate fi 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate else 1057c478bd9Sstevel@tonic-gate echo "\n==== No DEBUG build ====\n" >> $LOGFILE 1067c478bd9Sstevel@tonic-gate fi 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate # DEBUG build ends 1097c478bd9Sstevel@tonic-gate} 1107c478bd9Sstevel@tonic-gate 1111fe69678Skupfer# 1121fe69678Skupfer# usage: filelist DESTDIR PATTERN 1131fe69678Skupfer# 1147c478bd9Sstevel@tonic-gatefilelist() { 1157c478bd9Sstevel@tonic-gate DEST=$1 1167c478bd9Sstevel@tonic-gate PATTERN=$2 1177c478bd9Sstevel@tonic-gate cd ${DEST} 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate OBJFILES=${ORIG_SRC}/xmod/obj_files 1207c478bd9Sstevel@tonic-gate if [ ! -f ${OBJFILES} ]; then 1217c478bd9Sstevel@tonic-gate return; 1227c478bd9Sstevel@tonic-gate fi 1231fe69678Skupfer for i in `grep -v '^#' ${OBJFILES} | \ 1247c478bd9Sstevel@tonic-gate grep ${PATTERN} | cut -d: -f2 | tr -d ' \t'` 1257c478bd9Sstevel@tonic-gate do 1267c478bd9Sstevel@tonic-gate # wildcard expansion 1277c478bd9Sstevel@tonic-gate for j in $i 1287c478bd9Sstevel@tonic-gate do 1297c478bd9Sstevel@tonic-gate if [ -f "$j" ]; then 1307c478bd9Sstevel@tonic-gate echo $j 1317c478bd9Sstevel@tonic-gate fi 1327c478bd9Sstevel@tonic-gate if [ -d "$j" ]; then 1337c478bd9Sstevel@tonic-gate echo $j 1347c478bd9Sstevel@tonic-gate fi 1357c478bd9Sstevel@tonic-gate done 1367c478bd9Sstevel@tonic-gate done | sort | uniq 1377c478bd9Sstevel@tonic-gate} 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate# function to save off binaries after a full build for later 1407c478bd9Sstevel@tonic-gate# restoration 1417c478bd9Sstevel@tonic-gatesave_binaries() { 1427c478bd9Sstevel@tonic-gate # save off list of binaries 1437c478bd9Sstevel@tonic-gate echo "\n==== Saving binaries from build at `date` ====\n" | \ 1447c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 1457c478bd9Sstevel@tonic-gate rm -f ${BINARCHIVE} 1467c478bd9Sstevel@tonic-gate cd ${CODEMGR_WS} 1477c478bd9Sstevel@tonic-gate filelist ${CODEMGR_WS} '^preserve:' >> $LOGFILE 1487c478bd9Sstevel@tonic-gate filelist ${CODEMGR_WS} '^preserve:' | \ 1497c478bd9Sstevel@tonic-gate cpio -ocB 2>/dev/null | compress \ 1507c478bd9Sstevel@tonic-gate > ${BINARCHIVE} 1517c478bd9Sstevel@tonic-gate} 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate# delete files 1541fe69678Skupfer# usage: hybridize_files DESTDIR MAKE_TARGET 1557c478bd9Sstevel@tonic-gatehybridize_files() { 1567c478bd9Sstevel@tonic-gate DEST=$1 1577c478bd9Sstevel@tonic-gate MAKETARG=$2 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate echo "\n==== Hybridizing files at `date` ====\n" | \ 1607c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 1617c478bd9Sstevel@tonic-gate for i in `filelist ${DEST} '^delete:'` 1627c478bd9Sstevel@tonic-gate do 1637c478bd9Sstevel@tonic-gate echo "removing ${i}." | tee -a $mail_msg_file >> $LOGFILE 1647c478bd9Sstevel@tonic-gate rm -rf "${i}" 1657c478bd9Sstevel@tonic-gate done 1667c478bd9Sstevel@tonic-gate for i in `filelist ${DEST} '^hybridize:' ` 1677c478bd9Sstevel@tonic-gate do 1687c478bd9Sstevel@tonic-gate echo "hybridizing ${i}." | tee -a $mail_msg_file >> $LOGFILE 1697c478bd9Sstevel@tonic-gate rm -f ${i}+ 1707c478bd9Sstevel@tonic-gate sed -e "/^# HYBRID DELETE START/,/^# HYBRID DELETE END/d" \ 1717c478bd9Sstevel@tonic-gate < ${i} > ${i}+ 1727c478bd9Sstevel@tonic-gate mv ${i}+ ${i} 1737c478bd9Sstevel@tonic-gate done 1747c478bd9Sstevel@tonic-gate} 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate# restore binaries into the proper source tree. 1771fe69678Skupfer# usage: restore_binaries DESTDIR MAKE_TARGET 1787c478bd9Sstevel@tonic-gaterestore_binaries() { 1797c478bd9Sstevel@tonic-gate DEST=$1 1807c478bd9Sstevel@tonic-gate MAKETARG=$2 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate echo "\n==== Restoring binaries to ${MAKETARG} at `date` ====\n" | \ 1837c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 1847c478bd9Sstevel@tonic-gate cd ${DEST} 1857c478bd9Sstevel@tonic-gate zcat ${BINARCHIVE} | \ 1867c478bd9Sstevel@tonic-gate cpio -idmucvB 2>/dev/null | tee -a $mail_msg_file >> ${LOGFILE} 1877c478bd9Sstevel@tonic-gate} 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate# rename files we save binaries of 1901fe69678Skupfer# usage: rename_files DESTDIR MAKE_TARGET 1917c478bd9Sstevel@tonic-gaterename_files() { 1927c478bd9Sstevel@tonic-gate DEST=$1 1937c478bd9Sstevel@tonic-gate MAKETARG=$2 1947c478bd9Sstevel@tonic-gate echo "\n==== Renaming source files in ${MAKETARG} at `date` ====\n" | \ 1957c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 1967c478bd9Sstevel@tonic-gate for i in `filelist ${DEST} '^rename:'` 1977c478bd9Sstevel@tonic-gate do 1987c478bd9Sstevel@tonic-gate echo ${i} | tee -a $mail_msg_file >> ${LOGFILE} 1997c478bd9Sstevel@tonic-gate rm -f ${i}.export 2007c478bd9Sstevel@tonic-gate mv ${i} ${i}.export 2017c478bd9Sstevel@tonic-gate done 2027c478bd9Sstevel@tonic-gate} 2037c478bd9Sstevel@tonic-gate 2041fe69678Skupfer# 2051fe69678Skupfer# Copy some or all of the source tree. 2061fe69678Skupfer# usage: copy_source CODEMGR_WS DESTDIR LABEL SRCROOT 2071fe69678Skupfer# 2081fe69678Skupfercopy_source() { 2097c478bd9Sstevel@tonic-gate WS=$1 2107c478bd9Sstevel@tonic-gate DEST=$2 2111fe69678Skupfer label=$3 2121fe69678Skupfer srcroot=$4 2137c478bd9Sstevel@tonic-gate 2141fe69678Skupfer echo "\n==== Creating ${DEST} source from ${WS} ($label) ====\n" | \ 2157c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate echo "cleaning out ${DEST}." >> $LOGFILE 2187c478bd9Sstevel@tonic-gate rm -rf "${DEST}" >> $LOGFILE 2>&1 2197c478bd9Sstevel@tonic-gate 2207c478bd9Sstevel@tonic-gate mkdir -p ${DEST} 2217c478bd9Sstevel@tonic-gate cd ${WS} 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gate echo "creating ${DEST}." >> $LOGFILE 2241fe69678Skupfer find $srcroot -name 's\.*' -a -type f -print | \ 2257c478bd9Sstevel@tonic-gate sed -e 's,SCCS\/s.,,' | \ 2267c478bd9Sstevel@tonic-gate grep -v '/\.del-*' | \ 2277c478bd9Sstevel@tonic-gate cpio -pd ${DEST} >>$LOGFILE 2>&1 2281fe69678Skupfer} 2297c478bd9Sstevel@tonic-gate 2301fe69678Skupfer# 2311fe69678Skupfer# function to create (but not build) the export/crypt source tree. 2321fe69678Skupfer# usage: set_up_source_build CODEMGR_WS DESTDIR MAKE_TARGET 2331fe69678Skupfer# Sets SRC to the modified source tree, for use by the caller when it 2341fe69678Skupfer# builds the tree. 2351fe69678Skupfer# 2361fe69678Skupferset_up_source_build() { 2371fe69678Skupfer WS=$1 2381fe69678Skupfer DEST=$2 2391fe69678Skupfer MAKETARG=$3 2401fe69678Skupfer 2411fe69678Skupfer copy_source $WS $DEST $MAKETARG usr 2427c478bd9Sstevel@tonic-gate SRC=${DEST}/usr/src 2437c478bd9Sstevel@tonic-gate 2447c478bd9Sstevel@tonic-gate cd $SRC 2457c478bd9Sstevel@tonic-gate rm -f ${MAKETARG}.out 2467c478bd9Sstevel@tonic-gate echo "making ${MAKETARG} in ${SRC}." >> $LOGFILE 2477c478bd9Sstevel@tonic-gate /bin/time $MAKE -e ${MAKETARG} 2>&1 | \ 2487c478bd9Sstevel@tonic-gate tee -a $SRC/${MAKETARG}.out >> $LOGFILE 2497c478bd9Sstevel@tonic-gate echo "\n==== ${MAKETARG} build errors ====\n" >> $mail_msg_file 2507c478bd9Sstevel@tonic-gate egrep ":" $SRC/${MAKETARG}.out | \ 2517c478bd9Sstevel@tonic-gate egrep -e "(^${MAKE}:|[ ]error[: \n])" | \ 2527c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 2537c478bd9Sstevel@tonic-gate egrep -v "warning" >> $mail_msg_file 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate echo "clearing state files." >> $LOGFILE 2567c478bd9Sstevel@tonic-gate find . -name '.make*' -exec rm -f {} \; 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gate cd ${DEST} 2597c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "CRYPT_SRC" ]; then 2607c478bd9Sstevel@tonic-gate rm -f ${CODEMGR_WS}/crypt_files.cpio.Z 2617c478bd9Sstevel@tonic-gate echo "\n==== xmod/cry_files that don't exist ====\n" | \ 2627c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2637c478bd9Sstevel@tonic-gate CRYPT_FILES=${WS}/usr/src/xmod/cry_files 2647c478bd9Sstevel@tonic-gate for i in `cat ${CRYPT_FILES}` 2657c478bd9Sstevel@tonic-gate do 2667c478bd9Sstevel@tonic-gate # make sure the files exist 2677c478bd9Sstevel@tonic-gate if [ -f "$i" ]; then 2687c478bd9Sstevel@tonic-gate continue 2697c478bd9Sstevel@tonic-gate fi 2707c478bd9Sstevel@tonic-gate if [ -d "$i" ]; then 2717c478bd9Sstevel@tonic-gate continue 2727c478bd9Sstevel@tonic-gate fi 2737c478bd9Sstevel@tonic-gate echo "$i" | tee -a $mail_msg_file >> $LOGFILE 2747c478bd9Sstevel@tonic-gate done 2757c478bd9Sstevel@tonic-gate find `cat ${CRYPT_FILES}` -print 2>/dev/null | \ 2767c478bd9Sstevel@tonic-gate cpio -ocB 2>/dev/null | \ 2777c478bd9Sstevel@tonic-gate compress > ${CODEMGR_WS}/crypt_files.cpio.Z 2787c478bd9Sstevel@tonic-gate fi 2797c478bd9Sstevel@tonic-gate 2807c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "EXPORT_SRC" ]; then 2817c478bd9Sstevel@tonic-gate # rename first, since we might restore a file 2827c478bd9Sstevel@tonic-gate # of the same name (mapfiles) 2837c478bd9Sstevel@tonic-gate rename_files ${EXPORT_SRC} EXPORT_SRC 2847c478bd9Sstevel@tonic-gate if [ "$SH_FLAG" = "y" ]; then 2857c478bd9Sstevel@tonic-gate hybridize_files ${EXPORT_SRC} EXPORT_SRC 2867c478bd9Sstevel@tonic-gate fi 2877c478bd9Sstevel@tonic-gate fi 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gate # save the cleartext 2907c478bd9Sstevel@tonic-gate echo "\n==== Creating ${MAKETARG}.cpio.Z ====\n" | \ 2917c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2927c478bd9Sstevel@tonic-gate cd ${DEST} 2937c478bd9Sstevel@tonic-gate rm -f ${MAKETARG}.cpio.Z 294fb23a357Skupfer find usr -depth -print | \ 2957c478bd9Sstevel@tonic-gate grep -v usr/src/${MAKETARG}.out | \ 2967c478bd9Sstevel@tonic-gate cpio -ocB 2>/dev/null | \ 2977c478bd9Sstevel@tonic-gate compress > ${CODEMGR_WS}/${MAKETARG}.cpio.Z 2987c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "EXPORT_SRC" ]; then 2997c478bd9Sstevel@tonic-gate restore_binaries ${EXPORT_SRC} EXPORT_SRC 3007c478bd9Sstevel@tonic-gate fi 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "CRYPT_SRC" ]; then 3037c478bd9Sstevel@tonic-gate restore_binaries ${CRYPT_SRC} CRYPT_SRC 3047c478bd9Sstevel@tonic-gate fi 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gate} 3077c478bd9Sstevel@tonic-gate 3087c478bd9Sstevel@tonic-gate# function to do the build. 3097c478bd9Sstevel@tonic-gate# usage: build LABEL SUFFIX 3107c478bd9Sstevel@tonic-gate 3117c478bd9Sstevel@tonic-gatebuild() { 3127c478bd9Sstevel@tonic-gate LABEL=$1 3137c478bd9Sstevel@tonic-gate SUFFIX=$2 3147c478bd9Sstevel@tonic-gate INSTALLOG=install${SUFFIX}-${MACH} 3157c478bd9Sstevel@tonic-gate NOISE=noise${SUFFIX}-${MACH} 3167c478bd9Sstevel@tonic-gate CPIODIR=${CPIODIR_ORIG}${SUFFIX} 3177c478bd9Sstevel@tonic-gate PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX} 318d8fd4470Sjg if [ "$SPARC_RM_PKGARCHIVE_ORIG" ]; then 319d8fd4470Sjg SPARC_RM_PKGARCHIVE=${SPARC_RM_PKGARCHIVE_ORIG}${SUFFIX} 320d8fd4470Sjg fi 3217c478bd9Sstevel@tonic-gate 3227c478bd9Sstevel@tonic-gate this_build_ok=y 3237c478bd9Sstevel@tonic-gate # 3247c478bd9Sstevel@tonic-gate # Build OS-Networking source 3257c478bd9Sstevel@tonic-gate # 3267c478bd9Sstevel@tonic-gate echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \ 3277c478bd9Sstevel@tonic-gate >> $LOGFILE 3287c478bd9Sstevel@tonic-gate 3297c478bd9Sstevel@tonic-gate rm -f $SRC/${INSTALLOG}.out 3307c478bd9Sstevel@tonic-gate cd $SRC 3317c478bd9Sstevel@tonic-gate /bin/time $MAKE -e install 2>&1 | \ 3327c478bd9Sstevel@tonic-gate tee -a $SRC/${INSTALLOG}.out >> $LOGFILE 33332f1e47bSsommerfe 33432f1e47bSsommerfe echo "\n==== SCCS Noise ($LABEL) ====\n" >> $mail_msg_file 33532f1e47bSsommerfe 33632f1e47bSsommerfe egrep 'sccs(check| get)' $SRC/${INSTALLOG}.out >> $mail_msg_file 33732f1e47bSsommerfe 3387c478bd9Sstevel@tonic-gate echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file 3397c478bd9Sstevel@tonic-gate egrep ":" $SRC/${INSTALLOG}.out | 3407c478bd9Sstevel@tonic-gate egrep -e "(^${MAKE}:|[ ]error[: \n])" | \ 3417c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 3427c478bd9Sstevel@tonic-gate egrep -v "cc .* -o error " | \ 3437c478bd9Sstevel@tonic-gate egrep -v "warning" >> $mail_msg_file 3447c478bd9Sstevel@tonic-gate if [ "$?" = "0" ]; then 3457c478bd9Sstevel@tonic-gate build_ok=n 3467c478bd9Sstevel@tonic-gate this_build_ok=n 3477c478bd9Sstevel@tonic-gate fi 3487c478bd9Sstevel@tonic-gate grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \ 3497c478bd9Sstevel@tonic-gate >> $mail_msg_file 3507c478bd9Sstevel@tonic-gate if [ "$?" = "0" ]; then 3517c478bd9Sstevel@tonic-gate build_ok=n 3527c478bd9Sstevel@tonic-gate this_build_ok=n 3537c478bd9Sstevel@tonic-gate fi 3547c478bd9Sstevel@tonic-gate 3557c478bd9Sstevel@tonic-gate if [ "$W_FLAG" = "n" ]; then 3567c478bd9Sstevel@tonic-gate echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file 3577c478bd9Sstevel@tonic-gate egrep -i warning: $SRC/${INSTALLOG}.out \ 3587c478bd9Sstevel@tonic-gate | egrep -v '^tic:' \ 3597c478bd9Sstevel@tonic-gate | egrep -v "symbol \`timezone' has differing types:" \ 3607c478bd9Sstevel@tonic-gate | egrep -v "parameter <PSTAMP> set to" \ 3617c478bd9Sstevel@tonic-gate | egrep -v "Ignoring unknown host" \ 3627c478bd9Sstevel@tonic-gate | egrep -v "redefining segment flags attribute for" \ 3637c478bd9Sstevel@tonic-gate >> $mail_msg_file 3647c478bd9Sstevel@tonic-gate fi 3657c478bd9Sstevel@tonic-gate 3667c478bd9Sstevel@tonic-gate echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \ 3677c478bd9Sstevel@tonic-gate >> $LOGFILE 3687c478bd9Sstevel@tonic-gate 3697c478bd9Sstevel@tonic-gate echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file 3707c478bd9Sstevel@tonic-gate tail -3 $SRC/${INSTALLOG}.out >>$mail_msg_file 3717c478bd9Sstevel@tonic-gate 3727c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "n" -a "$W_FLAG" = "n" ]; then 3737c478bd9Sstevel@tonic-gate rm -f $SRC/${NOISE}.ref 3747c478bd9Sstevel@tonic-gate if [ -f $SRC/${NOISE}.out ]; then 3757c478bd9Sstevel@tonic-gate mv $SRC/${NOISE}.out $SRC/${NOISE}.ref 3767c478bd9Sstevel@tonic-gate fi 3777c478bd9Sstevel@tonic-gate grep : $SRC/${INSTALLOG}.out \ 3787c478bd9Sstevel@tonic-gate | egrep -v '^/' \ 3797c478bd9Sstevel@tonic-gate | egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \ 3807c478bd9Sstevel@tonic-gate | egrep -v '^tic:' \ 3817c478bd9Sstevel@tonic-gate | egrep -v '^mcs' \ 3827c478bd9Sstevel@tonic-gate | egrep -v '^LD_LIBRARY_PATH=' \ 3837c478bd9Sstevel@tonic-gate | egrep -v 'ar: creating' \ 3847c478bd9Sstevel@tonic-gate | egrep -v 'ar: writing' \ 3857c478bd9Sstevel@tonic-gate | egrep -v 'conflicts:' \ 3867c478bd9Sstevel@tonic-gate | egrep -v ':saved created' \ 3877c478bd9Sstevel@tonic-gate | egrep -v '^stty.*c:' \ 3887c478bd9Sstevel@tonic-gate | egrep -v '^mfgname.c:' \ 3897c478bd9Sstevel@tonic-gate | egrep -v '^uname-i.c:' \ 3907c478bd9Sstevel@tonic-gate | egrep -v '^volumes.c:' \ 3917c478bd9Sstevel@tonic-gate | egrep -v '^lint library construction:' \ 3927c478bd9Sstevel@tonic-gate | egrep -v 'tsort: INFORM:' \ 3937c478bd9Sstevel@tonic-gate | egrep -v 'stripalign:' \ 3947c478bd9Sstevel@tonic-gate | egrep -v 'chars, width' \ 3957c478bd9Sstevel@tonic-gate | egrep -v "symbol \`timezone' has differing types:" \ 3967c478bd9Sstevel@tonic-gate | egrep -v 'PSTAMP' \ 3977c478bd9Sstevel@tonic-gate | egrep -v '|%WHOANDWHERE%|' \ 3987c478bd9Sstevel@tonic-gate | egrep -v '^Manifying' \ 3997c478bd9Sstevel@tonic-gate | egrep -v 'Ignoring unknown host' \ 4007c478bd9Sstevel@tonic-gate | egrep -v 'Processing method:' \ 4017c478bd9Sstevel@tonic-gate | egrep -v '^Writing' \ 4027c478bd9Sstevel@tonic-gate | egrep -v 'spellin1:' \ 4037c478bd9Sstevel@tonic-gate | egrep -v '^adding:' \ 4047c478bd9Sstevel@tonic-gate | egrep -v "^echo 'msgid" \ 4057c478bd9Sstevel@tonic-gate | egrep -v '^echo ' \ 4067c478bd9Sstevel@tonic-gate | egrep -v '\.c:$' \ 4077c478bd9Sstevel@tonic-gate | egrep -v '^Adding file:' \ 4087c478bd9Sstevel@tonic-gate | egrep -v 'CLASSPATH=' \ 4097c478bd9Sstevel@tonic-gate | egrep -v '\/var\/mail\/:saved' \ 4107c478bd9Sstevel@tonic-gate | egrep -v -- '-DUTS_VERSION=' \ 4117c478bd9Sstevel@tonic-gate | egrep -v '^Running Mkbootstrap' \ 4127c478bd9Sstevel@tonic-gate | egrep -v '^Applet length read:' \ 4137c478bd9Sstevel@tonic-gate | egrep -v 'bytes written:' \ 4147c478bd9Sstevel@tonic-gate | egrep -v '^File:SolarisAuthApplet.bin' \ 4157c478bd9Sstevel@tonic-gate | egrep -v -i 'jibversion' \ 4167c478bd9Sstevel@tonic-gate | egrep -v '^Output size:' \ 4177c478bd9Sstevel@tonic-gate | egrep -v '^Solo size statistics:' \ 4187c478bd9Sstevel@tonic-gate | egrep -v '^Using ROM API Version' \ 4197c478bd9Sstevel@tonic-gate | egrep -v '^Zero Signature length:' \ 4207c478bd9Sstevel@tonic-gate | egrep -v '^Note \(probably harmless\):' \ 4217c478bd9Sstevel@tonic-gate | egrep -v '::' \ 4227c478bd9Sstevel@tonic-gate | egrep -v -- '-xcache' \ 423010b217aSwesolows | egrep -v '^\+' \ 42403eb5f54Swesolows | egrep -v '^cc1: note: -fwritable-strings' \ 425c817a439Sjohnz | egrep -v 'svccfg-native -s svc:/' \ 4267c478bd9Sstevel@tonic-gate | sort | uniq >$SRC/${NOISE}.out 4277c478bd9Sstevel@tonic-gate if [ ! -f $SRC/${NOISE}.ref ]; then 4287c478bd9Sstevel@tonic-gate cp $SRC/${NOISE}.out $SRC/${NOISE}.ref 4297c478bd9Sstevel@tonic-gate fi 4307c478bd9Sstevel@tonic-gate echo "\n==== Build noise differences ($LABEL) ====\n" \ 4317c478bd9Sstevel@tonic-gate >>$mail_msg_file 4327c478bd9Sstevel@tonic-gate diff $SRC/${NOISE}.ref $SRC/${NOISE}.out >>$mail_msg_file 4337c478bd9Sstevel@tonic-gate fi 4347c478bd9Sstevel@tonic-gate 4357c478bd9Sstevel@tonic-gate # 4367c478bd9Sstevel@tonic-gate # Create cpio archives for preintegration testing (PIT) 4377c478bd9Sstevel@tonic-gate # 4387c478bd9Sstevel@tonic-gate if [ "$a_FLAG" = "y" -a "$this_build_ok" = "y" ]; then 4397c478bd9Sstevel@tonic-gate echo "\n==== Creating $LABEL cpio archives at `date` ====\n" \ 4407c478bd9Sstevel@tonic-gate >> $LOGFILE 4417c478bd9Sstevel@tonic-gate makebfu_file="${TMPDIR}/makebfu" 4427c478bd9Sstevel@tonic-gate rm -f ${makebfu_file} 4437c478bd9Sstevel@tonic-gate makebfu 2>&1 | \ 4447c478bd9Sstevel@tonic-gate tee -a ${makebfu_file} >> $LOGFILE 4457c478bd9Sstevel@tonic-gate echo "\n==== cpio archives build errors ($LABEL) ====\n" \ 4467c478bd9Sstevel@tonic-gate >> $mail_msg_file 4477c478bd9Sstevel@tonic-gate grep -v "^Creating .* archive:" ${makebfu_file} | \ 4487c478bd9Sstevel@tonic-gate grep -v "^Making" | \ 4497c478bd9Sstevel@tonic-gate grep -v "^$" | \ 4507c478bd9Sstevel@tonic-gate sort | uniq >> $mail_msg_file 4517c478bd9Sstevel@tonic-gate rm -f ${makebfu_file} 4527c478bd9Sstevel@tonic-gate # hack for test folks 4537c478bd9Sstevel@tonic-gate if [ -z "`echo $PARENT_WS|egrep '^\/ws\/'`" ]; then 4547c478bd9Sstevel@tonic-gate X=/net/`uname -n`${CPIODIR} 4557c478bd9Sstevel@tonic-gate else 4567c478bd9Sstevel@tonic-gate X=${CPIODIR} 4577c478bd9Sstevel@tonic-gate fi 4587c478bd9Sstevel@tonic-gate echo "Archive_directory: ${X}" >${TMPDIR}/f 4597c478bd9Sstevel@tonic-gate cp ${TMPDIR}/f ${CPIODIR}/../../.${MACH}_wgtrun 4607c478bd9Sstevel@tonic-gate rm -f ${TMPDIR}/f 4617c478bd9Sstevel@tonic-gate 4627c478bd9Sstevel@tonic-gate else 4637c478bd9Sstevel@tonic-gate echo "\n==== Not creating $LABEL cpio archives ====\n" \ 4647c478bd9Sstevel@tonic-gate >> $LOGFILE 4657c478bd9Sstevel@tonic-gate fi 4667c478bd9Sstevel@tonic-gate 4677c478bd9Sstevel@tonic-gate # 4687c478bd9Sstevel@tonic-gate # Building Packages 4697c478bd9Sstevel@tonic-gate # 4707c478bd9Sstevel@tonic-gate if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then 4717c478bd9Sstevel@tonic-gate echo "\n==== Creating $LABEL packages at `date` ====\n" \ 4727c478bd9Sstevel@tonic-gate >> $LOGFILE 4737c478bd9Sstevel@tonic-gate rm -f $SRC/pkgdefs/${INSTALLOG}.out 4747c478bd9Sstevel@tonic-gate echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE 4757c478bd9Sstevel@tonic-gate rm -rf $PKGARCHIVE 4767c478bd9Sstevel@tonic-gate mkdir -p $PKGARCHIVE 477d8fd4470Sjg 478d8fd4470Sjg # 479d8fd4470Sjg # Optional build of sparc realmode on i386 480d8fd4470Sjg # 481d8fd4470Sjg if [ "$MACH" = "i386" ] && [ "${SPARC_RM_PKGARCHIVE}" ]; then 482d8fd4470Sjg echo "Clearing out ${SPARC_RM_PKGARCHIVE} ..." \ 483d8fd4470Sjg >> $LOGFILE 484d8fd4470Sjg rm -rf ${SPARC_RM_PKGARCHIVE} 485d8fd4470Sjg mkdir -p ${SPARC_RM_PKGARCHIVE} 486d8fd4470Sjg fi 487d8fd4470Sjg 4887c478bd9Sstevel@tonic-gate cd $SRC/pkgdefs 4897c478bd9Sstevel@tonic-gate $MAKE -e install 2>&1 | \ 4907c478bd9Sstevel@tonic-gate tee -a $SRC/pkgdefs/${INSTALLOG}.out >> $LOGFILE 4917c478bd9Sstevel@tonic-gate echo "\n==== Package build errors ($LABEL) ====\n" \ 4927c478bd9Sstevel@tonic-gate >> $mail_msg_file 4937c478bd9Sstevel@tonic-gate egrep "${MAKE}|ERROR|WARNING" $SRC/pkgdefs/${INSTALLOG}.out | \ 4947c478bd9Sstevel@tonic-gate grep ':' | \ 4957c478bd9Sstevel@tonic-gate grep -v PSTAMP | \ 4967c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 4977c478bd9Sstevel@tonic-gate >> $mail_msg_file 4987c478bd9Sstevel@tonic-gate else 4997c478bd9Sstevel@tonic-gate echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE 5007c478bd9Sstevel@tonic-gate fi 5017c478bd9Sstevel@tonic-gate} 5027c478bd9Sstevel@tonic-gate 5031fe69678Skupfer# Usage: dolint /dir y|n 5047c478bd9Sstevel@tonic-gate# Arg. 2 is a flag to turn on/off the lint diff output 5051fe69678Skupferdolint() { 5067c478bd9Sstevel@tonic-gate if [ ! -d "$1" ]; then 5071fe69678Skupfer echo "dolint error: $1 is not a directory" 5087c478bd9Sstevel@tonic-gate exit 1 5097c478bd9Sstevel@tonic-gate fi 5107c478bd9Sstevel@tonic-gate 5117c478bd9Sstevel@tonic-gate if [ "$2" != "y" -a "$2" != "n" ]; then 5121fe69678Skupfer echo "dolint internal error: $2 should be 'y' or 'n'" 5137c478bd9Sstevel@tonic-gate exit 1 5147c478bd9Sstevel@tonic-gate fi 5157c478bd9Sstevel@tonic-gate 5167c478bd9Sstevel@tonic-gate lintdir=$1 5177c478bd9Sstevel@tonic-gate dodiff=$2 5187c478bd9Sstevel@tonic-gate base=`basename $lintdir` 5197c478bd9Sstevel@tonic-gate LINTOUT=$lintdir/lint-${MACH}.out 5207c478bd9Sstevel@tonic-gate LINTNOISE=$lintdir/lint-noise-${MACH} 5217c478bd9Sstevel@tonic-gate 5227c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 5237c478bd9Sstevel@tonic-gate unset RELEASE_BUILD 5247c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 5257c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 5267c478bd9Sstevel@tonic-gate 5277c478bd9Sstevel@tonic-gate # 5287c478bd9Sstevel@tonic-gate # '$MAKE lint' in $lintdir 5297c478bd9Sstevel@tonic-gate # 5307c478bd9Sstevel@tonic-gate echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE 5317c478bd9Sstevel@tonic-gate 5327c478bd9Sstevel@tonic-gate # remove old lint.out 5337c478bd9Sstevel@tonic-gate rm -f $lintdir/lint.out $lintdir/lint-noise.out 5347c478bd9Sstevel@tonic-gate if [ -f $lintdir/lint-noise.ref ]; then 5357c478bd9Sstevel@tonic-gate mv $lintdir/lint-noise.ref ${LINTNOISE}.ref 5367c478bd9Sstevel@tonic-gate fi 5377c478bd9Sstevel@tonic-gate 5387c478bd9Sstevel@tonic-gate rm -f $LINTOUT 5397c478bd9Sstevel@tonic-gate cd $lintdir 5407c478bd9Sstevel@tonic-gate # 5417c478bd9Sstevel@tonic-gate # Remove all .ln files to ensure a full reference file 5427c478bd9Sstevel@tonic-gate # 5437c478bd9Sstevel@tonic-gate rm -f Nothing_to_remove \ 5447c478bd9Sstevel@tonic-gate `find . -name SCCS -prune -o -type f -name '*.ln' -print ` 5457c478bd9Sstevel@tonic-gate 5467c478bd9Sstevel@tonic-gate /bin/time $MAKE -ek lint 2>&1 | \ 5477c478bd9Sstevel@tonic-gate tee -a $LINTOUT >> $LOGFILE 5487c478bd9Sstevel@tonic-gate echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file 5497c478bd9Sstevel@tonic-gate grep "$MAKE:" $LINTOUT | 5507c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 5517c478bd9Sstevel@tonic-gate >> $mail_msg_file 5527c478bd9Sstevel@tonic-gate 5537c478bd9Sstevel@tonic-gate echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE 5547c478bd9Sstevel@tonic-gate 5557c478bd9Sstevel@tonic-gate echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \ 5567c478bd9Sstevel@tonic-gate >>$mail_msg_file 5577c478bd9Sstevel@tonic-gate tail -3 $LINTOUT >>$mail_msg_file 5587c478bd9Sstevel@tonic-gate 5597c478bd9Sstevel@tonic-gate rm -f ${LINTNOISE}.ref 5607c478bd9Sstevel@tonic-gate if [ -f ${LINTNOISE}.out ]; then 5617c478bd9Sstevel@tonic-gate mv ${LINTNOISE}.out ${LINTNOISE}.ref 5627c478bd9Sstevel@tonic-gate fi 5637c478bd9Sstevel@tonic-gate grep : $LINTOUT | \ 5647c478bd9Sstevel@tonic-gate egrep -v '^(real|user|sys)' | 5657c478bd9Sstevel@tonic-gate egrep -v '(library construction)' | \ 5667c478bd9Sstevel@tonic-gate egrep -v ': global crosschecks' | \ 5677c478bd9Sstevel@tonic-gate egrep -v 'Ignoring unknown host' | \ 5687c478bd9Sstevel@tonic-gate egrep -v '\.c:$' | \ 5697c478bd9Sstevel@tonic-gate sort | uniq > ${LINTNOISE}.out 5707c478bd9Sstevel@tonic-gate if [ ! -f ${LINTNOISE}.ref ]; then 5717c478bd9Sstevel@tonic-gate cp ${LINTNOISE}.out ${LINTNOISE}.ref 5727c478bd9Sstevel@tonic-gate fi 5737c478bd9Sstevel@tonic-gate if [ "$dodiff" != "n" ]; then 5747c478bd9Sstevel@tonic-gate echo "\n==== lint warnings $base ====\n" \ 5757c478bd9Sstevel@tonic-gate >>$mail_msg_file 5767c478bd9Sstevel@tonic-gate # should be none, though there are a few that were filtered out 5777c478bd9Sstevel@tonic-gate # above 5787c478bd9Sstevel@tonic-gate egrep -i '(warning|lint):' ${LINTNOISE}.out \ 5797c478bd9Sstevel@tonic-gate | sort | uniq >> $mail_msg_file 5807c478bd9Sstevel@tonic-gate echo "\n==== lint noise differences $base ====\n" \ 5817c478bd9Sstevel@tonic-gate >> $mail_msg_file 5827c478bd9Sstevel@tonic-gate diff ${LINTNOISE}.ref ${LINTNOISE}.out \ 5837c478bd9Sstevel@tonic-gate >> $mail_msg_file 5847c478bd9Sstevel@tonic-gate fi 5857c478bd9Sstevel@tonic-gate} 5867c478bd9Sstevel@tonic-gate 5877c478bd9Sstevel@tonic-gate# Install proto area from IHV build 5887c478bd9Sstevel@tonic-gate 5897c478bd9Sstevel@tonic-gatecopy_ihv_proto() { 5907c478bd9Sstevel@tonic-gate 5916fec3625Sdduvall echo "\n==== Installing IHV proto area ====\n" \ 5927c478bd9Sstevel@tonic-gate >> $LOGFILE 5937c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_ROOT" ]; then 5947c478bd9Sstevel@tonic-gate if [ ! -d "$ROOT" ]; then 5957c478bd9Sstevel@tonic-gate echo "mkdir -p $ROOT" >> $LOGFILE 5967c478bd9Sstevel@tonic-gate mkdir -p $ROOT 5977c478bd9Sstevel@tonic-gate fi 5986fec3625Sdduvall echo "copying $IA32_IHV_ROOT to $ROOT\n" >> $LOGFILE 5997c478bd9Sstevel@tonic-gate cd $IA32_IHV_ROOT 6007c478bd9Sstevel@tonic-gate tar -cf - . | (cd $ROOT; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6017c478bd9Sstevel@tonic-gate else 6027c478bd9Sstevel@tonic-gate echo "$IA32_IHV_ROOT: not found" >> $LOGFILE 6037c478bd9Sstevel@tonic-gate fi 6047c478bd9Sstevel@tonic-gate} 6057c478bd9Sstevel@tonic-gate 6067c478bd9Sstevel@tonic-gate# Install IHV packages in PKGARCHIVE 6071fe69678Skupfer# usage: copy_ihv_pkgs LABEL SUFFIX 6087c478bd9Sstevel@tonic-gatecopy_ihv_pkgs() { 6097c478bd9Sstevel@tonic-gate LABEL=$1 6107c478bd9Sstevel@tonic-gate SUFFIX=$2 6117c478bd9Sstevel@tonic-gate # always use non-DEBUG IHV packages 6127c478bd9Sstevel@tonic-gate IA32_IHV_PKGS=${IA32_IHV_PKGS_ORIG}-nd 6137c478bd9Sstevel@tonic-gate PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX} 6147c478bd9Sstevel@tonic-gate 6157c478bd9Sstevel@tonic-gate echo "\n==== Installing IHV packages from $IA32_IHV_PKGS ($LABEL) ====\n" \ 6167c478bd9Sstevel@tonic-gate >> $LOGFILE 6177c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_PKGS" ]; then 6187c478bd9Sstevel@tonic-gate cd $IA32_IHV_PKGS 6197c478bd9Sstevel@tonic-gate tar -cf - * | \ 6207c478bd9Sstevel@tonic-gate (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6217c478bd9Sstevel@tonic-gate else 6227c478bd9Sstevel@tonic-gate echo "$IA32_IHV_PKGS: not found" >> $LOGFILE 6237c478bd9Sstevel@tonic-gate fi 6247c478bd9Sstevel@tonic-gate 6257c478bd9Sstevel@tonic-gate echo "\n==== Installing IHV packages from $IA32_IHV_BINARY_PKGS ($LABEL) ====\n" \ 6267c478bd9Sstevel@tonic-gate >> $LOGFILE 6277c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_BINARY_PKGS" ]; then 6287c478bd9Sstevel@tonic-gate cd $IA32_IHV_BINARY_PKGS 6297c478bd9Sstevel@tonic-gate tar -cf - * | \ 6307c478bd9Sstevel@tonic-gate (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6317c478bd9Sstevel@tonic-gate else 6327c478bd9Sstevel@tonic-gate echo "$IA32_IHV_BINARY_PKGS: not found" >> $LOGFILE 6337c478bd9Sstevel@tonic-gate fi 6347c478bd9Sstevel@tonic-gate} 6357c478bd9Sstevel@tonic-gate 6361fe69678Skupfer# usage: build_tools DESTROOT 6377c478bd9Sstevel@tonic-gatebuild_tools() { 6387c478bd9Sstevel@tonic-gate DESTROOT=$1 6397c478bd9Sstevel@tonic-gate 6407c478bd9Sstevel@tonic-gate INSTALLOG=install-${MACH} 6417c478bd9Sstevel@tonic-gate 6427c478bd9Sstevel@tonic-gate echo "\n==== Building tools at `date` ====\n" \ 6437c478bd9Sstevel@tonic-gate >> $LOGFILE 6447c478bd9Sstevel@tonic-gate 6457c478bd9Sstevel@tonic-gate rm -f ${TOOLS}/${INSTALLOG}.out 6467c478bd9Sstevel@tonic-gate cd ${TOOLS} 6477c478bd9Sstevel@tonic-gate /bin/time $MAKE ROOT=${DESTROOT} -e install 2>&1 | \ 6487c478bd9Sstevel@tonic-gate tee -a ${TOOLS}/${INSTALLOG}.out >> $LOGFILE 6497c478bd9Sstevel@tonic-gate 6507c478bd9Sstevel@tonic-gate echo "\n==== Tools build errors ====\n" >> $mail_msg_file 6517c478bd9Sstevel@tonic-gate 6527c478bd9Sstevel@tonic-gate egrep ":" ${TOOLS}/${INSTALLOG}.out | 6537c478bd9Sstevel@tonic-gate egrep -e "(${MAKE}:|[ ]error[: \n])" | \ 6547c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 6557c478bd9Sstevel@tonic-gate egrep -v warning >> $mail_msg_file 6567c478bd9Sstevel@tonic-gate if [ "$?" != "0" ]; then 6577c478bd9Sstevel@tonic-gate STABS=${DESTROOT}/opt/onbld/bin/${MACH}/stabs 6587c478bd9Sstevel@tonic-gate export STABS 6597c478bd9Sstevel@tonic-gate CTFSTABS=${DESTROOT}/opt/onbld/bin/${MACH}/ctfstabs 6607c478bd9Sstevel@tonic-gate export CTFSTABS 6617c478bd9Sstevel@tonic-gate GENOFFSETS=${DESTROOT}/opt/onbld/bin/genoffsets 6627c478bd9Sstevel@tonic-gate export GENOFFSETS 6637c478bd9Sstevel@tonic-gate 6647c478bd9Sstevel@tonic-gate CTFCONVERT=${DESTROOT}/opt/onbld/bin/${MACH}/ctfconvert 6657c478bd9Sstevel@tonic-gate export CTFCONVERT 6667c478bd9Sstevel@tonic-gate CTFMERGE=${DESTROOT}/opt/onbld/bin/${MACH}/ctfmerge 6677c478bd9Sstevel@tonic-gate export CTFMERGE 6687c478bd9Sstevel@tonic-gate 6697c478bd9Sstevel@tonic-gate CTFCVTPTBL=${DESTROOT}/opt/onbld/bin/ctfcvtptbl 6707c478bd9Sstevel@tonic-gate export CTFCVTPTBL 6717c478bd9Sstevel@tonic-gate CTFFINDMOD=${DESTROOT}/opt/onbld/bin/ctffindmod 6727c478bd9Sstevel@tonic-gate export CTFFINDMOD 6737c478bd9Sstevel@tonic-gate 6747c478bd9Sstevel@tonic-gate if [ "$VERIFY_ELFSIGN" = "y" ]; then 6757c478bd9Sstevel@tonic-gate ELFSIGN=${DESTROOT}/opt/onbld/bin/elfsigncmp 6767c478bd9Sstevel@tonic-gate else 6777c478bd9Sstevel@tonic-gate ELFSIGN=${DESTROOT}/opt/onbld/bin/${MACH}/elfsign 6787c478bd9Sstevel@tonic-gate fi 6797c478bd9Sstevel@tonic-gate export ELFSIGN 6807c478bd9Sstevel@tonic-gate 6817c478bd9Sstevel@tonic-gate PATH="${DESTROOT}/opt/onbld/bin/${MACH}:${PATH}" 6827c478bd9Sstevel@tonic-gate PATH="${DESTROOT}/opt/onbld/bin:${PATH}" 6837c478bd9Sstevel@tonic-gate export PATH 6847c478bd9Sstevel@tonic-gate 6857c478bd9Sstevel@tonic-gate echo "\n==== New environment settings. ====\n" >> $LOGFILE 6867c478bd9Sstevel@tonic-gate echo "STABS=${STABS}" >> $LOGFILE 6877c478bd9Sstevel@tonic-gate echo "CTFSTABS=${CTFSTABS}" >> $LOGFILE 6887c478bd9Sstevel@tonic-gate echo "CTFCONVERT=${CTFCONVERT}" >> $LOGFILE 6897c478bd9Sstevel@tonic-gate echo "CTFMERGE=${CTFMERGE}" >> $LOGFILE 6907c478bd9Sstevel@tonic-gate echo "CTFCVTPTBL=${CTFCVTPTBL}" >> $LOGFILE 6917c478bd9Sstevel@tonic-gate echo "CTFFINDMOD=${CTFFINDMOD}" >> $LOGFILE 6927c478bd9Sstevel@tonic-gate echo "ELFSIGN=${ELFSIGN}" >> $LOGFILE 6937c478bd9Sstevel@tonic-gate echo "PATH=${PATH}" >> $LOGFILE 6947c478bd9Sstevel@tonic-gate fi 6957c478bd9Sstevel@tonic-gate} 6967c478bd9Sstevel@tonic-gate 6977c478bd9Sstevel@tonic-gatestaffer() { 6987c478bd9Sstevel@tonic-gate if [ $ISUSER -ne 0 ]; then 6997c478bd9Sstevel@tonic-gate "$@" 7007c478bd9Sstevel@tonic-gate else 7017c478bd9Sstevel@tonic-gate arg="\"$1\"" 7027c478bd9Sstevel@tonic-gate shift 7037c478bd9Sstevel@tonic-gate for i 7047c478bd9Sstevel@tonic-gate do 7057c478bd9Sstevel@tonic-gate arg="$arg \"$i\"" 7067c478bd9Sstevel@tonic-gate done 7077c478bd9Sstevel@tonic-gate eval su $STAFFER -c \'$arg\' 7087c478bd9Sstevel@tonic-gate fi 7097c478bd9Sstevel@tonic-gate} 7107c478bd9Sstevel@tonic-gate 711085d331dSkupfer# 712085d331dSkupfer# Verify that the closed tree is present if it needs to be. 713085d331dSkupfer# Sets CLOSED_IS_PRESENT for future use. 714085d331dSkupfer# 715085d331dSkupfercheck_closed_tree() { 716085d331dSkupfer if [ -z "$CLOSED_IS_PRESENT" ]; then 717085d331dSkupfer if [ -d $SRC/../closed ]; then 718085d331dSkupfer CLOSED_IS_PRESENT="yes" 719085d331dSkupfer else 720085d331dSkupfer CLOSED_IS_PRESENT="no" 721085d331dSkupfer fi 722085d331dSkupfer export CLOSED_IS_PRESENT 723085d331dSkupfer fi 724085d331dSkupfer if [[ "$CLOSED_IS_PRESENT" = no && ! -d "$ON_CLOSED_BINS" ]]; then 725085d331dSkupfer # 726085d331dSkupfer # If it's an old (pre-split) tree or an empty 727085d331dSkupfer # workspace, don't complain. 728085d331dSkupfer # 729085d331dSkupfer if grep -s CLOSED_BUILD $SRC/Makefile.master > /dev/null; then 730085d331dSkupfer echo "If the closed sources are not present," \ 731085d331dSkupfer "ON_CLOSED_BINS" 732085d331dSkupfer echo "must point to the closed binaries tree." 733085d331dSkupfer exit 1 734085d331dSkupfer fi 735085d331dSkupfer fi 736085d331dSkupfer} 7377c478bd9Sstevel@tonic-gate 738d77e7149Ssommerfeobsolete_build() { 739d77e7149Ssommerfe echo "WARNING: Obsolete $1 build requested; request will be ignored" 740d77e7149Ssommerfe} 741d77e7149Ssommerfe 742d77e7149Ssommerfe 7437c478bd9Sstevel@tonic-gateMACH=`uname -p` 7447c478bd9Sstevel@tonic-gate 7457c478bd9Sstevel@tonic-gateif [ "$OPTHOME" = "" ]; then 7467c478bd9Sstevel@tonic-gate OPTHOME=/opt 7477c478bd9Sstevel@tonic-gate export OPTHOME 7487c478bd9Sstevel@tonic-gatefi 7497c478bd9Sstevel@tonic-gateif [ "$TEAMWARE" = "" ]; then 7507c478bd9Sstevel@tonic-gate TEAMWARE=$OPTHOME/teamware 7517c478bd9Sstevel@tonic-gate export TEAMWARE 7527c478bd9Sstevel@tonic-gatefi 7537c478bd9Sstevel@tonic-gate 7541fe69678SkupferUSAGE='Usage: nightly [-in] [-V VERS ] [ -S E|D|H|O ] <env_file> 7557c478bd9Sstevel@tonic-gate 7567c478bd9Sstevel@tonic-gateWhere: 757d77e7149Ssommerfe -i Fast incremental options (no clobber, lint, check) 7587c478bd9Sstevel@tonic-gate -n Do not do a bringover 7597c478bd9Sstevel@tonic-gate -V VERS set the build version string to VERS 7607c478bd9Sstevel@tonic-gate -S Build a variant of the source product 7617c478bd9Sstevel@tonic-gate E - build exportable source 7627c478bd9Sstevel@tonic-gate D - build domestic source (exportable + crypt) 7637c478bd9Sstevel@tonic-gate H - build hybrid source (binaries + deleted source) 7641fe69678Skupfer O - build (only) open source 7657c478bd9Sstevel@tonic-gate 7667c478bd9Sstevel@tonic-gate <env_file> file in Bourne shell syntax that sets and exports 7677c478bd9Sstevel@tonic-gate variables that configure the operation of this script and many of 7687c478bd9Sstevel@tonic-gate the scripts this one calls. If <env_file> does not exist, 7697c478bd9Sstevel@tonic-gate it will be looked for in $OPTHOME/onbld/env. 7707c478bd9Sstevel@tonic-gate 7717c478bd9Sstevel@tonic-gatenon-DEBUG is the default build type. Build options can be set in the 7727c478bd9Sstevel@tonic-gateNIGHTLY_OPTIONS variable in the <env_file> as follows: 7737c478bd9Sstevel@tonic-gate 7747c478bd9Sstevel@tonic-gate -A check for ABI differences in .so files 7757c478bd9Sstevel@tonic-gate -C check for cstyle/hdrchk errors 7767c478bd9Sstevel@tonic-gate -D do a build with DEBUG on 7777c478bd9Sstevel@tonic-gate -F do _not_ do a non-DEBUG build 7787c478bd9Sstevel@tonic-gate -G gate keeper default group of options (-au) 7797c478bd9Sstevel@tonic-gate -I integration engineer default group of options (-ampu) 7807c478bd9Sstevel@tonic-gate -M do not run pmodes (safe file permission checker) 7817c478bd9Sstevel@tonic-gate -N do not run protocmp 7827c478bd9Sstevel@tonic-gate -R default group of options for building a release (-mp) 7837c478bd9Sstevel@tonic-gate -U update proto area in the parent 7847c478bd9Sstevel@tonic-gate -V VERS set the build version string to VERS 78504a42e3eSszhou -X copy x86 IHV proto area 7867c478bd9Sstevel@tonic-gate -a create cpio archives 7877c478bd9Sstevel@tonic-gate -f find unreferenced files 7887c478bd9Sstevel@tonic-gate -i do an incremental build (no "make clobber") 7897c478bd9Sstevel@tonic-gate -l do "make lint" in $LINTDIRS (default: $SRC y) 7907c478bd9Sstevel@tonic-gate -m send mail to $MAILTO at end of build 7917c478bd9Sstevel@tonic-gate -n do not do a bringover 7927c478bd9Sstevel@tonic-gate -o build using root privileges to set OWNER/GROUP (old style) 7937c478bd9Sstevel@tonic-gate -p create packages 7947c478bd9Sstevel@tonic-gate -r check ELF runtime attributes in the proto area 7957c478bd9Sstevel@tonic-gate -t build and use the tools in $SRC/tools 7967c478bd9Sstevel@tonic-gate -u update proto_list_$MACH and friends in the parent workspace; 7977c478bd9Sstevel@tonic-gate when used with -f, also build an unrefmaster.out in the parent 79896ccc8cbSesaxe -w report on differences between previous and current proto areas 7997c478bd9Sstevel@tonic-gate -z compress cpio archives with gzip 8007c478bd9Sstevel@tonic-gate -W Do not report warnings (freeware gate ONLY) 8017c478bd9Sstevel@tonic-gate -S Build a variant of the source product 8027c478bd9Sstevel@tonic-gate E - build exportable source 8037c478bd9Sstevel@tonic-gate D - build domestic source (exportable + crypt) 8047c478bd9Sstevel@tonic-gate H - build hybrid source (binaries + deleted source) 8051fe69678Skupfer O - build (only) open source 8067c478bd9Sstevel@tonic-gate' 8077c478bd9Sstevel@tonic-gate# 8087c478bd9Sstevel@tonic-gate# -x less public handling of xmod source for the source product 8097c478bd9Sstevel@tonic-gate# 8107c478bd9Sstevel@tonic-gate# A log file will be generated under the name $LOGFILE 8111c79753fSdarrenm# for partially completed build and log.`date '+%F'` 8127c478bd9Sstevel@tonic-gate# in the same directory for fully completed builds. 8137c478bd9Sstevel@tonic-gate# 8147c478bd9Sstevel@tonic-gate 8157c478bd9Sstevel@tonic-gate# default values for low-level FLAGS; G I R are group FLAGS 8167c478bd9Sstevel@tonic-gateA_FLAG=n 8177c478bd9Sstevel@tonic-gatea_FLAG=n 8187c478bd9Sstevel@tonic-gateC_FLAG=n 819*6c3c9007SstevelD_FLAG=n 8207c478bd9Sstevel@tonic-gateF_FLAG=n 8217c478bd9Sstevel@tonic-gatef_FLAG=n 8227c478bd9Sstevel@tonic-gatei_FLAG=n; i_CMD_LINE_FLAG=n 8237c478bd9Sstevel@tonic-gatel_FLAG=n 824*6c3c9007SstevelM_FLAG=n 8257c478bd9Sstevel@tonic-gatem_FLAG=n 826*6c3c9007SstevelN_FLAG=n 827*6c3c9007Ssteveln_FLAG=n 828*6c3c9007Sstevelo_FLAG=n 829*6c3c9007SstevelP_FLAG=n 8307c478bd9Sstevel@tonic-gatep_FLAG=n 8317c478bd9Sstevel@tonic-gater_FLAG=n 832*6c3c9007SstevelT_FLAG=n 8337c478bd9Sstevel@tonic-gatet_FLAG=n 8347c478bd9Sstevel@tonic-gateU_FLAG=n 835*6c3c9007Sstevelu_FLAG=n 8367c478bd9Sstevel@tonic-gateV_FLAG=n 8377c478bd9Sstevel@tonic-gateW_FLAG=n 838*6c3c9007Sstevelw_FLAG=n 839*6c3c9007SstevelX_FLAG=n 840*6c3c9007Sstevelz_FLAG=n 8417c478bd9Sstevel@tonic-gateSD_FLAG=n 842*6c3c9007SstevelSE_FLAG=n 8437c478bd9Sstevel@tonic-gateSH_FLAG=n 8441fe69678SkupferSO_FLAG=n 8457c478bd9Sstevel@tonic-gate# 8467c478bd9Sstevel@tonic-gateXMOD_OPT= 8477c478bd9Sstevel@tonic-gate# 8487c478bd9Sstevel@tonic-gatebuild_ok=y 8491fe69678Skupfer 8501fe69678Skupferis_source_build() { 8511fe69678Skupfer [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o \ 8521fe69678Skupfer "$SH_FLAG" = "y" -o "$SO_FLAG" = "y" ] 8531fe69678Skupfer return $? 8541fe69678Skupfer} 8551fe69678Skupfer 8567c478bd9Sstevel@tonic-gate# 8577c478bd9Sstevel@tonic-gate# examine arguments 8587c478bd9Sstevel@tonic-gate# 8597c478bd9Sstevel@tonic-gate 8601fe69678Skupfer# 8611fe69678Skupfer# single function for setting -S flag and doing error checking. 8621fe69678Skupfer# usage: set_S_flag <type> 8631fe69678Skupfer# where <type> is the source build type ("E", "D", ...). 8641fe69678Skupfer# 8651fe69678Skupferset_S_flag() { 8661fe69678Skupfer if is_source_build; then 8671fe69678Skupfer echo "Can only build one source variant at a time." 8681fe69678Skupfer exit 1 8691fe69678Skupfer fi 8701fe69678Skupfer if [ "$1" = "E" ]; then 8711fe69678Skupfer SE_FLAG=y 8721fe69678Skupfer elif [ "$1" = "D" ]; then 8731fe69678Skupfer SD_FLAG=y 8741fe69678Skupfer elif [ "$1" = "H" ]; then 8751fe69678Skupfer SH_FLAG=y 8761fe69678Skupfer elif [ "$1" = "O" ]; then 8771fe69678Skupfer SO_FLAG=y 8781fe69678Skupfer else 8791fe69678Skupfer echo "$USAGE" 8801fe69678Skupfer exit 1 8811fe69678Skupfer fi 8821fe69678Skupfer} 8831fe69678Skupfer 8847c478bd9Sstevel@tonic-gateOPTIND=1 885*6c3c9007Sstevelwhile getopts inS:tV: FLAG 8867c478bd9Sstevel@tonic-gatedo 8877c478bd9Sstevel@tonic-gate case $FLAG in 8887c478bd9Sstevel@tonic-gate i ) i_FLAG=y; i_CMD_LINE_FLAG=y 8897c478bd9Sstevel@tonic-gate ;; 8907c478bd9Sstevel@tonic-gate n ) n_FLAG=y 8917c478bd9Sstevel@tonic-gate ;; 8927c478bd9Sstevel@tonic-gate S ) 8931fe69678Skupfer set_S_flag $OPTARG 8947c478bd9Sstevel@tonic-gate ;; 8957c478bd9Sstevel@tonic-gate t ) t_FLAG=y 8967c478bd9Sstevel@tonic-gate ;; 897*6c3c9007Sstevel V ) V_FLAG=y 898*6c3c9007Sstevel V_ARG="$OPTARG" 899*6c3c9007Sstevel ;; 9007c478bd9Sstevel@tonic-gate \? ) echo "$USAGE" 9017c478bd9Sstevel@tonic-gate exit 1 9027c478bd9Sstevel@tonic-gate ;; 9037c478bd9Sstevel@tonic-gate esac 9047c478bd9Sstevel@tonic-gatedone 9057c478bd9Sstevel@tonic-gate 9067c478bd9Sstevel@tonic-gate# correct argument count after options 9077c478bd9Sstevel@tonic-gateshift `expr $OPTIND - 1` 9087c478bd9Sstevel@tonic-gate 9097c478bd9Sstevel@tonic-gate# test that the path to the environment-setting file was given 9107c478bd9Sstevel@tonic-gateif [ $# -ne 1 ]; then 9117c478bd9Sstevel@tonic-gate echo "$USAGE" 9127c478bd9Sstevel@tonic-gate exit 1 9137c478bd9Sstevel@tonic-gatefi 9147c478bd9Sstevel@tonic-gate 9157c478bd9Sstevel@tonic-gate# check if user is running nightly as root 9167c478bd9Sstevel@tonic-gate# ISUSER is set non-zero if an ordinary user runs nightly, or is zero 9177c478bd9Sstevel@tonic-gate# when root invokes nightly. 9187c478bd9Sstevel@tonic-gate/usr/bin/id | grep '^uid=0(' >/dev/null 2>&1 9197c478bd9Sstevel@tonic-gateISUSER=$?; export ISUSER 9207c478bd9Sstevel@tonic-gate 9217c478bd9Sstevel@tonic-gate# 9227c478bd9Sstevel@tonic-gate# force locale to C 9237c478bd9Sstevel@tonic-gateLC_COLLATE=C; export LC_COLLATE 9247c478bd9Sstevel@tonic-gateLC_CTYPE=C; export LC_CTYPE 9257c478bd9Sstevel@tonic-gateLC_MESSAGES=C; export LC_MESSAGES 9267c478bd9Sstevel@tonic-gateLC_MONETARY=C; export LC_MONETARY 9277c478bd9Sstevel@tonic-gateLC_NUMERIC=C; export LC_NUMERIC 9287c478bd9Sstevel@tonic-gateLC_TIME=C; export LC_TIME 9297c478bd9Sstevel@tonic-gate 9307c478bd9Sstevel@tonic-gate# clear environment variables we know to be bad for the build 9317c478bd9Sstevel@tonic-gateunset LD_OPTIONS 9327c478bd9Sstevel@tonic-gateunset LD_AUDIT LD_AUDIT_32 LD_AUDIT_64 9337c478bd9Sstevel@tonic-gateunset LD_BIND_NOW LD_BIND_NOW_32 LD_BIND_NOW_64 9347c478bd9Sstevel@tonic-gateunset LD_BREADTH LD_BREADTH_32 LD_BREADTH_64 9357c478bd9Sstevel@tonic-gateunset LD_CONFIG LD_CONFIG_32 LD_CONFIG_64 9367c478bd9Sstevel@tonic-gateunset LD_DEBUG LD_DEBUG_32 LD_DEBUG_64 9377c478bd9Sstevel@tonic-gateunset LD_DEMANGLE LD_DEMANGLE_32 LD_DEMANGLE_64 9387c478bd9Sstevel@tonic-gateunset LD_FLAGS LD_FLAGS_32 LD_FLAGS_64 9397c478bd9Sstevel@tonic-gateunset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 9407c478bd9Sstevel@tonic-gateunset LD_LOADFLTR LD_LOADFLTR_32 LD_LOADFLTR_64 9417c478bd9Sstevel@tonic-gateunset LD_NOAUDIT LD_NOAUDIT_32 LD_NOAUDIT_64 9427c478bd9Sstevel@tonic-gateunset LD_NOAUXFLTR LD_NOAUXFLTR_32 LD_NOAUXFLTR_64 9437c478bd9Sstevel@tonic-gateunset LD_NOCONFIG LD_NOCONFIG_32 LD_NOCONFIG_64 9447c478bd9Sstevel@tonic-gateunset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64 9457c478bd9Sstevel@tonic-gateunset LD_NODIRECT LD_NODIRECT_32 LD_NODIRECT_64 9467c478bd9Sstevel@tonic-gateunset LD_NOLAZYLOAD LD_NOLAZYLOAD_32 LD_NOLAZYLOAD_64 9477c478bd9Sstevel@tonic-gateunset LD_NOOBJALTER LD_NOOBJALTER_32 LD_NOOBJALTER_64 9487c478bd9Sstevel@tonic-gateunset LD_NOVERSION LD_NOVERSION_32 LD_NOVERSION_64 9497c478bd9Sstevel@tonic-gateunset LD_ORIGIN LD_ORIGIN_32 LD_ORIGIN_64 9507c478bd9Sstevel@tonic-gateunset LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64 9517c478bd9Sstevel@tonic-gateunset LD_PROFILE LD_PROFILE_32 LD_PROFILE_64 9527c478bd9Sstevel@tonic-gate 9537c478bd9Sstevel@tonic-gateunset CONFIG 9547c478bd9Sstevel@tonic-gateunset GROUP 9557c478bd9Sstevel@tonic-gateunset OWNER 9567c478bd9Sstevel@tonic-gateunset REMOTE 9577c478bd9Sstevel@tonic-gateunset ENV 9587c478bd9Sstevel@tonic-gateunset ARCH 9597c478bd9Sstevel@tonic-gateunset CLASSPATH 9607c478bd9Sstevel@tonic-gateunset NAME 9617c478bd9Sstevel@tonic-gate 9627c478bd9Sstevel@tonic-gate# 9637c478bd9Sstevel@tonic-gate# Setup environmental variables 9647c478bd9Sstevel@tonic-gate# 9657c478bd9Sstevel@tonic-gateif [ -f $1 ]; then 9667c478bd9Sstevel@tonic-gate if [[ $1 = */* ]]; then 9677c478bd9Sstevel@tonic-gate . $1 9687c478bd9Sstevel@tonic-gate else 9697c478bd9Sstevel@tonic-gate . ./$1 9707c478bd9Sstevel@tonic-gate fi 9717c478bd9Sstevel@tonic-gateelse 9727c478bd9Sstevel@tonic-gate if [ -f $OPTHOME/onbld/env/$1 ]; then 9737c478bd9Sstevel@tonic-gate . $OPTHOME/onbld/env/$1 9747c478bd9Sstevel@tonic-gate else 9757c478bd9Sstevel@tonic-gate echo "Cannot find env file as either $1 or $OPTHOME/onbld/env/$1" 9767c478bd9Sstevel@tonic-gate exit 1 9777c478bd9Sstevel@tonic-gate fi 9787c478bd9Sstevel@tonic-gatefi 9797c478bd9Sstevel@tonic-gate 9801fe69678Skupfer# contents of stdenv.sh inserted after next line: 9811fe69678Skupfer# STDENV_START 9821fe69678Skupfer# STDENV_END 9831fe69678Skupfer 9847c478bd9Sstevel@tonic-gate# 9857c478bd9Sstevel@tonic-gate# place ourselves in a new task, respecting BUILD_PROJECT if set. 9867c478bd9Sstevel@tonic-gate# 9877c478bd9Sstevel@tonic-gateif [ -z "$BUILD_PROJECT" ]; then 9887c478bd9Sstevel@tonic-gate /usr/bin/newtask -c $$ 9897c478bd9Sstevel@tonic-gateelse 9907c478bd9Sstevel@tonic-gate /usr/bin/newtask -c $$ -p $BUILD_PROJECT 9917c478bd9Sstevel@tonic-gatefi 9927c478bd9Sstevel@tonic-gate 9937c478bd9Sstevel@tonic-gateps -o taskid= -p $$ | read build_taskid 9947c478bd9Sstevel@tonic-gateps -o project= -p $$ | read build_project 9957c478bd9Sstevel@tonic-gate 9967c478bd9Sstevel@tonic-gate# 9977c478bd9Sstevel@tonic-gate# See if NIGHTLY_OPTIONS is set 9987c478bd9Sstevel@tonic-gate# 9997c478bd9Sstevel@tonic-gateif [ "$NIGHTLY_OPTIONS" = "" ]; then 10007c478bd9Sstevel@tonic-gate NIGHTLY_OPTIONS="-aBm" 10017c478bd9Sstevel@tonic-gatefi 10027c478bd9Sstevel@tonic-gate 10037c478bd9Sstevel@tonic-gate# 10047c478bd9Sstevel@tonic-gate# If BRINGOVER_WS was not specified, let it default to CLONE_WS 10057c478bd9Sstevel@tonic-gate# 10067c478bd9Sstevel@tonic-gateif [ "$BRINGOVER_WS" = "" ]; then 10077c478bd9Sstevel@tonic-gate BRINGOVER_WS=$CLONE_WS 10087c478bd9Sstevel@tonic-gatefi 10097c478bd9Sstevel@tonic-gate 10107c478bd9Sstevel@tonic-gate# 1011fb23a357Skupfer# If BRINGOVER_FILES was not specified, default to usr 1012a5c06a9eSmike_s# 1013a5c06a9eSmike_sif [ "$BRINGOVER_FILES" = "" ]; then 1014fb23a357Skupfer BRINGOVER_FILES="usr" 1015a5c06a9eSmike_sfi 1016a5c06a9eSmike_s 1017fb9f9b97Skupfer# 1018fb9f9b97Skupfer# If the closed sources are not present, the closed binaries must be 1019fb9f9b97Skupfer# present for the build to succeed. If there's no pointer to the 1020fb9f9b97Skupfer# closed binaries, flag that now, rather than forcing the user to wait 1021fb9f9b97Skupfer# a couple hours (or more) to find out. 1022fb9f9b97Skupfer# 1023085d331dSkupferorig_closed_is_present="$CLOSED_IS_PRESENT" 1024085d331dSkupfercheck_closed_tree 1025fb9f9b97Skupfer 1026a5c06a9eSmike_s# 10277c478bd9Sstevel@tonic-gate# Note: changes to the option letters here should also be applied to the 1028b84bdc30Smeem# bldenv script. `d' is listed for backward compatibility. 10297c478bd9Sstevel@tonic-gate# 1030d77e7149SsommerfeNIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-} 10317c478bd9Sstevel@tonic-gateOPTIND=1 1032*6c3c9007Sstevelwhile getopts AaBCDdFfGIilMmNnoPpRrS:TtUuWwXxz FLAG $NIGHTLY_OPTIONS 10337c478bd9Sstevel@tonic-gatedo 10347c478bd9Sstevel@tonic-gate case $FLAG in 10357c478bd9Sstevel@tonic-gate A ) A_FLAG=y 10367c478bd9Sstevel@tonic-gate ;; 1037*6c3c9007Sstevel a ) a_FLAG=y 1038*6c3c9007Sstevel ;; 10397c478bd9Sstevel@tonic-gate B ) D_FLAG=y 10407c478bd9Sstevel@tonic-gate ;; # old version of D 1041*6c3c9007Sstevel C ) C_FLAG=y 10427c478bd9Sstevel@tonic-gate ;; 10437c478bd9Sstevel@tonic-gate D ) D_FLAG=y 10447c478bd9Sstevel@tonic-gate ;; 1045*6c3c9007Sstevel F ) F_FLAG=y 10467c478bd9Sstevel@tonic-gate ;; 1047*6c3c9007Sstevel f ) f_FLAG=y 10487c478bd9Sstevel@tonic-gate ;; 10497c478bd9Sstevel@tonic-gate G ) a_FLAG=y 10507c478bd9Sstevel@tonic-gate u_FLAG=y 10517c478bd9Sstevel@tonic-gate ;; 10527c478bd9Sstevel@tonic-gate I ) a_FLAG=y 10537c478bd9Sstevel@tonic-gate m_FLAG=y 10547c478bd9Sstevel@tonic-gate p_FLAG=y 10557c478bd9Sstevel@tonic-gate u_FLAG=y 10567c478bd9Sstevel@tonic-gate ;; 10577c478bd9Sstevel@tonic-gate i ) i_FLAG=y 10587c478bd9Sstevel@tonic-gate ;; 1059*6c3c9007Sstevel l ) l_FLAG=y 1060*6c3c9007Sstevel ;; 1061*6c3c9007Sstevel M ) M_FLAG=y 1062*6c3c9007Sstevel ;; 1063*6c3c9007Sstevel m ) m_FLAG=y 1064*6c3c9007Sstevel ;; 1065*6c3c9007Sstevel N ) N_FLAG=y 1066*6c3c9007Sstevel ;; 10677c478bd9Sstevel@tonic-gate n ) n_FLAG=y 10687c478bd9Sstevel@tonic-gate ;; 10697c478bd9Sstevel@tonic-gate o ) o_FLAG=y 10707c478bd9Sstevel@tonic-gate ;; 1071*6c3c9007Sstevel P ) P_FLAG=y 1072*6c3c9007Sstevel ;; # obsolete 10737c478bd9Sstevel@tonic-gate p ) p_FLAG=y 10747c478bd9Sstevel@tonic-gate ;; 1075*6c3c9007Sstevel R ) m_FLAG=y 1076*6c3c9007Sstevel p_FLAG=y 1077*6c3c9007Sstevel ;; 10787c478bd9Sstevel@tonic-gate r ) r_FLAG=y 10797c478bd9Sstevel@tonic-gate ;; 1080*6c3c9007Sstevel S ) 1081*6c3c9007Sstevel set_S_flag $OPTARG 1082*6c3c9007Sstevel ;; 1083*6c3c9007Sstevel T ) T_FLAG=y 1084*6c3c9007Sstevel ;; # obsolete 10857c478bd9Sstevel@tonic-gate t ) t_FLAG=y 10867c478bd9Sstevel@tonic-gate ;; 10877c478bd9Sstevel@tonic-gate U ) 10887c478bd9Sstevel@tonic-gate if [ -z "${PARENT_ROOT}" ]; then 10897c478bd9Sstevel@tonic-gate echo "PARENT_ROOT must be set if the U flag is" \ 10907c478bd9Sstevel@tonic-gate "present in NIGHTLY_OPTIONS." 10917c478bd9Sstevel@tonic-gate exit 1 10927c478bd9Sstevel@tonic-gate fi 10937c478bd9Sstevel@tonic-gate U_FLAG=y 10947c478bd9Sstevel@tonic-gate NIGHTLY_PARENT_ROOT=$PARENT_ROOT 10957c478bd9Sstevel@tonic-gate ;; 1096*6c3c9007Sstevel u ) u_FLAG=y 10977c478bd9Sstevel@tonic-gate ;; 10987c478bd9Sstevel@tonic-gate W ) W_FLAG=y 10997c478bd9Sstevel@tonic-gate ;; 1100*6c3c9007Sstevel 1101*6c3c9007Sstevel w ) w_FLAG=y 11027c478bd9Sstevel@tonic-gate ;; 11037c478bd9Sstevel@tonic-gate X ) # now that we no longer need realmode builds, just 11047c478bd9Sstevel@tonic-gate # copy IHV packages. only meaningful on x86. 11057c478bd9Sstevel@tonic-gate if [ "$MACH" = "i386" ]; then 11067c478bd9Sstevel@tonic-gate X_FLAG=y 11077c478bd9Sstevel@tonic-gate fi 11087c478bd9Sstevel@tonic-gate ;; 1109*6c3c9007Sstevel x ) XMOD_OPT="-x" 1110*6c3c9007Sstevel ;; 1111*6c3c9007Sstevel z ) z_FLAG=y 1112*6c3c9007Sstevel ;; 11137c478bd9Sstevel@tonic-gate \? ) echo "$USAGE" 11147c478bd9Sstevel@tonic-gate exit 1 11157c478bd9Sstevel@tonic-gate ;; 11167c478bd9Sstevel@tonic-gate esac 11177c478bd9Sstevel@tonic-gatedone 11187c478bd9Sstevel@tonic-gate 11197c478bd9Sstevel@tonic-gateif [ $ISUSER -ne 0 ]; then 11207c478bd9Sstevel@tonic-gate if [ "$o_FLAG" = "y" ]; then 11217c478bd9Sstevel@tonic-gate echo "Old-style build requires root permission." 11227c478bd9Sstevel@tonic-gate exit 1 11237c478bd9Sstevel@tonic-gate fi 11247c478bd9Sstevel@tonic-gate 11257c478bd9Sstevel@tonic-gate # Set default value for STAFFER, if needed. 11267c478bd9Sstevel@tonic-gate if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then 11277c478bd9Sstevel@tonic-gate STAFFER=`/usr/xpg4/bin/id -un` 11287c478bd9Sstevel@tonic-gate export STAFFER 11297c478bd9Sstevel@tonic-gate fi 11307c478bd9Sstevel@tonic-gatefi 11317c478bd9Sstevel@tonic-gate 11327c478bd9Sstevel@tonic-gateif [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then 11337c478bd9Sstevel@tonic-gate MAILTO=$STAFFER 11347c478bd9Sstevel@tonic-gate export MAILTO 11357c478bd9Sstevel@tonic-gatefi 11367c478bd9Sstevel@tonic-gate 11377c478bd9Sstevel@tonic-gatePATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin" 11387c478bd9Sstevel@tonic-gatePATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb" 11397c478bd9Sstevel@tonic-gatePATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:." 11407c478bd9Sstevel@tonic-gateexport PATH 11417c478bd9Sstevel@tonic-gate 1142fb23a357Skupfer# roots of source trees, both relative to $SRC and absolute. 1143fb23a357Skupferrelsrcdirs="." 1144fb9f9b97Skupferif [[ -d $SRC/../closed && "$CLOSED_IS_PRESENT" != no ]]; then 1145fb9f9b97Skupfer relsrcdirs="$relsrcdirs ../closed" 1146fb9f9b97Skupferfi 1147fb23a357Skupferabssrcdirs="" 1148fb23a357Skupferfor d in $relsrcdirs; do 1149fb23a357Skupfer abssrcdirs="$abssrcdirs $SRC/$d" 1150fb23a357Skupferdone 1151fb23a357Skupfer 11527c478bd9Sstevel@tonic-gateunset CH 11537c478bd9Sstevel@tonic-gateif [ "$o_FLAG" = "y" ]; then 11547c478bd9Sstevel@tonic-gate# root invoked old-style build -- make sure it works as it always has 11557c478bd9Sstevel@tonic-gate# by exporting 'CH'. The current Makefile.master doesn't use this, but 11567c478bd9Sstevel@tonic-gate# the old ones still do. 11577c478bd9Sstevel@tonic-gate PROTOCMPTERSE="protocmp.terse" 11587c478bd9Sstevel@tonic-gate CH= 11597c478bd9Sstevel@tonic-gate export CH 11607c478bd9Sstevel@tonic-gateelse 11617c478bd9Sstevel@tonic-gate PROTOCMPTERSE="protocmp.terse -gu" 11627c478bd9Sstevel@tonic-gatefi 11637c478bd9Sstevel@tonic-gatePOUND_SIGN="#" 11647c478bd9Sstevel@tonic-gate 11657c478bd9Sstevel@tonic-gate# we export POUND_SIGN to speed up the build process -- prevents evaluation of 11667c478bd9Sstevel@tonic-gate# the Makefile.master definitions. 11676fec3625Sdduvallexport o_FLAG X_FLAG POUND_SIGN 11687c478bd9Sstevel@tonic-gate 11697c478bd9Sstevel@tonic-gatemaketype="distributed" 11707c478bd9Sstevel@tonic-gateMAKE=dmake 11717c478bd9Sstevel@tonic-gate# get the dmake version string alone 11727c478bd9Sstevel@tonic-gateDMAKE_VERSION=$( $MAKE -v ) 11737c478bd9Sstevel@tonic-gateDMAKE_VERSION=${DMAKE_VERSION#*: } 11747c478bd9Sstevel@tonic-gate# focus in on just the dotted version number alone 11757c478bd9Sstevel@tonic-gateDMAKE_MAJOR=$( echo $DMAKE_VERSION | \ 11767c478bd9Sstevel@tonic-gate sed -e 's/.*\<\([^.]*\.[^ ]*\).*$/\1/' ) 11777c478bd9Sstevel@tonic-gate# extract the second (or final) integer 11787c478bd9Sstevel@tonic-gateDMAKE_MINOR=${DMAKE_MAJOR#*.} 11797c478bd9Sstevel@tonic-gateDMAKE_MINOR=${DMAKE_MINOR%%.*} 11807c478bd9Sstevel@tonic-gate# extract the first integer 11817c478bd9Sstevel@tonic-gateDMAKE_MAJOR=${DMAKE_MAJOR%%.*} 11827c478bd9Sstevel@tonic-gateCHECK_DMAKE=${CHECK_DMAKE:-y} 11837c478bd9Sstevel@tonic-gate# x86 was built on the 12th, sparc on the 13th. 11847c478bd9Sstevel@tonic-gateif [ "$CHECK_DMAKE" = "y" -a \ 11857c478bd9Sstevel@tonic-gate "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \ 11867c478bd9Sstevel@tonic-gate "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \( \ 11877c478bd9Sstevel@tonic-gate "$DMAKE_MAJOR" -lt 7 -o \ 11887c478bd9Sstevel@tonic-gate "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \) ]; then 11897c478bd9Sstevel@tonic-gate if [ -z "$DMAKE_VERSION" ]; then 11907c478bd9Sstevel@tonic-gate echo "$MAKE is missing." 11917c478bd9Sstevel@tonic-gate exit 1 11927c478bd9Sstevel@tonic-gate fi 11937c478bd9Sstevel@tonic-gate echo `whence $MAKE`" version is:" 11947c478bd9Sstevel@tonic-gate echo " ${DMAKE_VERSION}" 11957c478bd9Sstevel@tonic-gate cat <<EOF 11967c478bd9Sstevel@tonic-gate 11977c478bd9Sstevel@tonic-gateThis version may not be safe for use. Either set TEAMWARE to a better 11987c478bd9Sstevel@tonic-gatepath or (if you really want to use this version of dmake anyway), add 11997c478bd9Sstevel@tonic-gatethe following to your environment to disable this check: 12007c478bd9Sstevel@tonic-gate 12017c478bd9Sstevel@tonic-gate CHECK_DMAKE=n 12027c478bd9Sstevel@tonic-gateEOF 12037c478bd9Sstevel@tonic-gate exit 1 12047c478bd9Sstevel@tonic-gatefi 12057c478bd9Sstevel@tonic-gateexport PATH 12067c478bd9Sstevel@tonic-gateexport MAKE 12077c478bd9Sstevel@tonic-gate 12087c478bd9Sstevel@tonic-gateif [ "${SUNWSPRO}" != "" ]; then 12097c478bd9Sstevel@tonic-gate PATH="${SUNWSPRO}/bin:$PATH" 12107c478bd9Sstevel@tonic-gate export PATH 12117c478bd9Sstevel@tonic-gatefi 12127c478bd9Sstevel@tonic-gate 12137c478bd9Sstevel@tonic-gatehostname=`uname -n` 12147c478bd9Sstevel@tonic-gateif [ ! -f $HOME/.make.machines ]; then 12157c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS=4 12167c478bd9Sstevel@tonic-gateelse 12177c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS="`grep $hostname $HOME/.make.machines | \ 12187c478bd9Sstevel@tonic-gate tail -1 | awk -F= '{print $ 2;}'`" 12197c478bd9Sstevel@tonic-gate if [ "$DMAKE_MAX_JOBS" = "" ]; then 12207c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS=4 12217c478bd9Sstevel@tonic-gate fi 12227c478bd9Sstevel@tonic-gatefi 12237c478bd9Sstevel@tonic-gateDMAKE_MODE=parallel; 12247c478bd9Sstevel@tonic-gateexport DMAKE_MODE 12257c478bd9Sstevel@tonic-gateexport DMAKE_MAX_JOBS 12267c478bd9Sstevel@tonic-gate 12277c478bd9Sstevel@tonic-gateif [ -z "${ROOT}" ]; then 12287c478bd9Sstevel@tonic-gate echo "ROOT must be set." 12297c478bd9Sstevel@tonic-gate exit 1 12307c478bd9Sstevel@tonic-gatefi 12317c478bd9Sstevel@tonic-gate 12327c478bd9Sstevel@tonic-gate# 12337c478bd9Sstevel@tonic-gate# if -V flag was given, reset VERSION to V_ARG 12347c478bd9Sstevel@tonic-gate# 12357c478bd9Sstevel@tonic-gateif [ "$V_FLAG" = "y" ]; then 12367c478bd9Sstevel@tonic-gate VERSION=$V_ARG 12377c478bd9Sstevel@tonic-gatefi 12387c478bd9Sstevel@tonic-gate 123904a42e3eSszhou# 124004a42e3eSszhou# Check for IHV root for copying ihv proto area 124104a42e3eSszhou# 124204a42e3eSszhouif [ "$X_FLAG" = "y" ]; then 124304a42e3eSszhou if [ "$IA32_IHV_ROOT" = "" ]; then 124404a42e3eSszhou echo "IA32_IHV_ROOT: must be set for copying ihv proto" 124504a42e3eSszhou args_ok=n 124604a42e3eSszhou fi 124704a42e3eSszhou if [ ! -d "$IA32_IHV_ROOT" ]; then 124804a42e3eSszhou echo "$IA32_IHV_ROOT: not found" 124904a42e3eSszhou args_ok=n 125004a42e3eSszhou fi 12516fec3625Sdduvall if [ "$IA32_IHV_WS" = "" ]; then 12526fec3625Sdduvall echo "IA32_IHV_WS: must be set for copying ihv proto" 12536fec3625Sdduvall args_ok=n 12546fec3625Sdduvall fi 12556fec3625Sdduvall if [ ! -d "$IA32_IHV_WS" ]; then 12566fec3625Sdduvall echo "$IA32_IHV_WS: not found" 12576fec3625Sdduvall args_ok=n 12586fec3625Sdduvall fi 125904a42e3eSszhoufi 126004a42e3eSszhou 12617c478bd9Sstevel@tonic-gate# Append source version 12627c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" ]; then 12637c478bd9Sstevel@tonic-gate VERSION="${VERSION}:EXPORT" 12647c478bd9Sstevel@tonic-gatefi 12657c478bd9Sstevel@tonic-gate 12667c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 12677c478bd9Sstevel@tonic-gate VERSION="${VERSION}:DOMESTIC" 12687c478bd9Sstevel@tonic-gatefi 12697c478bd9Sstevel@tonic-gate 12707c478bd9Sstevel@tonic-gateif [ "$SH_FLAG" = "y" ]; then 12717c478bd9Sstevel@tonic-gate VERSION="${VERSION}:MODIFIED_SOURCE_PRODUCT" 12727c478bd9Sstevel@tonic-gatefi 12737c478bd9Sstevel@tonic-gate 12741fe69678Skupferif [ "$SO_FLAG" = "y" ]; then 12751fe69678Skupfer VERSION="${VERSION}:OPEN_ONLY" 12761fe69678Skupferfi 12771fe69678Skupfer 12787c478bd9Sstevel@tonic-gateTMPDIR="/tmp/nightly.tmpdir.$$" 12797c478bd9Sstevel@tonic-gateexport TMPDIR 12807c478bd9Sstevel@tonic-gaterm -rf ${TMPDIR} 12817c478bd9Sstevel@tonic-gatemkdir -p $TMPDIR || exit 1 12827c478bd9Sstevel@tonic-gate 12837c478bd9Sstevel@tonic-gate# 12847c478bd9Sstevel@tonic-gate# Keep elfsign's use of pkcs11_softtoken from looking in the user home 12857c478bd9Sstevel@tonic-gate# directory, which doesn't always work. Needed until all build machines 12867c478bd9Sstevel@tonic-gate# have the fix for 6271754 12877c478bd9Sstevel@tonic-gate# 12887c478bd9Sstevel@tonic-gateSOFTTOKEN_DIR=$TMPDIR 12897c478bd9Sstevel@tonic-gateexport SOFTTOKEN_DIR 12907c478bd9Sstevel@tonic-gate 12917c478bd9Sstevel@tonic-gateTOOLS=${SRC}/tools 12927c478bd9Sstevel@tonic-gateTOOLS_PROTO=${TOOLS}/proto 12937c478bd9Sstevel@tonic-gate 12947c478bd9Sstevel@tonic-gateunset CFLAGS LD_LIBRARY_PATH LDFLAGS 12957c478bd9Sstevel@tonic-gate 12967c478bd9Sstevel@tonic-gate# create directories that are automatically removed if the nightly script 12977c478bd9Sstevel@tonic-gate# fails to start correctly 12987c478bd9Sstevel@tonic-gatenewdir() { 12997c478bd9Sstevel@tonic-gate dir=$1 13007c478bd9Sstevel@tonic-gate toadd= 13017c478bd9Sstevel@tonic-gate while [ ! -d $dir ]; do 13027c478bd9Sstevel@tonic-gate toadd="$dir $toadd" 13037c478bd9Sstevel@tonic-gate dir=`dirname $dir` 13047c478bd9Sstevel@tonic-gate done 13057c478bd9Sstevel@tonic-gate torm= 13067c478bd9Sstevel@tonic-gate newlist= 13077c478bd9Sstevel@tonic-gate for dir in $toadd; do 13087c478bd9Sstevel@tonic-gate if staffer mkdir $dir; then 13097c478bd9Sstevel@tonic-gate newlist="$ISUSER $dir $newlist" 13107c478bd9Sstevel@tonic-gate torm="$dir $torm" 13117c478bd9Sstevel@tonic-gate else 13127c478bd9Sstevel@tonic-gate [ -z "$torm" ] || staffer rmdir $torm 13137c478bd9Sstevel@tonic-gate return 1 13147c478bd9Sstevel@tonic-gate fi 13157c478bd9Sstevel@tonic-gate done 13167c478bd9Sstevel@tonic-gate newdirlist="$newlist $newdirlist" 13177c478bd9Sstevel@tonic-gate return 0 13187c478bd9Sstevel@tonic-gate} 13197c478bd9Sstevel@tonic-gatenewdirlist= 13207c478bd9Sstevel@tonic-gate 13217c478bd9Sstevel@tonic-gate[ -d $CODEMGR_WS ] || newdir $CODEMGR_WS || exit 1 13227c478bd9Sstevel@tonic-gate 13237c478bd9Sstevel@tonic-gate# since this script assumes the build is from full source, it nullifies 13247c478bd9Sstevel@tonic-gate# variables likely to have been set by a "ws" script; nullification 13257c478bd9Sstevel@tonic-gate# confines the search space for headers and libraries to the proto area 13267c478bd9Sstevel@tonic-gate# built from this immediate source. 13277c478bd9Sstevel@tonic-gateENVLDLIBS1= 13287c478bd9Sstevel@tonic-gateENVLDLIBS2= 13297c478bd9Sstevel@tonic-gateENVLDLIBS3= 13307c478bd9Sstevel@tonic-gateENVCPPFLAGS1= 13317c478bd9Sstevel@tonic-gateENVCPPFLAGS2= 13327c478bd9Sstevel@tonic-gateENVCPPFLAGS3= 13337c478bd9Sstevel@tonic-gateENVCPPFLAGS4= 13347c478bd9Sstevel@tonic-gatePARENT_ROOT= 13357c478bd9Sstevel@tonic-gate 13367c478bd9Sstevel@tonic-gateexport ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \ 13377c478bd9Sstevel@tonic-gate PARENT_ROOT 13387c478bd9Sstevel@tonic-gate 13397c478bd9Sstevel@tonic-gateENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib" 13407c478bd9Sstevel@tonic-gateENVCPPFLAGS1="-I$ROOT/usr/include" 13417c478bd9Sstevel@tonic-gate 13427c478bd9Sstevel@tonic-gateexport ENVLDLIBS1 ENVLDLIBS2 13437c478bd9Sstevel@tonic-gate 13447c478bd9Sstevel@tonic-gateCPIODIR_ORIG=$CPIODIR 13457c478bd9Sstevel@tonic-gatePKGARCHIVE_ORIG=$PKGARCHIVE 13467c478bd9Sstevel@tonic-gateIA32_IHV_PKGS_ORIG=$IA32_IHV_PKGS 1347d8fd4470Sjgif [ "$SPARC_RM_PKGARCHIVE" ]; then 13487c478bd9Sstevel@tonic-gate SPARC_RM_PKGARCHIVE_ORIG=$SPARC_RM_PKGARCHIVE 1349d8fd4470Sjgfi 13507c478bd9Sstevel@tonic-gate 13517c478bd9Sstevel@tonic-gate# 13527c478bd9Sstevel@tonic-gate# Juggle the logs and optionally send mail on completion. 13537c478bd9Sstevel@tonic-gate# 13547c478bd9Sstevel@tonic-gate 13557c478bd9Sstevel@tonic-gatelogshuffle() { 13561c79753fSdarrenm LLOG="$ATLOG/log.`date '+%F'`" 13577c478bd9Sstevel@tonic-gate rm -rf $ATLOG/log.??`date '+%d'` 13581c79753fSdarrenm rm -rf $ATLOG/log.????-??-`date '+%d'` 13597c478bd9Sstevel@tonic-gate if [ -f $LLOG -o -d $LLOG ]; then 13607c478bd9Sstevel@tonic-gate LLOG=$LLOG.$$ 13617c478bd9Sstevel@tonic-gate fi 13627c478bd9Sstevel@tonic-gate mkdir $LLOG 13634802ef38Srscott export LLOG 13647c478bd9Sstevel@tonic-gate 13657c478bd9Sstevel@tonic-gate if [ "$build_ok" = "y" ]; then 13667c478bd9Sstevel@tonic-gate mv $ATLOG/proto_list_${MACH} $LLOG 136796ccc8cbSesaxe 136896ccc8cbSesaxe if [ -f $TMPDIR/wsdiff.results ]; then 136996ccc8cbSesaxe mv $TMPDIR/wsdiff.results $LLOG 137096ccc8cbSesaxe fi 13717c478bd9Sstevel@tonic-gate fi 13727c478bd9Sstevel@tonic-gate 13737c478bd9Sstevel@tonic-gate # 13747c478bd9Sstevel@tonic-gate # Now that we're about to send mail, it's time to check the noise 13757c478bd9Sstevel@tonic-gate # file. In the event that an error occurs beyond this point, it will 13767c478bd9Sstevel@tonic-gate # be recorded in the nightly.log file, but nowhere else. This would 13777c478bd9Sstevel@tonic-gate # include only errors that cause the copying of the noise log to fail 13787c478bd9Sstevel@tonic-gate # or the mail itself not to be sent. 13797c478bd9Sstevel@tonic-gate # 13807c478bd9Sstevel@tonic-gate 13817c478bd9Sstevel@tonic-gate exec >>$LOGFILE 2>&1 13827c478bd9Sstevel@tonic-gate if [ -s $build_noise_file ]; then 13837c478bd9Sstevel@tonic-gate echo "\n==== Nightly build noise ====\n" | 13847c478bd9Sstevel@tonic-gate tee -a $LOGFILE >>$mail_msg_file 13857c478bd9Sstevel@tonic-gate cat $build_noise_file >>$LOGFILE 13867c478bd9Sstevel@tonic-gate cat $build_noise_file >>$mail_msg_file 13877c478bd9Sstevel@tonic-gate echo | tee -a $LOGFILE >>$mail_msg_file 13887c478bd9Sstevel@tonic-gate fi 13897c478bd9Sstevel@tonic-gate rm -f $build_noise_file 13907c478bd9Sstevel@tonic-gate 13917c478bd9Sstevel@tonic-gate case "$build_ok" in 13927c478bd9Sstevel@tonic-gate y) 13937c478bd9Sstevel@tonic-gate state=Completed 13947c478bd9Sstevel@tonic-gate ;; 13957c478bd9Sstevel@tonic-gate i) 13967c478bd9Sstevel@tonic-gate state=Interrupted 13977c478bd9Sstevel@tonic-gate ;; 13987c478bd9Sstevel@tonic-gate *) 13997c478bd9Sstevel@tonic-gate state=Failed 14007c478bd9Sstevel@tonic-gate ;; 14017c478bd9Sstevel@tonic-gate esac 140240bc9153Srscott NIGHTLY_STATUS=$state 140340bc9153Srscott export NIGHTLY_STATUS 14047c478bd9Sstevel@tonic-gate 140540bc9153Srscott if [ -n "$POST_NIGHTLY" ]; then 140640bc9153Srscott echo "\n==== Running POST_NIGHTLY command:" \ 140740bc9153Srscott "$POST_NIGHTLY ====\n" | tee -a $mail_msg_file >> $LOGFILE 140840bc9153Srscott $POST_NIGHTLY $state 2>&1 | tee -a $mail_msg_file >> $LOGFILE 14094802ef38Srscott fi 14104802ef38Srscott 14117c478bd9Sstevel@tonic-gate cat $build_time_file $mail_msg_file > ${LLOG}/mail_msg 14127c478bd9Sstevel@tonic-gate if [ "$m_FLAG" = "y" ]; then 14137c478bd9Sstevel@tonic-gate cat $build_time_file $mail_msg_file | 14147c478bd9Sstevel@tonic-gate /usr/bin/mailx -s \ 14157c478bd9Sstevel@tonic-gate "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \ 14167c478bd9Sstevel@tonic-gate ${MAILTO} 14177c478bd9Sstevel@tonic-gate fi 14187c478bd9Sstevel@tonic-gate 14197c478bd9Sstevel@tonic-gate if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 14207c478bd9Sstevel@tonic-gate staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH} 14217c478bd9Sstevel@tonic-gate staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log 14227c478bd9Sstevel@tonic-gate fi 14237c478bd9Sstevel@tonic-gate 14247c478bd9Sstevel@tonic-gate mv $LOGFILE $LLOG 14257c478bd9Sstevel@tonic-gate} 14267c478bd9Sstevel@tonic-gate 14277c478bd9Sstevel@tonic-gate# 14287c478bd9Sstevel@tonic-gate# Remove the locks and temporary files on any exit 14297c478bd9Sstevel@tonic-gate# 14307c478bd9Sstevel@tonic-gatecleanup() { 14317c478bd9Sstevel@tonic-gate logshuffle 14327c478bd9Sstevel@tonic-gate 14337c478bd9Sstevel@tonic-gate [ -z "$lockfile" ] || staffer rm -f $lockfile 14347c478bd9Sstevel@tonic-gate [ -z "$atloglockfile" ] || rm -f $atloglockfile 14357c478bd9Sstevel@tonic-gate [ -z "$ulockfile" ] || staffer rm -f $ulockfile 14367c478bd9Sstevel@tonic-gate [ -z "$Ulockfile" ] || rm -f $Ulockfile 14377c478bd9Sstevel@tonic-gate 14387c478bd9Sstevel@tonic-gate set -- $newdirlist 14397c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 14407c478bd9Sstevel@tonic-gate ISUSER=$1 staffer rmdir $2 14417c478bd9Sstevel@tonic-gate shift; shift 14427c478bd9Sstevel@tonic-gate done 14437c478bd9Sstevel@tonic-gate rm -rf $TMPDIR 14447c478bd9Sstevel@tonic-gate} 14457c478bd9Sstevel@tonic-gate 14467c478bd9Sstevel@tonic-gatecleanup_signal() { 14477c478bd9Sstevel@tonic-gate build_ok=i 14487c478bd9Sstevel@tonic-gate # this will trigger cleanup(), above. 14497c478bd9Sstevel@tonic-gate exit 1 14507c478bd9Sstevel@tonic-gate} 14517c478bd9Sstevel@tonic-gate 14527c478bd9Sstevel@tonic-gatetrap cleanup 0 14537c478bd9Sstevel@tonic-gatetrap cleanup_signal 1 2 3 15 14547c478bd9Sstevel@tonic-gate 14557c478bd9Sstevel@tonic-gate# 14567c478bd9Sstevel@tonic-gate# Generic lock file processing -- make sure that the lock file doesn't 14577c478bd9Sstevel@tonic-gate# exist. If it does, it should name the build host and PID. If it 14587c478bd9Sstevel@tonic-gate# doesn't, then make sure we can create it. Clean up locks that are 14597c478bd9Sstevel@tonic-gate# known to be stale (assumes host name is unique among build systems 14607c478bd9Sstevel@tonic-gate# for the workspace). 14617c478bd9Sstevel@tonic-gatecreate_lock() { 14627c478bd9Sstevel@tonic-gate lockf=$1 14637c478bd9Sstevel@tonic-gate lockvar=$2 14647c478bd9Sstevel@tonic-gate if [ -f $lockf ]; then 14657c478bd9Sstevel@tonic-gate basews=`basename $CODEMGR_WS` 14667c478bd9Sstevel@tonic-gate if read host user pid < $lockf; then 14677c478bd9Sstevel@tonic-gate if [ "$host" != "$hostname" ]; then 14687c478bd9Sstevel@tonic-gate echo "$MACH build of $basews apparently" \ 14697c478bd9Sstevel@tonic-gate "already started by $user on $host as $pid." 14707c478bd9Sstevel@tonic-gate elif kill -s 0 $pid 2>/dev/null; then 14717c478bd9Sstevel@tonic-gate echo "$MACH build of $basews already started" \ 14727c478bd9Sstevel@tonic-gate "by $user as $pid." 14737c478bd9Sstevel@tonic-gate else 14747c478bd9Sstevel@tonic-gate # stale lock; clear it out and continue 14757c478bd9Sstevel@tonic-gate rm -f $lockf 14767c478bd9Sstevel@tonic-gate fi 14777c478bd9Sstevel@tonic-gate else 14787c478bd9Sstevel@tonic-gate echo "$MACH build of $basews already running." 14797c478bd9Sstevel@tonic-gate fi 14807c478bd9Sstevel@tonic-gate fi 14817c478bd9Sstevel@tonic-gate if [ -f $lockf ]; then 14827c478bd9Sstevel@tonic-gate echo "Lock file is $lockf." 14837c478bd9Sstevel@tonic-gate exit 1 14847c478bd9Sstevel@tonic-gate fi 14857c478bd9Sstevel@tonic-gate ldir=`dirname $lockf` 14867c478bd9Sstevel@tonic-gate [ -d $ldir ] || newdir $ldir || exit 1 14877c478bd9Sstevel@tonic-gate eval $lockvar=$lockf 14887c478bd9Sstevel@tonic-gate staffer sh -c "echo $hostname $STAFFER $$ > $lockf" || exit 1 14897c478bd9Sstevel@tonic-gate} 14907c478bd9Sstevel@tonic-gate 14917c478bd9Sstevel@tonic-gate# Ensure no other instance of this script is running on this host. 14927c478bd9Sstevel@tonic-gate# LOCKNAME can be set in <env_file>, and is by default, but is not 14937c478bd9Sstevel@tonic-gate# required due to the use of $ATLOG below. 14947c478bd9Sstevel@tonic-gateif [ -n "$LOCKNAME" ]; then 14957c478bd9Sstevel@tonic-gate create_lock /tmp/$LOCKNAME "lockfile" 14967c478bd9Sstevel@tonic-gatefi 14977c478bd9Sstevel@tonic-gate# 14987c478bd9Sstevel@tonic-gate# Create from one, two, or three other locks: 14997c478bd9Sstevel@tonic-gate# $ATLOG/nightly.lock 15007c478bd9Sstevel@tonic-gate# - protects against multiple builds in same workspace 15017c478bd9Sstevel@tonic-gate# $PARENT_WS/usr/src/nightly.$MACH.lock 15027c478bd9Sstevel@tonic-gate# - protects against multiple 'u' copy-backs 15037c478bd9Sstevel@tonic-gate# $NIGHTLY_PARENT_ROOT/nightly.lock 15047c478bd9Sstevel@tonic-gate# - protects against multiple 'U' copy-backs 15057c478bd9Sstevel@tonic-gate# 15067c478bd9Sstevel@tonic-gate# Overriding ISUSER to 1 causes the lock to be created as root if the 15077c478bd9Sstevel@tonic-gate# script is run as root. The default is to create it as $STAFFER. 15087c478bd9Sstevel@tonic-gateISUSER=1 create_lock $ATLOG/nightly.lock "atloglockfile" 15097c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" ]; then 15107c478bd9Sstevel@tonic-gate create_lock $PARENT_WS/usr/src/nightly.$MACH.lock "ulockfile" 15117c478bd9Sstevel@tonic-gatefi 15127c478bd9Sstevel@tonic-gateif [ "$U_FLAG" = "y" ]; then 15137c478bd9Sstevel@tonic-gate # NIGHTLY_PARENT_ROOT is written as root if script invoked as root. 15147c478bd9Sstevel@tonic-gate ISUSER=1 create_lock $NIGHTLY_PARENT_ROOT/nightly.lock "Ulockfile" 15157c478bd9Sstevel@tonic-gatefi 15167c478bd9Sstevel@tonic-gate 15177c478bd9Sstevel@tonic-gate# Locks have been taken, so we're doing a build and we're committed to 15187c478bd9Sstevel@tonic-gate# the directories we may have created so far. 15197c478bd9Sstevel@tonic-gatenewdirlist= 15207c478bd9Sstevel@tonic-gate 15217c478bd9Sstevel@tonic-gate# 15227c478bd9Sstevel@tonic-gate# Create mail_msg_file 15237c478bd9Sstevel@tonic-gate# 15247c478bd9Sstevel@tonic-gatemail_msg_file="${TMPDIR}/mail_msg" 15257c478bd9Sstevel@tonic-gatetouch $mail_msg_file 15267c478bd9Sstevel@tonic-gatebuild_time_file="${TMPDIR}/build_time" 15277c478bd9Sstevel@tonic-gate# 15287c478bd9Sstevel@tonic-gate# Move old LOGFILE aside 15297c478bd9Sstevel@tonic-gate# ATLOG directory already made by 'create_lock' above 15307c478bd9Sstevel@tonic-gate# 15317c478bd9Sstevel@tonic-gateif [ -f $LOGFILE ]; then 15327c478bd9Sstevel@tonic-gate mv -f $LOGFILE ${LOGFILE}- 15337c478bd9Sstevel@tonic-gatefi 15347c478bd9Sstevel@tonic-gate# 15357c478bd9Sstevel@tonic-gate# Build OsNet source 15367c478bd9Sstevel@tonic-gate# 15377c478bd9Sstevel@tonic-gateSTART_DATE=`date` 15387c478bd9Sstevel@tonic-gateSECONDS=0 15397c478bd9Sstevel@tonic-gateecho "\n==== Nightly $maketype build started: $START_DATE ====" \ 15407c478bd9Sstevel@tonic-gate | tee -a $LOGFILE > $build_time_file 15417c478bd9Sstevel@tonic-gate 15427c478bd9Sstevel@tonic-gate# make sure we log only to the nightly build file 15437c478bd9Sstevel@tonic-gatebuild_noise_file="${TMPDIR}/build_noise" 15447c478bd9Sstevel@tonic-gateexec </dev/null >$build_noise_file 2>&1 15457c478bd9Sstevel@tonic-gate 15467c478bd9Sstevel@tonic-gateecho "\n==== list of environment variables ====\n" >> $LOGFILE 15477c478bd9Sstevel@tonic-gateenv >> $LOGFILE 15487c478bd9Sstevel@tonic-gate 15497c478bd9Sstevel@tonic-gateecho "\n==== Nightly argument issues ====\n" | tee -a $mail_msg_file >> $LOGFILE 15507c478bd9Sstevel@tonic-gate 1551d77e7149Ssommerfeif [ "$P_FLAG" = "y" ]; then 1552d77e7149Ssommerfe obsolete_build GPROF | tee -a $mail_msg_file >> $LOGFILE 1553d77e7149Ssommerfefi 1554d77e7149Ssommerfe 1555d77e7149Ssommerfeif [ "$T_FLAG" = "y" ]; then 1556d77e7149Ssommerfe obsolete_build TRACE | tee -a $mail_msg_file >> $LOGFILE 1557d77e7149Ssommerfefi 1558d77e7149Ssommerfe 15591fe69678Skupferif is_source_build; then 15607c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "y" -o "$i_CMD_LINE_FLAG" = "y" ]; then 15617c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support incremental" \ 15627c478bd9Sstevel@tonic-gate "builds; forcing clobber\n" | tee -a $mail_msg_file >> $LOGFILE 15637c478bd9Sstevel@tonic-gate i_FLAG=n 15647c478bd9Sstevel@tonic-gate i_CMD_LINE_FLAG=n 15657c478bd9Sstevel@tonic-gate fi 15667c478bd9Sstevel@tonic-gate if [ "$N_FLAG" = "n" ]; then 15677c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support protocmp;" \ 15687c478bd9Sstevel@tonic-gate "protocmp disabled\n" | \ 15697c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 15707c478bd9Sstevel@tonic-gate N_FLAG=y 15717c478bd9Sstevel@tonic-gate fi 15727c478bd9Sstevel@tonic-gate if [ "$l_FLAG" = "y" ]; then 15737c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support lint;" \ 15747c478bd9Sstevel@tonic-gate "lint disabled\n" | tee -a $mail_msg_file >> $LOGFILE 15757c478bd9Sstevel@tonic-gate l_FLAG=n 15767c478bd9Sstevel@tonic-gate fi 15777c478bd9Sstevel@tonic-gate if [ "$C_FLAG" = "y" ]; then 15787c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support cstyle;" \ 15797c478bd9Sstevel@tonic-gate "cstyle check disabled\n" | tee -a $mail_msg_file >> $LOGFILE 15807c478bd9Sstevel@tonic-gate C_FLAG=n 15817c478bd9Sstevel@tonic-gate fi 15827c478bd9Sstevel@tonic-gateelse 15837c478bd9Sstevel@tonic-gate if [ "$N_FLAG" = "y" ]; then 15847c478bd9Sstevel@tonic-gate if [ "$p_FLAG" = "y" ]; then 15857c478bd9Sstevel@tonic-gate cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 15867c478bd9Sstevel@tonic-gateWARNING: the p option (create packages) is set, but so is the N option (do 15877c478bd9Sstevel@tonic-gate not run protocmp); this is dangerous; you should unset the N option 15887c478bd9Sstevel@tonic-gateEOF 15897c478bd9Sstevel@tonic-gate else 15907c478bd9Sstevel@tonic-gate cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 15917c478bd9Sstevel@tonic-gateWarning: the N option (do not run protocmp) is set; it probably shouldn't be 15927c478bd9Sstevel@tonic-gateEOF 15937c478bd9Sstevel@tonic-gate fi 15947c478bd9Sstevel@tonic-gate echo "" | tee -a $mail_msg_file >> $LOGFILE 15957c478bd9Sstevel@tonic-gate fi 15967c478bd9Sstevel@tonic-gatefi 15977c478bd9Sstevel@tonic-gate 15987c478bd9Sstevel@tonic-gateif [ "$a_FLAG" = "y" -a "$D_FLAG" = "n" -a "$F_FLAG" = "y" ]; then 15997c478bd9Sstevel@tonic-gate echo "WARNING: Neither DEBUG nor non-DEBUG build requested, but the" \ 16007c478bd9Sstevel@tonic-gate "'a' option was set." | tee -a $mail_msg_file >> $LOGFILE 16017c478bd9Sstevel@tonic-gatefi 16027c478bd9Sstevel@tonic-gate 16037c478bd9Sstevel@tonic-gateif [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 16047c478bd9Sstevel@tonic-gate echo "WARNING: DEBUG build not requested, but lint will be with" \ 16057c478bd9Sstevel@tonic-gate "DEBUG enabled.\n" \ 16067c478bd9Sstevel@tonic-gate | tee -a $mail_msg_file >> $LOGFILE 16077c478bd9Sstevel@tonic-gatefi 16087c478bd9Sstevel@tonic-gate 16097c478bd9Sstevel@tonic-gateif [ "$f_FLAG" = "y" ]; then 16107c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "y" ]; then 16117c478bd9Sstevel@tonic-gate echo "WARNING: the -f flag cannot be used during incremental" \ 16127c478bd9Sstevel@tonic-gate "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE 16137c478bd9Sstevel@tonic-gate f_FLAG=n 16147c478bd9Sstevel@tonic-gate fi 16157c478bd9Sstevel@tonic-gate if [ "$p_FLAG" != "y" -o "$l_FLAG" != "y" ]; then 16167c478bd9Sstevel@tonic-gate echo "WARNING: the -f flag requires -l and -p; ignoring -f\n" | \ 16177c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16187c478bd9Sstevel@tonic-gate f_FLAG=n 16197c478bd9Sstevel@tonic-gate fi 16207c478bd9Sstevel@tonic-gatefi 16217c478bd9Sstevel@tonic-gate 162296ccc8cbSesaxeif [ "$w_FLAG" = "y" -a ! -d $ROOT ]; then 162396ccc8cbSesaxe echo "WARNING: -w specified, but no pre-existing proto area found;" \ 162496ccc8cbSesaxe "ignoring -w\n" | tee -a $mail_msg_file >> $LOGFILE 162596ccc8cbSesaxe w_FLAG=n 162696ccc8cbSesaxefi 162796ccc8cbSesaxe 16287c478bd9Sstevel@tonic-gateif [ "$t_FLAG" = "n" ]; then 16297c478bd9Sstevel@tonic-gate # 16307c478bd9Sstevel@tonic-gate # We're not doing a tools build, so make sure elfsign(1) is 16317c478bd9Sstevel@tonic-gate # new enough to safely sign non-crypto binaries. We test 16327c478bd9Sstevel@tonic-gate # debugging output from elfsign to detect the old version. 16337c478bd9Sstevel@tonic-gate # 16347c478bd9Sstevel@tonic-gate newelfsigntest=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \ 16357c478bd9Sstevel@tonic-gate -e /usr/lib/security/pkcs11_softtoken.so.1 2>&1 \ 16367c478bd9Sstevel@tonic-gate | egrep algorithmOID` 16377c478bd9Sstevel@tonic-gate if [ -z "$newelfsigntest" ]; then 16387c478bd9Sstevel@tonic-gate echo "WARNING: /usr/bin/elfsign out of date;" \ 16397c478bd9Sstevel@tonic-gate "will only sign crypto modules\n" | \ 16407c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16417c478bd9Sstevel@tonic-gate export ELFSIGN_OBJECT=true 16427c478bd9Sstevel@tonic-gate elif [ "$VERIFY_ELFSIGN" = "y" ]; then 16437c478bd9Sstevel@tonic-gate echo "WARNING: VERIFY_ELFSIGN=y requires" \ 16447c478bd9Sstevel@tonic-gate "the -t flag; ignoring VERIFY_ELFSIGN\n" | \ 16457c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16467c478bd9Sstevel@tonic-gate fi 16477c478bd9Sstevel@tonic-gatefi 16487c478bd9Sstevel@tonic-gate 16497c478bd9Sstevel@tonic-gateecho "==== Build environment ====\n" | tee -a $mail_msg_file >> $LOGFILE 16507c478bd9Sstevel@tonic-gate 16517c478bd9Sstevel@tonic-gate# System 16527c478bd9Sstevel@tonic-gatewhence uname | tee -a $mail_msg_file >> $LOGFILE 16537c478bd9Sstevel@tonic-gateuname -a 2>&1 | tee -a $mail_msg_file >> $LOGFILE 16547c478bd9Sstevel@tonic-gateecho | tee -a $mail_msg_file >> $LOGFILE 16557c478bd9Sstevel@tonic-gate 16567c478bd9Sstevel@tonic-gate# nightly (will fail in year 2100 due to SCCS flaw) 16577c478bd9Sstevel@tonic-gateecho "$0 $@" | tee -a $mail_msg_file >> $LOGFILE 16587c478bd9Sstevel@tonic-gateecho "%M% version %I% 20%E%\n" | tee -a $mail_msg_file >> $LOGFILE 16597c478bd9Sstevel@tonic-gate 16607c478bd9Sstevel@tonic-gate# make 16617c478bd9Sstevel@tonic-gatewhence $MAKE | tee -a $mail_msg_file >> $LOGFILE 16627c478bd9Sstevel@tonic-gate$MAKE -v | tee -a $mail_msg_file >> $LOGFILE 16637c478bd9Sstevel@tonic-gateecho "number of concurrent jobs = $DMAKE_MAX_JOBS" | 16647c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16657c478bd9Sstevel@tonic-gate 16667c478bd9Sstevel@tonic-gate# 16677c478bd9Sstevel@tonic-gate# Report the compiler versions. 16687c478bd9Sstevel@tonic-gate# 16697c478bd9Sstevel@tonic-gateif [ -f $SRC/Makefile ]; then 16707c478bd9Sstevel@tonic-gate srcroot=$SRC 16717c478bd9Sstevel@tonic-gateelif [ -f $BRINGOVER_WS/usr/src/Makefile ]; then 16727c478bd9Sstevel@tonic-gate srcroot=$BRINGOVER_WS/usr/src 16737c478bd9Sstevel@tonic-gateelse 16747c478bd9Sstevel@tonic-gate echo "\nUnable to find \"Makefile\" in $BRINGOVER_WS/usr/src or $SRC." | 16757c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16767c478bd9Sstevel@tonic-gate exit 1 16777c478bd9Sstevel@tonic-gatefi 16787c478bd9Sstevel@tonic-gate 16797c478bd9Sstevel@tonic-gate( cd $srcroot 16807c478bd9Sstevel@tonic-gate for target in cc-version cc64-version java-version; do 16817c478bd9Sstevel@tonic-gate echo 16827c478bd9Sstevel@tonic-gate # 16837c478bd9Sstevel@tonic-gate # Put statefile somewhere we know we can write to rather than trip 1684b84bdc30Smeem # over a read-only $srcroot. 16857c478bd9Sstevel@tonic-gate # 16867c478bd9Sstevel@tonic-gate rm -f $TMPDIR/make-state 168732f1e47bSsommerfe export SRC=$srcroot 1688b84bdc30Smeem if $MAKE -K $TMPDIR/make-state -e $target 2>/dev/null; then 16897c478bd9Sstevel@tonic-gate continue 16907c478bd9Sstevel@tonic-gate fi 16917c478bd9Sstevel@tonic-gate touch $TMPDIR/nocompiler 16927c478bd9Sstevel@tonic-gate done 16937c478bd9Sstevel@tonic-gate echo 16947c478bd9Sstevel@tonic-gate) | tee -a $mail_msg_file >> $LOGFILE 16957c478bd9Sstevel@tonic-gate 16967c478bd9Sstevel@tonic-gateif [ -f $TMPDIR/nocompiler ]; then 16977c478bd9Sstevel@tonic-gate rm -f $TMPDIR/nocompiler 16987c478bd9Sstevel@tonic-gate build_ok=n 16997c478bd9Sstevel@tonic-gate echo "Aborting due to missing compiler." | 17007c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17017c478bd9Sstevel@tonic-gate exit 1 17027c478bd9Sstevel@tonic-gatefi 17037c478bd9Sstevel@tonic-gate 17047c478bd9Sstevel@tonic-gate# as 17057c478bd9Sstevel@tonic-gatewhence as | tee -a $mail_msg_file >> $LOGFILE 17067c478bd9Sstevel@tonic-gateas -V 2>&1 | head -1 | tee -a $mail_msg_file >> $LOGFILE 17077c478bd9Sstevel@tonic-gateecho | tee -a $mail_msg_file >> $LOGFILE 17087c478bd9Sstevel@tonic-gate 17097c478bd9Sstevel@tonic-gate# Check that we're running a capable link-editor 17107c478bd9Sstevel@tonic-gatewhence ld | tee -a $mail_msg_file >> $LOGFILE 17117c478bd9Sstevel@tonic-gateLDVER=`ld -V 2>&1` 17127c478bd9Sstevel@tonic-gateecho $LDVER | tee -a $mail_msg_file >> $LOGFILE 17137c478bd9Sstevel@tonic-gateLDVER=`echo $LDVER | sed -e "s/.*-1\.//" -e "s/:.*//"` 17147c478bd9Sstevel@tonic-gateif [ `expr $LDVER \< 422` -eq 1 ]; then 17157c478bd9Sstevel@tonic-gate echo "The link-editor needs to be at version 422 or higher to build" | \ 17167c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17177c478bd9Sstevel@tonic-gate echo "the latest stuff, hope your build works." | \ 17187c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17197c478bd9Sstevel@tonic-gatefi 17207c478bd9Sstevel@tonic-gate 17217c478bd9Sstevel@tonic-gateecho "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \ 17227c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17237c478bd9Sstevel@tonic-gate 17247c478bd9Sstevel@tonic-gateecho "\n==== Build version ====\n" | tee -a $mail_msg_file >> $LOGFILE 17257c478bd9Sstevel@tonic-gateecho $VERSION | tee -a $mail_msg_file >> $LOGFILE 17267c478bd9Sstevel@tonic-gate 172796ccc8cbSesaxe# Save the current proto area if we're comparing against the last build 172896ccc8cbSesaxeif [ "$w_FLAG" = "y" -a -d "$ROOT" ]; then 172996ccc8cbSesaxe if [ -d "$ROOT.prev" ]; then 173096ccc8cbSesaxe rm -rf $ROOT.prev 173196ccc8cbSesaxe fi 173296ccc8cbSesaxe mv $ROOT $ROOT.prev 173396ccc8cbSesaxefi 173496ccc8cbSesaxe 17357c478bd9Sstevel@tonic-gate# 17367c478bd9Sstevel@tonic-gate# Decide whether to clobber 17377c478bd9Sstevel@tonic-gate# 17387c478bd9Sstevel@tonic-gateif [ "$i_FLAG" = "n" -a -d "$SRC" ]; then 17397c478bd9Sstevel@tonic-gate echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE 17407c478bd9Sstevel@tonic-gate 17417c478bd9Sstevel@tonic-gate cd $SRC 17427c478bd9Sstevel@tonic-gate # remove old clobber file 17437c478bd9Sstevel@tonic-gate rm -f $SRC/clobber.out 17447c478bd9Sstevel@tonic-gate rm -f $SRC/clobber-${MACH}.out 17457c478bd9Sstevel@tonic-gate 17467c478bd9Sstevel@tonic-gate # Remove all .make.state* files, just in case we are restarting 17477c478bd9Sstevel@tonic-gate # the build after having interrupted a previous 'make clobber'. 17487c478bd9Sstevel@tonic-gate find . \( -name SCCS -o -name 'interfaces.*' \) -prune \ 17497c478bd9Sstevel@tonic-gate -o -name '.make.*' -print | xargs rm -f 17507c478bd9Sstevel@tonic-gate 17517c478bd9Sstevel@tonic-gate $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE 17527c478bd9Sstevel@tonic-gate echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file 17537c478bd9Sstevel@tonic-gate grep "$MAKE:" $SRC/clobber-${MACH}.out | 17547c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 17557c478bd9Sstevel@tonic-gate >> $mail_msg_file 17567c478bd9Sstevel@tonic-gate 17577c478bd9Sstevel@tonic-gate if [ "$t_FLAG" = "y" ]; then 17587c478bd9Sstevel@tonic-gate echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE 17597c478bd9Sstevel@tonic-gate cd ${TOOLS} 17607c478bd9Sstevel@tonic-gate rm -f ${TOOLS}/clobber-${MACH}.out 17617c478bd9Sstevel@tonic-gate $MAKE -ek clobber 2>&1 | \ 17627c478bd9Sstevel@tonic-gate tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE 17637c478bd9Sstevel@tonic-gate echo "\n==== Make tools clobber ERRORS ====\n" \ 17647c478bd9Sstevel@tonic-gate >> $mail_msg_file 17657c478bd9Sstevel@tonic-gate grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \ 17667c478bd9Sstevel@tonic-gate >> $mail_msg_file 17677c478bd9Sstevel@tonic-gate rm -rf ${TOOLS_PROTO} 17687c478bd9Sstevel@tonic-gate mkdir -p ${TOOLS_PROTO} 17697c478bd9Sstevel@tonic-gate fi 177096ccc8cbSesaxe 1771534f4022Sdduvall rm -rf $ROOT 17727c478bd9Sstevel@tonic-gate 17737c478bd9Sstevel@tonic-gate # Get back to a clean workspace as much as possible to catch 17747c478bd9Sstevel@tonic-gate # problems that only occur on fresh workspaces. 17757c478bd9Sstevel@tonic-gate # Remove all .make.state* files, libraries, and .o's that may 1776fb23a357Skupfer # have been omitted from clobber. A couple of libraries are 1777fb23a357Skupfer # under SCCS, so leave them alone. 17787c478bd9Sstevel@tonic-gate # We should probably blow away temporary directories too. 17797c478bd9Sstevel@tonic-gate cd $SRC 1780fb23a357Skupfer find $relsrcdirs \( -name SCCS -o -name 'interfaces.*' \) -prune -o \ 17817c478bd9Sstevel@tonic-gate \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \ 1782fb23a357Skupfer -name '*.o' \) -print | \ 1783fb23a357Skupfer grep -v 'tools/ctf/dwarf/.*/libdwarf' | xargs rm -f 17847c478bd9Sstevel@tonic-gateelse 17857c478bd9Sstevel@tonic-gate echo "\n==== No clobber at `date` ====\n" >> $LOGFILE 17867c478bd9Sstevel@tonic-gatefi 17877c478bd9Sstevel@tonic-gate 17887c478bd9Sstevel@tonic-gate# 17897c478bd9Sstevel@tonic-gate# Decide whether to bringover to the codemgr workspace 17907c478bd9Sstevel@tonic-gate# 17917c478bd9Sstevel@tonic-gateif [ "$n_FLAG" = "n" ]; then 17927c478bd9Sstevel@tonic-gate echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE 17937c478bd9Sstevel@tonic-gate # sleep on the parent workspace's lock 17947c478bd9Sstevel@tonic-gate while egrep -s write $BRINGOVER_WS/Codemgr_wsdata/locks 17957c478bd9Sstevel@tonic-gate do 17967c478bd9Sstevel@tonic-gate sleep 120 17977c478bd9Sstevel@tonic-gate done 17987c478bd9Sstevel@tonic-gate 17997c478bd9Sstevel@tonic-gate echo "\n==== BRINGOVER LOG ====\n" >> $mail_msg_file 180032f1e47bSsommerfe 180132f1e47bSsommerfe (staffer $TEAMWARE/bin/bringover -c "nightly update" -p $BRINGOVER_WS \ 180232f1e47bSsommerfe -w $CODEMGR_WS $BRINGOVER_FILES < /dev/null 2>&1 || 180332f1e47bSsommerfe touch $TMPDIR/bringover_failed 180432f1e47bSsommerfe 1805d77e7149Ssommerfe staffer bringovercheck $CODEMGR_WS >$TMPDIR/bringovercheck.out 2>&1 1806d77e7149Ssommerfe 1807d77e7149Ssommerfe if [ -s $TMPDIR/bringovercheck.out ]; then 1808d77e7149Ssommerfe echo "\n==== POST-BRINGOVER CLEANUP NOISE ====\n" 1809d77e7149Ssommerfe cat $TMPDIR/bringovercheck.out 1810d77e7149Ssommerfe fi 181132f1e47bSsommerfe 181232f1e47bSsommerfe ) | tee -a $mail_msg_file >> $LOGFILE 181332f1e47bSsommerfe 181432f1e47bSsommerfe if [ -f $TMPDIR/bringover_failed ]; then 181532f1e47bSsommerfe rm -f $TMPDIR/bringover_failed 181632f1e47bSsommerfe build_ok=n 181732f1e47bSsommerfe echo "trouble with bringover, quitting at `date`." | 18187c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 18197c478bd9Sstevel@tonic-gate exit 1 18207c478bd9Sstevel@tonic-gate fi 1821085d331dSkupfer 1822085d331dSkupfer # 1823085d331dSkupfer # Possible transition from pre-split workspace to split 1824085d331dSkupfer # workspace. See if the bringover changed anything. 1825085d331dSkupfer # 1826085d331dSkupfer CLOSED_IS_PRESENT="$orig_closed_is_present" 1827085d331dSkupfer check_closed_tree 18287c478bd9Sstevel@tonic-gateelse 18297c478bd9Sstevel@tonic-gate echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE 18307c478bd9Sstevel@tonic-gatefi 18317c478bd9Sstevel@tonic-gate 18327c478bd9Sstevel@tonic-gate# 18337c478bd9Sstevel@tonic-gate# Build tools if requested 18347c478bd9Sstevel@tonic-gate# 18357c478bd9Sstevel@tonic-gateif [ "$t_FLAG" = "y" ]; then 18367c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 18377c478bd9Sstevel@tonic-gate export RELEASE_BUILD ; RELEASE_BUILD= 18387c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 18397c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 18407c478bd9Sstevel@tonic-gate 18417c478bd9Sstevel@tonic-gate export ONBLD_TOOLS=${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld} 18427c478bd9Sstevel@tonic-gate build_tools ${TOOLS_PROTO} 18437c478bd9Sstevel@tonic-gatefi 18447c478bd9Sstevel@tonic-gate 18456fec3625Sdduvall# 18466fec3625Sdduvall# copy ihv proto area in addition to the build itself 18476fec3625Sdduvall# 18486fec3625Sdduvallif [ "$X_FLAG" = "y" ]; then 18496fec3625Sdduvall copy_ihv_proto 18506fec3625Sdduvallfi 18516fec3625Sdduvall 18527c478bd9Sstevel@tonic-gateif [ "$i_FLAG" = "y" -a "$SH_FLAG" = "y" ]; then 18537c478bd9Sstevel@tonic-gate echo "\n==== NOT Building base OS-Net source ====\n" | \ 18547c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 18557c478bd9Sstevel@tonic-gateelse 18567c478bd9Sstevel@tonic-gate normal_build 18577c478bd9Sstevel@tonic-gatefi 18587c478bd9Sstevel@tonic-gate 18597c478bd9Sstevel@tonic-gateORIG_SRC=$SRC 18607c478bd9Sstevel@tonic-gateBINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z 18617c478bd9Sstevel@tonic-gate 18621fe69678Skupfer# 18631fe69678Skupfer# For the "open" build, we don't mung any source files, so skip this 18641fe69678Skupfer# step. 18651fe69678Skupfer# 18667c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 18677c478bd9Sstevel@tonic-gate save_binaries 18687c478bd9Sstevel@tonic-gate 18697c478bd9Sstevel@tonic-gate echo "\n==== Retrieving SCCS files at `date` ====\n" >> $LOGFILE 18707c478bd9Sstevel@tonic-gate SCCSHELPER=${TMPDIR}/sccs-helper 18717c478bd9Sstevel@tonic-gate rm -f ${SCCSHELPER} 18727c478bd9Sstevel@tonic-gatecat >${SCCSHELPER} <<EOF 18737c478bd9Sstevel@tonic-gate#!/bin/ksh 18747c478bd9Sstevel@tonic-gatecd \$1 18757c478bd9Sstevel@tonic-gatecd .. 18767c478bd9Sstevel@tonic-gatesccs get SCCS >/dev/null 2>&1 18777c478bd9Sstevel@tonic-gateEOF 18787c478bd9Sstevel@tonic-gate cd $SRC 18797c478bd9Sstevel@tonic-gate chmod +x ${SCCSHELPER} 1880fb23a357Skupfer find $relsrcdirs -name SCCS | xargs -L 1 ${SCCSHELPER} 18817c478bd9Sstevel@tonic-gate rm -f ${SCCSHELPER} 18827c478bd9Sstevel@tonic-gatefi 18837c478bd9Sstevel@tonic-gate 18847c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 18851fe69678Skupfer set_up_source_build ${CODEMGR_WS} ${CRYPT_SRC} CRYPT_SRC 18867c478bd9Sstevel@tonic-gatefi 18877c478bd9Sstevel@tonic-gate 18887c478bd9Sstevel@tonic-gate# EXPORT_SRC comes after CRYPT_SRC since a domestic build will need 18897c478bd9Sstevel@tonic-gate# $SRC pointing to the export_source usr/src. 18907c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 18911fe69678Skupfer set_up_source_build ${CODEMGR_WS} ${EXPORT_SRC} EXPORT_SRC 18927c478bd9Sstevel@tonic-gatefi 18937c478bd9Sstevel@tonic-gate 18947c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 18957c478bd9Sstevel@tonic-gate # drop the crypt files in place. 18967c478bd9Sstevel@tonic-gate cd ${EXPORT_SRC} 18977c478bd9Sstevel@tonic-gate echo "\nextracting crypt_files.cpio.Z onto export_source.\n" \ 18987c478bd9Sstevel@tonic-gate >> ${LOGFILE} 18997c478bd9Sstevel@tonic-gate zcat ${CODEMGR_WS}/crypt_files.cpio.Z | \ 19007c478bd9Sstevel@tonic-gate cpio -idmucvB 2>/dev/null >> ${LOGFILE} 19017c478bd9Sstevel@tonic-gate if [ "$?" = "0" ]; then 19027c478bd9Sstevel@tonic-gate echo "\n==== DOMESTIC extraction succeeded ====\n" \ 19037c478bd9Sstevel@tonic-gate >> $mail_msg_file 19047c478bd9Sstevel@tonic-gate else 19057c478bd9Sstevel@tonic-gate echo "\n==== DOMESTIC extraction failed ====\n" \ 19067c478bd9Sstevel@tonic-gate >> $mail_msg_file 19077c478bd9Sstevel@tonic-gate fi 19087c478bd9Sstevel@tonic-gate 19097c478bd9Sstevel@tonic-gatefi 19107c478bd9Sstevel@tonic-gate 19111fe69678Skupferif [ "$SO_FLAG" = "y" ]; then 19121fe69678Skupfer # 19131fe69678Skupfer # Copy the open sources into their own tree, set up the closed 19141fe69678Skupfer # binaries, and set up the environment. 19151fe69678Skupfer # 19161fe69678Skupfer copy_source $CODEMGR_WS $OPEN_SRCDIR OPEN_SOURCE usr/src 19171fe69678Skupfer SRC=$OPEN_SRCDIR/usr/src 19181fe69678Skupfer 19191fe69678Skupfer # Try not to clobber any user-provided closed binaries. 19201fe69678Skupfer export ON_CLOSED_BINS=$CODEMGR_WS/closed$$ 19211fe69678Skupfer echo "\n==== Copying skeleton closed binaries to $ON_CLOSED_BINS ====\n" | \ 19221fe69678Skupfer tee -a $mail_msg_file >> $LOGFILE 19231fe69678Skupfer mkclosed $MACH $CODEMGR_WS/proto $ON_CLOSED_BINS >>$LOGFILE 2>&1 19241fe69678Skupfer if [ $? -ne 0 ]; then 19251fe69678Skupfer build_ok=n 19261fe69678Skupfer echo "Aborting (couldn't create closed binaries)." | 19271fe69678Skupfer tee -a $mail_msg_file >> $LOGFILE 19281fe69678Skupfer fi 19291fe69678Skupfer CLOSED_IS_PRESENT=no 19301fe69678Skupferfi 19311fe69678Skupfer 19321fe69678Skupferif is_source_build && [ $build_ok = y ] ; then 19337c478bd9Sstevel@tonic-gate # remove proto area here, since we don't clobber 1934534f4022Sdduvall rm -rf "$ROOT" 19357c478bd9Sstevel@tonic-gate if [ "$t_FLAG" = "y" ]; then 19367c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 19377c478bd9Sstevel@tonic-gate export RELEASE_BUILD ; RELEASE_BUILD= 19387c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 19397c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 1940b91d9e0fSdanmcd ORIG_TOOLS=$TOOLS 19411fe69678Skupfer # 19421fe69678Skupfer # SRC was set earlier to point to the source build 19431fe69678Skupfer # source tree (e.g., $EXPORT_SRC). 19441fe69678Skupfer # 19451fe69678Skupfer TOOLS=${SRC}/tools 19461fe69678Skupfer build_tools ${SRC}/tools/proto 1947b91d9e0fSdanmcd TOOLS=$ORIG_TOOLS 19487c478bd9Sstevel@tonic-gate fi 19497c478bd9Sstevel@tonic-gate 19507c478bd9Sstevel@tonic-gate export EXPORT_RELEASE_BUILD ; EXPORT_RELEASE_BUILD=# 19517c478bd9Sstevel@tonic-gate normal_build 19527c478bd9Sstevel@tonic-gatefi 19537c478bd9Sstevel@tonic-gate 19541fe69678Skupferif [[ "$SO_FLAG" = "y" && "$build_ok" = "y" ]]; then 19551fe69678Skupfer rm -rf $ON_CLOSED_BINS 19561fe69678Skupferfi 19571fe69678Skupfer 19587c478bd9Sstevel@tonic-gateif [ "$build_ok" = "y" ]; then 19597c478bd9Sstevel@tonic-gate echo "\n==== Creating protolist system file at `date` ====" \ 19607c478bd9Sstevel@tonic-gate >> $LOGFILE 19617c478bd9Sstevel@tonic-gate protolist $ROOT > $ATLOG/proto_list_${MACH} 19627c478bd9Sstevel@tonic-gate echo "==== protolist system file created at `date` ====\n" \ 19637c478bd9Sstevel@tonic-gate >> $LOGFILE 19647c478bd9Sstevel@tonic-gate 19657c478bd9Sstevel@tonic-gate if [ "$N_FLAG" != "y" ]; then 19667c478bd9Sstevel@tonic-gate echo "\n==== Impact on packages ====\n" >> $mail_msg_file 19677c478bd9Sstevel@tonic-gate 19687c478bd9Sstevel@tonic-gate # If there is a reference proto list, compare the build's proto 19697c478bd9Sstevel@tonic-gate # list with the reference to see changes in proto areas. 19707c478bd9Sstevel@tonic-gate # Use the current exception list. 19717c478bd9Sstevel@tonic-gate exc=etc/exception_list_$MACH 19727c478bd9Sstevel@tonic-gate if [ -f $SRC/pkgdefs/$exc ]; then 19737c478bd9Sstevel@tonic-gate ELIST="-e $SRC/pkgdefs/$exc" 19747c478bd9Sstevel@tonic-gate fi 19756fec3625Sdduvall if [ "$X_FLAG" = "y" -a -f $IA32_IHV_WS/usr/src/pkgdefs/$exc ]; then 19766fec3625Sdduvall ELIST="$ELIST -e $IA32_IHV_WS/usr/src/pkgdefs/$exc" 19776fec3625Sdduvall fi 19787c478bd9Sstevel@tonic-gate 19797c478bd9Sstevel@tonic-gate if [ -f "$REF_PROTO_LIST" ]; then 1980b4add148Sdduvall # For builds that copy the IHV proto area (-X), add the 1981b4add148Sdduvall # IHV proto list to the reference list if the reference 1982b4add148Sdduvall # was built without -X. 1983b4add148Sdduvall # 1984b4add148Sdduvall # For builds that don't copy the IHV proto area, add the 1985b4add148Sdduvall # IHV proto list to the build's proto list if the 1986b4add148Sdduvall # reference was built with -X. 1987b4add148Sdduvall # 1988b4add148Sdduvall # Use the presence of the first file entry of the cached 1989b4add148Sdduvall # IHV proto list in the reference list to determine 1990b4add148Sdduvall # whether it was build with -X or not. 1991b4add148Sdduvall IHV_REF_PROTO_LIST=$SRC/pkgdefs/etc/proto_list_ihv_$MACH 1992b4add148Sdduvall grepfor=$(nawk '$1 == "f" { print $2; exit }' \ 1993b4add148Sdduvall $IHV_REF_PROTO_LIST 2> /dev/null) 1994b4add148Sdduvall if [ $? = 0 -a -n "$grepfor" ]; then 1995b4add148Sdduvall if [ "$X_FLAG" = "y" ]; then 1996b4add148Sdduvall grep -w "$grepfor" \ 1997b4add148Sdduvall $REF_PROTO_LIST > /dev/null 1998b4add148Sdduvall if [ ! "$?" = "0" ]; then 1999b4add148Sdduvall REF_IHV_PROTO="-d $IHV_REF_PROTO_LIST" 2000b4add148Sdduvall fi 2001b4add148Sdduvall else 2002b4add148Sdduvall grep -w "$grepfor" \ 2003b4add148Sdduvall $REF_PROTO_LIST > /dev/null 2004b4add148Sdduvall if [ "$?" = "0" ]; then 2005b4add148Sdduvall IHV_PROTO_LIST="$IHV_REF_PROTO_LIST" 2006b4add148Sdduvall fi 2007b4add148Sdduvall fi 2008b4add148Sdduvall fi 2009b4add148Sdduvall 20107c478bd9Sstevel@tonic-gate $PROTOCMPTERSE \ 20117c478bd9Sstevel@tonic-gate "Files in yesterday's proto area, but not today's:" \ 20127c478bd9Sstevel@tonic-gate "Files in today's proto area, but not yesterday's:" \ 20137c478bd9Sstevel@tonic-gate "Files that changed between yesterday and today:" \ 20147c478bd9Sstevel@tonic-gate ${ELIST} \ 20157c478bd9Sstevel@tonic-gate -d $REF_PROTO_LIST \ 2016b4add148Sdduvall $REF_IHV_PROTO \ 20177c478bd9Sstevel@tonic-gate $ATLOG/proto_list_${MACH} \ 2018b4add148Sdduvall $IHV_PROTO_LIST \ 20197c478bd9Sstevel@tonic-gate >> $mail_msg_file 20207c478bd9Sstevel@tonic-gate fi 20217c478bd9Sstevel@tonic-gate # Compare the build's proto list with current package 20227c478bd9Sstevel@tonic-gate # definitions to audit the quality of package definitions 20237c478bd9Sstevel@tonic-gate # and makefile install targets. Use the current exception list. 2024fb23a357Skupfer PKGDEFS_LIST="" 2025fb23a357Skupfer for d in $abssrcdirs; do 2026fb23a357Skupfer if [ -d $d/pkgdefs ]; then 2027fb23a357Skupfer PKGDEFS_LIST="$PKGDEFS_LIST -d $d/pkgdefs" 2028fb23a357Skupfer fi 2029fb23a357Skupfer done 20306fec3625Sdduvall if [ "$X_FLAG" = "y" -a -d $IA32_IHV_WS/usr/src/pkgdefs ]; then 20316fec3625Sdduvall PKGDEFS_LIST="$PKGDEFS_LIST -d $IA32_IHV_WS/usr/src/pkgdefs" 20326fec3625Sdduvall fi 20337c478bd9Sstevel@tonic-gate 20347c478bd9Sstevel@tonic-gate $PROTOCMPTERSE \ 20357c478bd9Sstevel@tonic-gate "Files missing from the proto area:" \ 20367c478bd9Sstevel@tonic-gate "Files missing from packages:" \ 20377c478bd9Sstevel@tonic-gate "Inconsistencies between pkgdefs and proto area:" \ 20387c478bd9Sstevel@tonic-gate ${ELIST} \ 20397c478bd9Sstevel@tonic-gate ${PKGDEFS_LIST} \ 20407c478bd9Sstevel@tonic-gate $ATLOG/proto_list_${MACH} \ 20417c478bd9Sstevel@tonic-gate >> $mail_msg_file 20427c478bd9Sstevel@tonic-gate fi 20437c478bd9Sstevel@tonic-gatefi 20447c478bd9Sstevel@tonic-gate 20457c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 20467c478bd9Sstevel@tonic-gate staffer cp $ATLOG/proto_list_${MACH} \ 20477c478bd9Sstevel@tonic-gate $PARENT_WS/usr/src/proto_list_${MACH} 20487c478bd9Sstevel@tonic-gatefi 20497c478bd9Sstevel@tonic-gate 20507c478bd9Sstevel@tonic-gate# Update parent proto area if necessary. This is done now 20517c478bd9Sstevel@tonic-gate# so that the proto area has either DEBUG or non-DEBUG kernels. 20527c478bd9Sstevel@tonic-gate# Note that this clears out the lock file, so we can dispense with 20537c478bd9Sstevel@tonic-gate# the variable now. 20547c478bd9Sstevel@tonic-gateif [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then 20557c478bd9Sstevel@tonic-gate echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \ 20567c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 20577c478bd9Sstevel@tonic-gate # The rm -rf command below produces predictable errors if 20587c478bd9Sstevel@tonic-gate # nightly is invoked from the parent's $ROOT/opt/onbld/bin, 20597c478bd9Sstevel@tonic-gate # and that directory is accessed via NFS. This is because 20607c478bd9Sstevel@tonic-gate # deleted-but-still-open files don't actually disappear as 20617c478bd9Sstevel@tonic-gate # expected, but rather turn into .nfsXXXX junk files, leaving 20627c478bd9Sstevel@tonic-gate # the directory non-empty. Since this is a not-unusual usage 20637c478bd9Sstevel@tonic-gate # pattern, and we still want to catch other errors here, we 20647c478bd9Sstevel@tonic-gate # take the unusal step of moving aside 'nightly' from that 20657c478bd9Sstevel@tonic-gate # directory (if we're using it). 20667c478bd9Sstevel@tonic-gate mypath=${0##*/root_$MACH/} 20677c478bd9Sstevel@tonic-gate if [ "$mypath" = $0 ]; then 20687c478bd9Sstevel@tonic-gate mypath=opt/onbld/bin/${0##*/} 20697c478bd9Sstevel@tonic-gate fi 20707c478bd9Sstevel@tonic-gate if [ $0 -ef $PARENT_WS/proto/root_$MACH/$mypath ]; then 20717c478bd9Sstevel@tonic-gate mv -f $0 $PARENT_WS/proto/root_$MACH 20727c478bd9Sstevel@tonic-gate fi 20737c478bd9Sstevel@tonic-gate rm -rf $PARENT_WS/proto/root_$MACH/* 20747c478bd9Sstevel@tonic-gate unset Ulockfile 20757c478bd9Sstevel@tonic-gate mkdir -p $NIGHTLY_PARENT_ROOT 20767c478bd9Sstevel@tonic-gate cd $ROOT 20777c478bd9Sstevel@tonic-gate ( tar cf - . | ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf - ) ) 2>&1 | 20787c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 20797c478bd9Sstevel@tonic-gatefi 20807c478bd9Sstevel@tonic-gate 20817c478bd9Sstevel@tonic-gate# 20827c478bd9Sstevel@tonic-gate# do shared library interface verification 20837c478bd9Sstevel@tonic-gate# 20847c478bd9Sstevel@tonic-gate 20857c478bd9Sstevel@tonic-gateif [ "$A_FLAG" = "y" -a "$build_ok" = "y" ]; then 20867c478bd9Sstevel@tonic-gate echo "\n==== Check versioning and ABI information ====\n" | \ 20877c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 20887c478bd9Sstevel@tonic-gate 20897c478bd9Sstevel@tonic-gate rm -rf $SRC/interfaces.ref 20907c478bd9Sstevel@tonic-gate if [ -d $SRC/interfaces.out ]; then 20917c478bd9Sstevel@tonic-gate mv $SRC/interfaces.out $SRC/interfaces.ref 20927c478bd9Sstevel@tonic-gate fi 20937c478bd9Sstevel@tonic-gate rm -rf $SRC/interfaces.out 20947c478bd9Sstevel@tonic-gate mkdir -p $SRC/interfaces.out 20957c478bd9Sstevel@tonic-gate 20967c478bd9Sstevel@tonic-gate intf_check -V -m -o -b $SRC/tools/abi/etc \ 20977c478bd9Sstevel@tonic-gate -d $SRC/interfaces.out $ROOT 2>&1 | sort \ 20987c478bd9Sstevel@tonic-gate > $SRC/interfaces.out/log 20997c478bd9Sstevel@tonic-gate 21007c478bd9Sstevel@tonic-gate # report any ERROR found in log file 21017c478bd9Sstevel@tonic-gate fgrep 'ERROR' $SRC/interfaces.out/log | sed 's/^ERROR: //' | \ 21027c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21037c478bd9Sstevel@tonic-gate 21047c478bd9Sstevel@tonic-gate if [ ! -d $SRC/interfaces.ref ] ; then 21057c478bd9Sstevel@tonic-gate mkdir -p $SRC/interfaces.ref 21067c478bd9Sstevel@tonic-gate if [ -d $SRC/interfaces.out ]; then 21077c478bd9Sstevel@tonic-gate cp -r $SRC/interfaces.out/* $SRC/interfaces.ref 21087c478bd9Sstevel@tonic-gate fi 21097c478bd9Sstevel@tonic-gate fi 21107c478bd9Sstevel@tonic-gate 21117c478bd9Sstevel@tonic-gate echo "\n==== Diff versioning warnings (since last build) ====\n" | \ 21127c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21137c478bd9Sstevel@tonic-gate 21147c478bd9Sstevel@tonic-gate out_vers=`grep ^VERSION $SRC/interfaces.out/log`; 21157c478bd9Sstevel@tonic-gate ref_vers=`grep ^VERSION $SRC/interfaces.ref/log`; 21167c478bd9Sstevel@tonic-gate 21177c478bd9Sstevel@tonic-gate # Report any differences in WARNING messages between last 21187c478bd9Sstevel@tonic-gate # and current build. 21197c478bd9Sstevel@tonic-gate if [ "$out_vers" = "$ref_vers" ]; then 21207c478bd9Sstevel@tonic-gate diff $SRC/interfaces.ref/log $SRC/interfaces.out/log | \ 21217c478bd9Sstevel@tonic-gate fgrep 'WARNING' | sed 's/WARNING: //' | \ 21227c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21237c478bd9Sstevel@tonic-gate fi 21247c478bd9Sstevel@tonic-gatefi 21257c478bd9Sstevel@tonic-gate 21267c478bd9Sstevel@tonic-gateif [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then 21277c478bd9Sstevel@tonic-gate echo "\n==== Check ELF runtime attributes ====\n" | \ 21287c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21297c478bd9Sstevel@tonic-gate 21307c478bd9Sstevel@tonic-gate LDDUSAGE="^ldd: does not support -e" 21317c478bd9Sstevel@tonic-gate LDDWRONG="wrong class" 21327c478bd9Sstevel@tonic-gate CRLERROR="^crle:" 21337c478bd9Sstevel@tonic-gate CRLECONF="^crle: configuration file:" 21347c478bd9Sstevel@tonic-gate 21357c478bd9Sstevel@tonic-gate rm -f $SRC/runtime.ref 21367c478bd9Sstevel@tonic-gate if [ -f $SRC/runtime.out ]; then 21377c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 21387c478bd9Sstevel@tonic-gate $SRC/runtime.out > $SRC/runtime.ref 21397c478bd9Sstevel@tonic-gate fi 21407c478bd9Sstevel@tonic-gate 21417c478bd9Sstevel@tonic-gate # If we're doing a debug build the proto area will be left with 21427c478bd9Sstevel@tonic-gate # debuggable objects, thus don't assert -s. 21437c478bd9Sstevel@tonic-gate if [ "$D_FLAG" = "y" ]; then 21447c478bd9Sstevel@tonic-gate rtime_sflag="" 21457c478bd9Sstevel@tonic-gate else 21467c478bd9Sstevel@tonic-gate rtime_sflag="-s" 21477c478bd9Sstevel@tonic-gate fi 21487c478bd9Sstevel@tonic-gate check_rtime -d $ROOT -i -m -o $rtime_sflag $ROOT 2>&1 | \ 21497c478bd9Sstevel@tonic-gate egrep -v ": unreferenced object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \ 21507c478bd9Sstevel@tonic-gate egrep -v ": unused object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \ 21517c478bd9Sstevel@tonic-gate sort >$SRC/runtime.out 21527c478bd9Sstevel@tonic-gate 21537c478bd9Sstevel@tonic-gate # Determine any processing errors that will affect the final output 21547c478bd9Sstevel@tonic-gate # and display these first. 21557c478bd9Sstevel@tonic-gate grep -l "$LDDUSAGE" $SRC/runtime.out > /dev/null 21567c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 21577c478bd9Sstevel@tonic-gate echo "WARNING: ldd(1) does not support -e. The version of ldd(1)" | \ 21587c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21597c478bd9Sstevel@tonic-gate echo "on your system is old - 4390308 (s81_30) is required.\n" | \ 21607c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21617c478bd9Sstevel@tonic-gate fi 21627c478bd9Sstevel@tonic-gate grep -l "$LDDWRONG" $SRC/runtime.out > /dev/null 21637c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 21647c478bd9Sstevel@tonic-gate echo "WARNING: wrong class message detected. ldd(1) was unable" | \ 21657c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21667c478bd9Sstevel@tonic-gate echo "to execute an object, thus it could not be checked fully." | \ 21677c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21687c478bd9Sstevel@tonic-gate echo "Perhaps a 64-bit object was encountered on a 32-bit system," | \ 21697c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21707c478bd9Sstevel@tonic-gate echo "or an i386 object was encountered on a sparc system?\n" | \ 21717c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21727c478bd9Sstevel@tonic-gate fi 21737c478bd9Sstevel@tonic-gate grep -l "$CRLECONF" $SRC/runtime.out > /dev/null 21747c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 21757c478bd9Sstevel@tonic-gate echo "WARNING: creation of an alternative dependency cache failed." | \ 21767c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21777c478bd9Sstevel@tonic-gate echo "Dependencies will bind to the base system libraries.\n" | \ 21787c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21797c478bd9Sstevel@tonic-gate grep "$CRLECONF" $SRC/runtime.out | \ 21807c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21817c478bd9Sstevel@tonic-gate grep "$CRLERROR" $SRC/runtime.out | grep -v "$CRLECONF" | \ 21827c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21837c478bd9Sstevel@tonic-gate echo "\n" | tee -a $LOGFILE >> $mail_msg_file 21847c478bd9Sstevel@tonic-gate fi 21857c478bd9Sstevel@tonic-gate 21867c478bd9Sstevel@tonic-gate egrep '<dependency no longer necessary>' $SRC/runtime.out | \ 21877c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21887c478bd9Sstevel@tonic-gate 21897c478bd9Sstevel@tonic-gate # NEEDED= and RPATH= are informational; report anything else that we 21907c478bd9Sstevel@tonic-gate # haven't already. 21917c478bd9Sstevel@tonic-gate egrep -v "NEEDED=|RPATH=|$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 21927c478bd9Sstevel@tonic-gate $SRC/runtime.out | tee -a $LOGFILE >> $mail_msg_file 21937c478bd9Sstevel@tonic-gate 21947c478bd9Sstevel@tonic-gate # probably should compare against a 'known ok runpaths' list 21957c478bd9Sstevel@tonic-gate if [ ! -f $SRC/runtime.ref ]; then 21967c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 21977c478bd9Sstevel@tonic-gate $SRC/runtime.out > $SRC/runtime.ref 21987c478bd9Sstevel@tonic-gate fi 21997c478bd9Sstevel@tonic-gate 22007c478bd9Sstevel@tonic-gate echo "\n==== Diff ELF runtime attributes (since last build) ====\n" \ 22017c478bd9Sstevel@tonic-gate >> $mail_msg_file 22027c478bd9Sstevel@tonic-gate 22037c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" $SRC/runtime.out | \ 22047c478bd9Sstevel@tonic-gate diff $SRC/runtime.ref - >> $mail_msg_file 22057c478bd9Sstevel@tonic-gatefi 22067c478bd9Sstevel@tonic-gate 22077c478bd9Sstevel@tonic-gate# DEBUG lint of kernel begins 22087c478bd9Sstevel@tonic-gate 22097c478bd9Sstevel@tonic-gateif [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 22107c478bd9Sstevel@tonic-gate if [ "$LINTDIRS" = "" ]; then 22117c478bd9Sstevel@tonic-gate # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y" 22127c478bd9Sstevel@tonic-gate LINTDIRS="$SRC y" 22137c478bd9Sstevel@tonic-gate fi 22147c478bd9Sstevel@tonic-gate set $LINTDIRS 22157c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 22167c478bd9Sstevel@tonic-gate dolint $1 $2; shift; shift 22177c478bd9Sstevel@tonic-gate done 22187c478bd9Sstevel@tonic-gateelse 22197c478bd9Sstevel@tonic-gate echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE 22207c478bd9Sstevel@tonic-gatefi 22217c478bd9Sstevel@tonic-gate 22227c478bd9Sstevel@tonic-gate# "make check" begins 22237c478bd9Sstevel@tonic-gate 22247c478bd9Sstevel@tonic-gateif [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then 22257c478bd9Sstevel@tonic-gate # remove old check.out 22267c478bd9Sstevel@tonic-gate rm -f $SRC/check.out 22277c478bd9Sstevel@tonic-gate 22287c478bd9Sstevel@tonic-gate rm -f $SRC/check-${MACH}.out 22297c478bd9Sstevel@tonic-gate cd $SRC 22307c478bd9Sstevel@tonic-gate $MAKE -ek check 2>&1 | tee -a $SRC/check-${MACH}.out >> $LOGFILE 22317c478bd9Sstevel@tonic-gate echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file 22327c478bd9Sstevel@tonic-gate 22337c478bd9Sstevel@tonic-gate grep ":" $SRC/check-${MACH}.out | 22347c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 22357c478bd9Sstevel@tonic-gate sort | uniq >> $mail_msg_file 22367c478bd9Sstevel@tonic-gateelse 22377c478bd9Sstevel@tonic-gate echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE 22387c478bd9Sstevel@tonic-gatefi 22397c478bd9Sstevel@tonic-gate 22407c478bd9Sstevel@tonic-gateecho "\n==== Find core files ====\n" | \ 22417c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 22427c478bd9Sstevel@tonic-gate 2243fb23a357Skupferfind $abssrcdirs -name core -a -type f -exec file {} \; | \ 22447c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 22457c478bd9Sstevel@tonic-gate 22467c478bd9Sstevel@tonic-gateif [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 22477c478bd9Sstevel@tonic-gate echo "\n==== Diff unreferenced files (since last build) ====\n" \ 22487c478bd9Sstevel@tonic-gate | tee -a $LOGFILE >>$mail_msg_file 22497c478bd9Sstevel@tonic-gate rm -f $SRC/unref-${MACH}.ref 22507c478bd9Sstevel@tonic-gate if [ -f $SRC/unref-${MACH}.out ]; then 22517c478bd9Sstevel@tonic-gate mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 22527c478bd9Sstevel@tonic-gate fi 22537c478bd9Sstevel@tonic-gate 2254fb23a357Skupfer findunref -t $SRC/.build.tstamp $SRC/.. \ 2255fb23a357Skupfer ${TOOLS}/findunref/exception_list \ 2256fb23a357Skupfer 2>> $mail_msg_file | sort | \ 2257fb23a357Skupfer sed -e s=^./src/=./= -e s=^./closed/=../closed/= \ 2258fb23a357Skupfer > $SRC/unref-${MACH}.out 22597c478bd9Sstevel@tonic-gate 22607c478bd9Sstevel@tonic-gate if [ ! -f $SRC/unref-${MACH}.ref ]; then 22617c478bd9Sstevel@tonic-gate cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 22627c478bd9Sstevel@tonic-gate fi 22637c478bd9Sstevel@tonic-gate 22647c478bd9Sstevel@tonic-gate diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file 22657c478bd9Sstevel@tonic-gatefi 22667c478bd9Sstevel@tonic-gate 22677c478bd9Sstevel@tonic-gate# Verify that the usual lists of files, such as exception lists, 22687c478bd9Sstevel@tonic-gate# contain only valid references to files. If the build has failed, 22697c478bd9Sstevel@tonic-gate# then don't check the proto area. 22707c478bd9Sstevel@tonic-gateCHECK_PATHS=${CHECK_PATHS:-y} 22717c478bd9Sstevel@tonic-gateif [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then 22727c478bd9Sstevel@tonic-gate echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \ 22737c478bd9Sstevel@tonic-gate >>$mail_msg_file 22747c478bd9Sstevel@tonic-gate arg=-b 22757c478bd9Sstevel@tonic-gate [ "$build_ok" = y ] && arg= 22767c478bd9Sstevel@tonic-gate checkpaths $arg $ROOT 2>&1 | tee -a $LOGFILE >>$mail_msg_file 22777c478bd9Sstevel@tonic-gatefi 22787c478bd9Sstevel@tonic-gate 22797c478bd9Sstevel@tonic-gateif [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then 22807c478bd9Sstevel@tonic-gate echo "\n==== Impact on file permissions ====\n" \ 22817c478bd9Sstevel@tonic-gate >> $mail_msg_file 22827c478bd9Sstevel@tonic-gate # 22837c478bd9Sstevel@tonic-gate # Get pkginfo files from usr/src/pkgdefs 22847c478bd9Sstevel@tonic-gate # 22857c478bd9Sstevel@tonic-gate pmodes -qvdP \ 2286fb9f9b97Skupfer `for d in $abssrcdirs; do 2287fb9f9b97Skupfer if [ -d "$d/pkgdefs" ] 22887c478bd9Sstevel@tonic-gate then 2289fb9f9b97Skupfer find $d/pkgdefs -name pkginfo.tmpl -print -o -name .del\* -prune 22907c478bd9Sstevel@tonic-gate fi 22917c478bd9Sstevel@tonic-gate done | sed -e 's:/pkginfo.tmpl$::' | sort -u ` >> $mail_msg_file 22927c478bd9Sstevel@tonic-gatefi 22937c478bd9Sstevel@tonic-gate 229496ccc8cbSesaxeif [ "$w_FLAG" = "y" -a "$build_ok" = "y" ]; then 2295534f4022Sdduvall echo "\n==== Objects that differ since last build ====\n" | \ 229696ccc8cbSesaxe tee -a $LOGFILE >> $mail_msg_file 229796ccc8cbSesaxe 229896ccc8cbSesaxe if [ "$t_FLAG" = "y" ]; then 2299534f4022Sdduvall wsdiff -t -r ${TMPDIR}/wsdiff.results $ROOT.prev $ROOT | \ 230096ccc8cbSesaxe tee -a $LOGFILE >> $mail_msg_file 230196ccc8cbSesaxe else 2302534f4022Sdduvall wsdiff -r ${TMPDIR}/wsdiff.results $ROOT.prev $ROOT | \ 230396ccc8cbSesaxe tee -a $LOGFILE >> $mail_msg_file 230496ccc8cbSesaxe fi 230596ccc8cbSesaxefi 230696ccc8cbSesaxe 23077c478bd9Sstevel@tonic-gateEND_DATE=`date` 23087c478bd9Sstevel@tonic-gateecho "==== Nightly $maketype build completed: $END_DATE ====" | \ 23097c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 23107c478bd9Sstevel@tonic-gate 23117c478bd9Sstevel@tonic-gatetypeset -Z2 minutes 23127c478bd9Sstevel@tonic-gatetypeset -Z2 seconds 23137c478bd9Sstevel@tonic-gate 23147c478bd9Sstevel@tonic-gateelapsed_time=$SECONDS 23157c478bd9Sstevel@tonic-gate((hours = elapsed_time / 3600 )) 23167c478bd9Sstevel@tonic-gate((minutes = elapsed_time / 60 % 60)) 23177c478bd9Sstevel@tonic-gate((seconds = elapsed_time % 60)) 23187c478bd9Sstevel@tonic-gate 23197c478bd9Sstevel@tonic-gateecho "\n==== Total build time ====" | \ 23207c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 23217c478bd9Sstevel@tonic-gateecho "\nreal ${hours}:${minutes}:${seconds}" | \ 23227c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 23237c478bd9Sstevel@tonic-gate 23247c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" -a "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 23257c478bd9Sstevel@tonic-gate staffer cp ${SRC}/unref-${MACH}.out $PARENT_WS/usr/src/ 23267c478bd9Sstevel@tonic-gate 23277c478bd9Sstevel@tonic-gate # 23287c478bd9Sstevel@tonic-gate # Produce a master list of unreferenced files -- ideally, we'd 23297c478bd9Sstevel@tonic-gate # generate the master just once after all of the nightlies 23307c478bd9Sstevel@tonic-gate # have finished, but there's no simple way to know when that 23317c478bd9Sstevel@tonic-gate # will be. Instead, we assume that we're the last nightly to 23327c478bd9Sstevel@tonic-gate # finish and merge all of the unref-${MACH}.out files in 23337c478bd9Sstevel@tonic-gate # $PARENT_WS/usr/src/. If we are in fact the final ${MACH} to 23347c478bd9Sstevel@tonic-gate # finish, then this file will be the authoritative master 23357c478bd9Sstevel@tonic-gate # list. Otherwise, another ${MACH}'s nightly will eventually 23367c478bd9Sstevel@tonic-gate # overwrite ours with its own master, but in the meantime our 23377c478bd9Sstevel@tonic-gate # temporary "master" will be no worse than any older master 23387c478bd9Sstevel@tonic-gate # which was already on the parent. 23397c478bd9Sstevel@tonic-gate # 23407c478bd9Sstevel@tonic-gate 23417c478bd9Sstevel@tonic-gate set -- $PARENT_WS/usr/src/unref-*.out 23427c478bd9Sstevel@tonic-gate cp "$1" ${TMPDIR}/unref.merge 23437c478bd9Sstevel@tonic-gate shift 23447c478bd9Sstevel@tonic-gate 23457c478bd9Sstevel@tonic-gate for unreffile; do 23467c478bd9Sstevel@tonic-gate comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$ 23477c478bd9Sstevel@tonic-gate mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge 23487c478bd9Sstevel@tonic-gate done 23497c478bd9Sstevel@tonic-gate 23507c478bd9Sstevel@tonic-gate staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out 23517c478bd9Sstevel@tonic-gatefi 23527c478bd9Sstevel@tonic-gate 23537c478bd9Sstevel@tonic-gate# 23547c478bd9Sstevel@tonic-gate# All done save for the sweeping up. 23557c478bd9Sstevel@tonic-gate# (whichever exit we hit here will trigger the "cleanup" trap which 23567c478bd9Sstevel@tonic-gate# optionally sends mail on completion). 23577c478bd9Sstevel@tonic-gate# 23587c478bd9Sstevel@tonic-gateif [ "$build_ok" = "y" ]; then 23597c478bd9Sstevel@tonic-gate exit 0 23607c478bd9Sstevel@tonic-gatefi 23617c478bd9Sstevel@tonic-gateexit 1 2362