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# 236c3c9007Sstevel# 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 # 436*23259b79Srotondo # Re-sign selected binaries using signing server 437*23259b79Srotondo # (gatekeeper builds only) 438*23259b79Srotondo # 439*23259b79Srotondo if [ -n "$CODESIGN_USER" ]; then 440*23259b79Srotondo echo "\n==== Signing proto area at `date` ====\n" >> $LOGFILE 441*23259b79Srotondo signing_file="${TMPDIR}/signing" 442*23259b79Srotondo rm -f ${signing_file} 443*23259b79Srotondo export CODESIGN_USER 444*23259b79Srotondo signproto $SRC/tools/codesign/creds 2>&1 | \ 445*23259b79Srotondo tee -a ${signing_file} >> $LOGFILE 446*23259b79Srotondo echo "\n==== Finished signing proto area at `date` ====\n" \ 447*23259b79Srotondo >> $LOGFILE 448*23259b79Srotondo echo "\n==== Crypto module signing errors ($LABEL) ====\n" \ 449*23259b79Srotondo >> $mail_msg_file 450*23259b79Srotondo egrep 'WARNING|ERROR' ${signing_file} >> $mail_msg_file 451*23259b79Srotondo fi 452*23259b79Srotondo 453*23259b79Srotondo # 4547c478bd9Sstevel@tonic-gate # Create cpio archives for preintegration testing (PIT) 4557c478bd9Sstevel@tonic-gate # 4567c478bd9Sstevel@tonic-gate if [ "$a_FLAG" = "y" -a "$this_build_ok" = "y" ]; then 4577c478bd9Sstevel@tonic-gate echo "\n==== Creating $LABEL cpio archives at `date` ====\n" \ 4587c478bd9Sstevel@tonic-gate >> $LOGFILE 4597c478bd9Sstevel@tonic-gate makebfu_file="${TMPDIR}/makebfu" 4607c478bd9Sstevel@tonic-gate rm -f ${makebfu_file} 4617c478bd9Sstevel@tonic-gate makebfu 2>&1 | \ 4627c478bd9Sstevel@tonic-gate tee -a ${makebfu_file} >> $LOGFILE 4637c478bd9Sstevel@tonic-gate echo "\n==== cpio archives build errors ($LABEL) ====\n" \ 4647c478bd9Sstevel@tonic-gate >> $mail_msg_file 4657c478bd9Sstevel@tonic-gate grep -v "^Creating .* archive:" ${makebfu_file} | \ 4667c478bd9Sstevel@tonic-gate grep -v "^Making" | \ 4677c478bd9Sstevel@tonic-gate grep -v "^$" | \ 4687c478bd9Sstevel@tonic-gate sort | uniq >> $mail_msg_file 4697c478bd9Sstevel@tonic-gate rm -f ${makebfu_file} 4707c478bd9Sstevel@tonic-gate # hack for test folks 4717c478bd9Sstevel@tonic-gate if [ -z "`echo $PARENT_WS|egrep '^\/ws\/'`" ]; then 4727c478bd9Sstevel@tonic-gate X=/net/`uname -n`${CPIODIR} 4737c478bd9Sstevel@tonic-gate else 4747c478bd9Sstevel@tonic-gate X=${CPIODIR} 4757c478bd9Sstevel@tonic-gate fi 4767c478bd9Sstevel@tonic-gate echo "Archive_directory: ${X}" >${TMPDIR}/f 4777c478bd9Sstevel@tonic-gate cp ${TMPDIR}/f ${CPIODIR}/../../.${MACH}_wgtrun 4787c478bd9Sstevel@tonic-gate rm -f ${TMPDIR}/f 4797c478bd9Sstevel@tonic-gate 4807c478bd9Sstevel@tonic-gate else 4817c478bd9Sstevel@tonic-gate echo "\n==== Not creating $LABEL cpio archives ====\n" \ 4827c478bd9Sstevel@tonic-gate >> $LOGFILE 4837c478bd9Sstevel@tonic-gate fi 4847c478bd9Sstevel@tonic-gate 4857c478bd9Sstevel@tonic-gate # 4867c478bd9Sstevel@tonic-gate # Building Packages 4877c478bd9Sstevel@tonic-gate # 4887c478bd9Sstevel@tonic-gate if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then 4897c478bd9Sstevel@tonic-gate echo "\n==== Creating $LABEL packages at `date` ====\n" \ 4907c478bd9Sstevel@tonic-gate >> $LOGFILE 4917c478bd9Sstevel@tonic-gate rm -f $SRC/pkgdefs/${INSTALLOG}.out 4927c478bd9Sstevel@tonic-gate echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE 4937c478bd9Sstevel@tonic-gate rm -rf $PKGARCHIVE 4947c478bd9Sstevel@tonic-gate mkdir -p $PKGARCHIVE 495d8fd4470Sjg 496d8fd4470Sjg # 497d8fd4470Sjg # Optional build of sparc realmode on i386 498d8fd4470Sjg # 499d8fd4470Sjg if [ "$MACH" = "i386" ] && [ "${SPARC_RM_PKGARCHIVE}" ]; then 500d8fd4470Sjg echo "Clearing out ${SPARC_RM_PKGARCHIVE} ..." \ 501d8fd4470Sjg >> $LOGFILE 502d8fd4470Sjg rm -rf ${SPARC_RM_PKGARCHIVE} 503d8fd4470Sjg mkdir -p ${SPARC_RM_PKGARCHIVE} 504d8fd4470Sjg fi 505d8fd4470Sjg 5067c478bd9Sstevel@tonic-gate cd $SRC/pkgdefs 5077c478bd9Sstevel@tonic-gate $MAKE -e install 2>&1 | \ 5087c478bd9Sstevel@tonic-gate tee -a $SRC/pkgdefs/${INSTALLOG}.out >> $LOGFILE 5097c478bd9Sstevel@tonic-gate echo "\n==== Package build errors ($LABEL) ====\n" \ 5107c478bd9Sstevel@tonic-gate >> $mail_msg_file 5117c478bd9Sstevel@tonic-gate egrep "${MAKE}|ERROR|WARNING" $SRC/pkgdefs/${INSTALLOG}.out | \ 5127c478bd9Sstevel@tonic-gate grep ':' | \ 5137c478bd9Sstevel@tonic-gate grep -v PSTAMP | \ 5147c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 5157c478bd9Sstevel@tonic-gate >> $mail_msg_file 5167c478bd9Sstevel@tonic-gate else 5177c478bd9Sstevel@tonic-gate echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE 5187c478bd9Sstevel@tonic-gate fi 5197c478bd9Sstevel@tonic-gate} 5207c478bd9Sstevel@tonic-gate 5211fe69678Skupfer# Usage: dolint /dir y|n 5227c478bd9Sstevel@tonic-gate# Arg. 2 is a flag to turn on/off the lint diff output 5231fe69678Skupferdolint() { 5247c478bd9Sstevel@tonic-gate if [ ! -d "$1" ]; then 5251fe69678Skupfer echo "dolint error: $1 is not a directory" 5267c478bd9Sstevel@tonic-gate exit 1 5277c478bd9Sstevel@tonic-gate fi 5287c478bd9Sstevel@tonic-gate 5297c478bd9Sstevel@tonic-gate if [ "$2" != "y" -a "$2" != "n" ]; then 5301fe69678Skupfer echo "dolint internal error: $2 should be 'y' or 'n'" 5317c478bd9Sstevel@tonic-gate exit 1 5327c478bd9Sstevel@tonic-gate fi 5337c478bd9Sstevel@tonic-gate 5347c478bd9Sstevel@tonic-gate lintdir=$1 5357c478bd9Sstevel@tonic-gate dodiff=$2 5367c478bd9Sstevel@tonic-gate base=`basename $lintdir` 5377c478bd9Sstevel@tonic-gate LINTOUT=$lintdir/lint-${MACH}.out 5387c478bd9Sstevel@tonic-gate LINTNOISE=$lintdir/lint-noise-${MACH} 5397c478bd9Sstevel@tonic-gate 5407c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 5417c478bd9Sstevel@tonic-gate unset RELEASE_BUILD 5427c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 5437c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 5447c478bd9Sstevel@tonic-gate 5457c478bd9Sstevel@tonic-gate # 5467c478bd9Sstevel@tonic-gate # '$MAKE lint' in $lintdir 5477c478bd9Sstevel@tonic-gate # 5487c478bd9Sstevel@tonic-gate echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE 5497c478bd9Sstevel@tonic-gate 5507c478bd9Sstevel@tonic-gate # remove old lint.out 5517c478bd9Sstevel@tonic-gate rm -f $lintdir/lint.out $lintdir/lint-noise.out 5527c478bd9Sstevel@tonic-gate if [ -f $lintdir/lint-noise.ref ]; then 5537c478bd9Sstevel@tonic-gate mv $lintdir/lint-noise.ref ${LINTNOISE}.ref 5547c478bd9Sstevel@tonic-gate fi 5557c478bd9Sstevel@tonic-gate 5567c478bd9Sstevel@tonic-gate rm -f $LINTOUT 5577c478bd9Sstevel@tonic-gate cd $lintdir 5587c478bd9Sstevel@tonic-gate # 5597c478bd9Sstevel@tonic-gate # Remove all .ln files to ensure a full reference file 5607c478bd9Sstevel@tonic-gate # 5617c478bd9Sstevel@tonic-gate rm -f Nothing_to_remove \ 5627c478bd9Sstevel@tonic-gate `find . -name SCCS -prune -o -type f -name '*.ln' -print ` 5637c478bd9Sstevel@tonic-gate 5647c478bd9Sstevel@tonic-gate /bin/time $MAKE -ek lint 2>&1 | \ 5657c478bd9Sstevel@tonic-gate tee -a $LINTOUT >> $LOGFILE 5667c478bd9Sstevel@tonic-gate echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file 5677c478bd9Sstevel@tonic-gate grep "$MAKE:" $LINTOUT | 5687c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 5697c478bd9Sstevel@tonic-gate >> $mail_msg_file 5707c478bd9Sstevel@tonic-gate 5717c478bd9Sstevel@tonic-gate echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE 5727c478bd9Sstevel@tonic-gate 5737c478bd9Sstevel@tonic-gate echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \ 5747c478bd9Sstevel@tonic-gate >>$mail_msg_file 5757c478bd9Sstevel@tonic-gate tail -3 $LINTOUT >>$mail_msg_file 5767c478bd9Sstevel@tonic-gate 5777c478bd9Sstevel@tonic-gate rm -f ${LINTNOISE}.ref 5787c478bd9Sstevel@tonic-gate if [ -f ${LINTNOISE}.out ]; then 5797c478bd9Sstevel@tonic-gate mv ${LINTNOISE}.out ${LINTNOISE}.ref 5807c478bd9Sstevel@tonic-gate fi 5817c478bd9Sstevel@tonic-gate grep : $LINTOUT | \ 5827c478bd9Sstevel@tonic-gate egrep -v '^(real|user|sys)' | 5837c478bd9Sstevel@tonic-gate egrep -v '(library construction)' | \ 5847c478bd9Sstevel@tonic-gate egrep -v ': global crosschecks' | \ 5857c478bd9Sstevel@tonic-gate egrep -v 'Ignoring unknown host' | \ 5867c478bd9Sstevel@tonic-gate egrep -v '\.c:$' | \ 5877c478bd9Sstevel@tonic-gate sort | uniq > ${LINTNOISE}.out 5887c478bd9Sstevel@tonic-gate if [ ! -f ${LINTNOISE}.ref ]; then 5897c478bd9Sstevel@tonic-gate cp ${LINTNOISE}.out ${LINTNOISE}.ref 5907c478bd9Sstevel@tonic-gate fi 5917c478bd9Sstevel@tonic-gate if [ "$dodiff" != "n" ]; then 5927c478bd9Sstevel@tonic-gate echo "\n==== lint warnings $base ====\n" \ 5937c478bd9Sstevel@tonic-gate >>$mail_msg_file 5947c478bd9Sstevel@tonic-gate # should be none, though there are a few that were filtered out 5957c478bd9Sstevel@tonic-gate # above 5967c478bd9Sstevel@tonic-gate egrep -i '(warning|lint):' ${LINTNOISE}.out \ 5977c478bd9Sstevel@tonic-gate | sort | uniq >> $mail_msg_file 5987c478bd9Sstevel@tonic-gate echo "\n==== lint noise differences $base ====\n" \ 5997c478bd9Sstevel@tonic-gate >> $mail_msg_file 6007c478bd9Sstevel@tonic-gate diff ${LINTNOISE}.ref ${LINTNOISE}.out \ 6017c478bd9Sstevel@tonic-gate >> $mail_msg_file 6027c478bd9Sstevel@tonic-gate fi 6037c478bd9Sstevel@tonic-gate} 6047c478bd9Sstevel@tonic-gate 6057c478bd9Sstevel@tonic-gate# Install proto area from IHV build 6067c478bd9Sstevel@tonic-gate 6077c478bd9Sstevel@tonic-gatecopy_ihv_proto() { 6087c478bd9Sstevel@tonic-gate 6096fec3625Sdduvall echo "\n==== Installing IHV proto area ====\n" \ 6107c478bd9Sstevel@tonic-gate >> $LOGFILE 6117c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_ROOT" ]; then 6127c478bd9Sstevel@tonic-gate if [ ! -d "$ROOT" ]; then 6137c478bd9Sstevel@tonic-gate echo "mkdir -p $ROOT" >> $LOGFILE 6147c478bd9Sstevel@tonic-gate mkdir -p $ROOT 6157c478bd9Sstevel@tonic-gate fi 6166fec3625Sdduvall echo "copying $IA32_IHV_ROOT to $ROOT\n" >> $LOGFILE 6177c478bd9Sstevel@tonic-gate cd $IA32_IHV_ROOT 6187c478bd9Sstevel@tonic-gate tar -cf - . | (cd $ROOT; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6197c478bd9Sstevel@tonic-gate else 6207c478bd9Sstevel@tonic-gate echo "$IA32_IHV_ROOT: not found" >> $LOGFILE 6217c478bd9Sstevel@tonic-gate fi 6227c478bd9Sstevel@tonic-gate} 6237c478bd9Sstevel@tonic-gate 6247c478bd9Sstevel@tonic-gate# Install IHV packages in PKGARCHIVE 6251fe69678Skupfer# usage: copy_ihv_pkgs LABEL SUFFIX 6267c478bd9Sstevel@tonic-gatecopy_ihv_pkgs() { 6277c478bd9Sstevel@tonic-gate LABEL=$1 6287c478bd9Sstevel@tonic-gate SUFFIX=$2 6297c478bd9Sstevel@tonic-gate # always use non-DEBUG IHV packages 6307c478bd9Sstevel@tonic-gate IA32_IHV_PKGS=${IA32_IHV_PKGS_ORIG}-nd 6317c478bd9Sstevel@tonic-gate PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX} 6327c478bd9Sstevel@tonic-gate 6337c478bd9Sstevel@tonic-gate echo "\n==== Installing IHV packages from $IA32_IHV_PKGS ($LABEL) ====\n" \ 6347c478bd9Sstevel@tonic-gate >> $LOGFILE 6357c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_PKGS" ]; then 6367c478bd9Sstevel@tonic-gate cd $IA32_IHV_PKGS 6377c478bd9Sstevel@tonic-gate tar -cf - * | \ 6387c478bd9Sstevel@tonic-gate (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6397c478bd9Sstevel@tonic-gate else 6407c478bd9Sstevel@tonic-gate echo "$IA32_IHV_PKGS: not found" >> $LOGFILE 6417c478bd9Sstevel@tonic-gate fi 6427c478bd9Sstevel@tonic-gate 6437c478bd9Sstevel@tonic-gate echo "\n==== Installing IHV packages from $IA32_IHV_BINARY_PKGS ($LABEL) ====\n" \ 6447c478bd9Sstevel@tonic-gate >> $LOGFILE 6457c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_BINARY_PKGS" ]; then 6467c478bd9Sstevel@tonic-gate cd $IA32_IHV_BINARY_PKGS 6477c478bd9Sstevel@tonic-gate tar -cf - * | \ 6487c478bd9Sstevel@tonic-gate (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6497c478bd9Sstevel@tonic-gate else 6507c478bd9Sstevel@tonic-gate echo "$IA32_IHV_BINARY_PKGS: not found" >> $LOGFILE 6517c478bd9Sstevel@tonic-gate fi 6527c478bd9Sstevel@tonic-gate} 6537c478bd9Sstevel@tonic-gate 6541fe69678Skupfer# usage: build_tools DESTROOT 6557c478bd9Sstevel@tonic-gatebuild_tools() { 6567c478bd9Sstevel@tonic-gate DESTROOT=$1 6577c478bd9Sstevel@tonic-gate 6587c478bd9Sstevel@tonic-gate INSTALLOG=install-${MACH} 6597c478bd9Sstevel@tonic-gate 6607c478bd9Sstevel@tonic-gate echo "\n==== Building tools at `date` ====\n" \ 6617c478bd9Sstevel@tonic-gate >> $LOGFILE 6627c478bd9Sstevel@tonic-gate 6637c478bd9Sstevel@tonic-gate rm -f ${TOOLS}/${INSTALLOG}.out 6647c478bd9Sstevel@tonic-gate cd ${TOOLS} 6657c478bd9Sstevel@tonic-gate /bin/time $MAKE ROOT=${DESTROOT} -e install 2>&1 | \ 6667c478bd9Sstevel@tonic-gate tee -a ${TOOLS}/${INSTALLOG}.out >> $LOGFILE 6677c478bd9Sstevel@tonic-gate 6687c478bd9Sstevel@tonic-gate echo "\n==== Tools build errors ====\n" >> $mail_msg_file 6697c478bd9Sstevel@tonic-gate 6707c478bd9Sstevel@tonic-gate egrep ":" ${TOOLS}/${INSTALLOG}.out | 6717c478bd9Sstevel@tonic-gate egrep -e "(${MAKE}:|[ ]error[: \n])" | \ 6727c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 6737c478bd9Sstevel@tonic-gate egrep -v warning >> $mail_msg_file 6747c478bd9Sstevel@tonic-gate if [ "$?" != "0" ]; then 6757c478bd9Sstevel@tonic-gate STABS=${DESTROOT}/opt/onbld/bin/${MACH}/stabs 6767c478bd9Sstevel@tonic-gate export STABS 6777c478bd9Sstevel@tonic-gate CTFSTABS=${DESTROOT}/opt/onbld/bin/${MACH}/ctfstabs 6787c478bd9Sstevel@tonic-gate export CTFSTABS 6797c478bd9Sstevel@tonic-gate GENOFFSETS=${DESTROOT}/opt/onbld/bin/genoffsets 6807c478bd9Sstevel@tonic-gate export GENOFFSETS 6817c478bd9Sstevel@tonic-gate 6827c478bd9Sstevel@tonic-gate CTFCONVERT=${DESTROOT}/opt/onbld/bin/${MACH}/ctfconvert 6837c478bd9Sstevel@tonic-gate export CTFCONVERT 6847c478bd9Sstevel@tonic-gate CTFMERGE=${DESTROOT}/opt/onbld/bin/${MACH}/ctfmerge 6857c478bd9Sstevel@tonic-gate export CTFMERGE 6867c478bd9Sstevel@tonic-gate 6877c478bd9Sstevel@tonic-gate CTFCVTPTBL=${DESTROOT}/opt/onbld/bin/ctfcvtptbl 6887c478bd9Sstevel@tonic-gate export CTFCVTPTBL 6897c478bd9Sstevel@tonic-gate CTFFINDMOD=${DESTROOT}/opt/onbld/bin/ctffindmod 6907c478bd9Sstevel@tonic-gate export CTFFINDMOD 6917c478bd9Sstevel@tonic-gate 6927c478bd9Sstevel@tonic-gate if [ "$VERIFY_ELFSIGN" = "y" ]; then 6937c478bd9Sstevel@tonic-gate ELFSIGN=${DESTROOT}/opt/onbld/bin/elfsigncmp 6947c478bd9Sstevel@tonic-gate else 6957c478bd9Sstevel@tonic-gate ELFSIGN=${DESTROOT}/opt/onbld/bin/${MACH}/elfsign 6967c478bd9Sstevel@tonic-gate fi 6977c478bd9Sstevel@tonic-gate export ELFSIGN 6987c478bd9Sstevel@tonic-gate 6997c478bd9Sstevel@tonic-gate PATH="${DESTROOT}/opt/onbld/bin/${MACH}:${PATH}" 7007c478bd9Sstevel@tonic-gate PATH="${DESTROOT}/opt/onbld/bin:${PATH}" 7017c478bd9Sstevel@tonic-gate export PATH 7027c478bd9Sstevel@tonic-gate 7037c478bd9Sstevel@tonic-gate echo "\n==== New environment settings. ====\n" >> $LOGFILE 7047c478bd9Sstevel@tonic-gate echo "STABS=${STABS}" >> $LOGFILE 7057c478bd9Sstevel@tonic-gate echo "CTFSTABS=${CTFSTABS}" >> $LOGFILE 7067c478bd9Sstevel@tonic-gate echo "CTFCONVERT=${CTFCONVERT}" >> $LOGFILE 7077c478bd9Sstevel@tonic-gate echo "CTFMERGE=${CTFMERGE}" >> $LOGFILE 7087c478bd9Sstevel@tonic-gate echo "CTFCVTPTBL=${CTFCVTPTBL}" >> $LOGFILE 7097c478bd9Sstevel@tonic-gate echo "CTFFINDMOD=${CTFFINDMOD}" >> $LOGFILE 7107c478bd9Sstevel@tonic-gate echo "ELFSIGN=${ELFSIGN}" >> $LOGFILE 7117c478bd9Sstevel@tonic-gate echo "PATH=${PATH}" >> $LOGFILE 7127c478bd9Sstevel@tonic-gate fi 7137c478bd9Sstevel@tonic-gate} 7147c478bd9Sstevel@tonic-gate 7157c478bd9Sstevel@tonic-gatestaffer() { 7167c478bd9Sstevel@tonic-gate if [ $ISUSER -ne 0 ]; then 7177c478bd9Sstevel@tonic-gate "$@" 7187c478bd9Sstevel@tonic-gate else 7197c478bd9Sstevel@tonic-gate arg="\"$1\"" 7207c478bd9Sstevel@tonic-gate shift 7217c478bd9Sstevel@tonic-gate for i 7227c478bd9Sstevel@tonic-gate do 7237c478bd9Sstevel@tonic-gate arg="$arg \"$i\"" 7247c478bd9Sstevel@tonic-gate done 7257c478bd9Sstevel@tonic-gate eval su $STAFFER -c \'$arg\' 7267c478bd9Sstevel@tonic-gate fi 7277c478bd9Sstevel@tonic-gate} 7287c478bd9Sstevel@tonic-gate 729085d331dSkupfer# 730085d331dSkupfer# Verify that the closed tree is present if it needs to be. 731085d331dSkupfer# Sets CLOSED_IS_PRESENT for future use. 732085d331dSkupfer# 733085d331dSkupfercheck_closed_tree() { 734085d331dSkupfer if [ -z "$CLOSED_IS_PRESENT" ]; then 735085d331dSkupfer if [ -d $SRC/../closed ]; then 736085d331dSkupfer CLOSED_IS_PRESENT="yes" 737085d331dSkupfer else 738085d331dSkupfer CLOSED_IS_PRESENT="no" 739085d331dSkupfer fi 740085d331dSkupfer export CLOSED_IS_PRESENT 741085d331dSkupfer fi 742085d331dSkupfer if [[ "$CLOSED_IS_PRESENT" = no && ! -d "$ON_CLOSED_BINS" ]]; then 743085d331dSkupfer # 744085d331dSkupfer # If it's an old (pre-split) tree or an empty 745085d331dSkupfer # workspace, don't complain. 746085d331dSkupfer # 747085d331dSkupfer if grep -s CLOSED_BUILD $SRC/Makefile.master > /dev/null; then 748085d331dSkupfer echo "If the closed sources are not present," \ 749085d331dSkupfer "ON_CLOSED_BINS" 750085d331dSkupfer echo "must point to the closed binaries tree." 751085d331dSkupfer exit 1 752085d331dSkupfer fi 753085d331dSkupfer fi 754085d331dSkupfer} 7557c478bd9Sstevel@tonic-gate 756d77e7149Ssommerfeobsolete_build() { 757d77e7149Ssommerfe echo "WARNING: Obsolete $1 build requested; request will be ignored" 758d77e7149Ssommerfe} 759d77e7149Ssommerfe 760d77e7149Ssommerfe 7617c478bd9Sstevel@tonic-gateMACH=`uname -p` 7627c478bd9Sstevel@tonic-gate 7637c478bd9Sstevel@tonic-gateif [ "$OPTHOME" = "" ]; then 7647c478bd9Sstevel@tonic-gate OPTHOME=/opt 7657c478bd9Sstevel@tonic-gate export OPTHOME 7667c478bd9Sstevel@tonic-gatefi 7677c478bd9Sstevel@tonic-gateif [ "$TEAMWARE" = "" ]; then 7687c478bd9Sstevel@tonic-gate TEAMWARE=$OPTHOME/teamware 7697c478bd9Sstevel@tonic-gate export TEAMWARE 7707c478bd9Sstevel@tonic-gatefi 7717c478bd9Sstevel@tonic-gate 7721fe69678SkupferUSAGE='Usage: nightly [-in] [-V VERS ] [ -S E|D|H|O ] <env_file> 7737c478bd9Sstevel@tonic-gate 7747c478bd9Sstevel@tonic-gateWhere: 775d77e7149Ssommerfe -i Fast incremental options (no clobber, lint, check) 7767c478bd9Sstevel@tonic-gate -n Do not do a bringover 7777c478bd9Sstevel@tonic-gate -V VERS set the build version string to VERS 7787c478bd9Sstevel@tonic-gate -S Build a variant of the source product 7797c478bd9Sstevel@tonic-gate E - build exportable source 7807c478bd9Sstevel@tonic-gate D - build domestic source (exportable + crypt) 7817c478bd9Sstevel@tonic-gate H - build hybrid source (binaries + deleted source) 7821fe69678Skupfer O - build (only) open source 7837c478bd9Sstevel@tonic-gate 7847c478bd9Sstevel@tonic-gate <env_file> file in Bourne shell syntax that sets and exports 7857c478bd9Sstevel@tonic-gate variables that configure the operation of this script and many of 7867c478bd9Sstevel@tonic-gate the scripts this one calls. If <env_file> does not exist, 7877c478bd9Sstevel@tonic-gate it will be looked for in $OPTHOME/onbld/env. 7887c478bd9Sstevel@tonic-gate 7897c478bd9Sstevel@tonic-gatenon-DEBUG is the default build type. Build options can be set in the 7907c478bd9Sstevel@tonic-gateNIGHTLY_OPTIONS variable in the <env_file> as follows: 7917c478bd9Sstevel@tonic-gate 7927c478bd9Sstevel@tonic-gate -A check for ABI differences in .so files 7937c478bd9Sstevel@tonic-gate -C check for cstyle/hdrchk errors 7947c478bd9Sstevel@tonic-gate -D do a build with DEBUG on 7957c478bd9Sstevel@tonic-gate -F do _not_ do a non-DEBUG build 7967c478bd9Sstevel@tonic-gate -G gate keeper default group of options (-au) 7977c478bd9Sstevel@tonic-gate -I integration engineer default group of options (-ampu) 7987c478bd9Sstevel@tonic-gate -M do not run pmodes (safe file permission checker) 7997c478bd9Sstevel@tonic-gate -N do not run protocmp 8007c478bd9Sstevel@tonic-gate -R default group of options for building a release (-mp) 8017c478bd9Sstevel@tonic-gate -U update proto area in the parent 8027c478bd9Sstevel@tonic-gate -V VERS set the build version string to VERS 80304a42e3eSszhou -X copy x86 IHV proto area 8047c478bd9Sstevel@tonic-gate -a create cpio archives 8057c478bd9Sstevel@tonic-gate -f find unreferenced files 8067c478bd9Sstevel@tonic-gate -i do an incremental build (no "make clobber") 8077c478bd9Sstevel@tonic-gate -l do "make lint" in $LINTDIRS (default: $SRC y) 8087c478bd9Sstevel@tonic-gate -m send mail to $MAILTO at end of build 8097c478bd9Sstevel@tonic-gate -n do not do a bringover 8107c478bd9Sstevel@tonic-gate -o build using root privileges to set OWNER/GROUP (old style) 8117c478bd9Sstevel@tonic-gate -p create packages 8127c478bd9Sstevel@tonic-gate -r check ELF runtime attributes in the proto area 8137c478bd9Sstevel@tonic-gate -t build and use the tools in $SRC/tools 8147c478bd9Sstevel@tonic-gate -u update proto_list_$MACH and friends in the parent workspace; 8157c478bd9Sstevel@tonic-gate when used with -f, also build an unrefmaster.out in the parent 81696ccc8cbSesaxe -w report on differences between previous and current proto areas 8177c478bd9Sstevel@tonic-gate -z compress cpio archives with gzip 8187c478bd9Sstevel@tonic-gate -W Do not report warnings (freeware gate ONLY) 8197c478bd9Sstevel@tonic-gate -S Build a variant of the source product 8207c478bd9Sstevel@tonic-gate E - build exportable source 8217c478bd9Sstevel@tonic-gate D - build domestic source (exportable + crypt) 8227c478bd9Sstevel@tonic-gate H - build hybrid source (binaries + deleted source) 8231fe69678Skupfer O - build (only) open source 8247c478bd9Sstevel@tonic-gate' 8257c478bd9Sstevel@tonic-gate# 8267c478bd9Sstevel@tonic-gate# -x less public handling of xmod source for the source product 8277c478bd9Sstevel@tonic-gate# 8287c478bd9Sstevel@tonic-gate# A log file will be generated under the name $LOGFILE 8291c79753fSdarrenm# for partially completed build and log.`date '+%F'` 8307c478bd9Sstevel@tonic-gate# in the same directory for fully completed builds. 8317c478bd9Sstevel@tonic-gate# 8327c478bd9Sstevel@tonic-gate 8337c478bd9Sstevel@tonic-gate# default values for low-level FLAGS; G I R are group FLAGS 8347c478bd9Sstevel@tonic-gateA_FLAG=n 8357c478bd9Sstevel@tonic-gatea_FLAG=n 8367c478bd9Sstevel@tonic-gateC_FLAG=n 8376c3c9007SstevelD_FLAG=n 8387c478bd9Sstevel@tonic-gateF_FLAG=n 8397c478bd9Sstevel@tonic-gatef_FLAG=n 8407c478bd9Sstevel@tonic-gatei_FLAG=n; i_CMD_LINE_FLAG=n 8417c478bd9Sstevel@tonic-gatel_FLAG=n 8426c3c9007SstevelM_FLAG=n 8437c478bd9Sstevel@tonic-gatem_FLAG=n 8446c3c9007SstevelN_FLAG=n 8456c3c9007Ssteveln_FLAG=n 8466c3c9007Sstevelo_FLAG=n 8476c3c9007SstevelP_FLAG=n 8487c478bd9Sstevel@tonic-gatep_FLAG=n 8497c478bd9Sstevel@tonic-gater_FLAG=n 8506c3c9007SstevelT_FLAG=n 8517c478bd9Sstevel@tonic-gatet_FLAG=n 8527c478bd9Sstevel@tonic-gateU_FLAG=n 8536c3c9007Sstevelu_FLAG=n 8547c478bd9Sstevel@tonic-gateV_FLAG=n 8557c478bd9Sstevel@tonic-gateW_FLAG=n 8566c3c9007Sstevelw_FLAG=n 8576c3c9007SstevelX_FLAG=n 8586c3c9007Sstevelz_FLAG=n 8597c478bd9Sstevel@tonic-gateSD_FLAG=n 8606c3c9007SstevelSE_FLAG=n 8617c478bd9Sstevel@tonic-gateSH_FLAG=n 8621fe69678SkupferSO_FLAG=n 8637c478bd9Sstevel@tonic-gate# 8647c478bd9Sstevel@tonic-gateXMOD_OPT= 8657c478bd9Sstevel@tonic-gate# 8667c478bd9Sstevel@tonic-gatebuild_ok=y 8671fe69678Skupfer 8681fe69678Skupferis_source_build() { 8691fe69678Skupfer [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o \ 8701fe69678Skupfer "$SH_FLAG" = "y" -o "$SO_FLAG" = "y" ] 8711fe69678Skupfer return $? 8721fe69678Skupfer} 8731fe69678Skupfer 8747c478bd9Sstevel@tonic-gate# 8757c478bd9Sstevel@tonic-gate# examine arguments 8767c478bd9Sstevel@tonic-gate# 8777c478bd9Sstevel@tonic-gate 8781fe69678Skupfer# 8791fe69678Skupfer# single function for setting -S flag and doing error checking. 8801fe69678Skupfer# usage: set_S_flag <type> 8811fe69678Skupfer# where <type> is the source build type ("E", "D", ...). 8821fe69678Skupfer# 8831fe69678Skupferset_S_flag() { 8841fe69678Skupfer if is_source_build; then 8851fe69678Skupfer echo "Can only build one source variant at a time." 8861fe69678Skupfer exit 1 8871fe69678Skupfer fi 8881fe69678Skupfer if [ "$1" = "E" ]; then 8891fe69678Skupfer SE_FLAG=y 8901fe69678Skupfer elif [ "$1" = "D" ]; then 8911fe69678Skupfer SD_FLAG=y 8921fe69678Skupfer elif [ "$1" = "H" ]; then 8931fe69678Skupfer SH_FLAG=y 8941fe69678Skupfer elif [ "$1" = "O" ]; then 8951fe69678Skupfer SO_FLAG=y 8961fe69678Skupfer else 8971fe69678Skupfer echo "$USAGE" 8981fe69678Skupfer exit 1 8991fe69678Skupfer fi 9001fe69678Skupfer} 9011fe69678Skupfer 9027c478bd9Sstevel@tonic-gateOPTIND=1 9036c3c9007Sstevelwhile getopts inS:tV: FLAG 9047c478bd9Sstevel@tonic-gatedo 9057c478bd9Sstevel@tonic-gate case $FLAG in 9067c478bd9Sstevel@tonic-gate i ) i_FLAG=y; i_CMD_LINE_FLAG=y 9077c478bd9Sstevel@tonic-gate ;; 9087c478bd9Sstevel@tonic-gate n ) n_FLAG=y 9097c478bd9Sstevel@tonic-gate ;; 9107c478bd9Sstevel@tonic-gate S ) 9111fe69678Skupfer set_S_flag $OPTARG 9127c478bd9Sstevel@tonic-gate ;; 9137c478bd9Sstevel@tonic-gate t ) t_FLAG=y 9147c478bd9Sstevel@tonic-gate ;; 9156c3c9007Sstevel V ) V_FLAG=y 9166c3c9007Sstevel V_ARG="$OPTARG" 9176c3c9007Sstevel ;; 9187c478bd9Sstevel@tonic-gate \? ) echo "$USAGE" 9197c478bd9Sstevel@tonic-gate exit 1 9207c478bd9Sstevel@tonic-gate ;; 9217c478bd9Sstevel@tonic-gate esac 9227c478bd9Sstevel@tonic-gatedone 9237c478bd9Sstevel@tonic-gate 9247c478bd9Sstevel@tonic-gate# correct argument count after options 9257c478bd9Sstevel@tonic-gateshift `expr $OPTIND - 1` 9267c478bd9Sstevel@tonic-gate 9277c478bd9Sstevel@tonic-gate# test that the path to the environment-setting file was given 9287c478bd9Sstevel@tonic-gateif [ $# -ne 1 ]; then 9297c478bd9Sstevel@tonic-gate echo "$USAGE" 9307c478bd9Sstevel@tonic-gate exit 1 9317c478bd9Sstevel@tonic-gatefi 9327c478bd9Sstevel@tonic-gate 9337c478bd9Sstevel@tonic-gate# check if user is running nightly as root 9347c478bd9Sstevel@tonic-gate# ISUSER is set non-zero if an ordinary user runs nightly, or is zero 9357c478bd9Sstevel@tonic-gate# when root invokes nightly. 9367c478bd9Sstevel@tonic-gate/usr/bin/id | grep '^uid=0(' >/dev/null 2>&1 9377c478bd9Sstevel@tonic-gateISUSER=$?; export ISUSER 9387c478bd9Sstevel@tonic-gate 9397c478bd9Sstevel@tonic-gate# 9407c478bd9Sstevel@tonic-gate# force locale to C 9417c478bd9Sstevel@tonic-gateLC_COLLATE=C; export LC_COLLATE 9427c478bd9Sstevel@tonic-gateLC_CTYPE=C; export LC_CTYPE 9437c478bd9Sstevel@tonic-gateLC_MESSAGES=C; export LC_MESSAGES 9447c478bd9Sstevel@tonic-gateLC_MONETARY=C; export LC_MONETARY 9457c478bd9Sstevel@tonic-gateLC_NUMERIC=C; export LC_NUMERIC 9467c478bd9Sstevel@tonic-gateLC_TIME=C; export LC_TIME 9477c478bd9Sstevel@tonic-gate 9487c478bd9Sstevel@tonic-gate# clear environment variables we know to be bad for the build 9497c478bd9Sstevel@tonic-gateunset LD_OPTIONS 9507c478bd9Sstevel@tonic-gateunset LD_AUDIT LD_AUDIT_32 LD_AUDIT_64 9517c478bd9Sstevel@tonic-gateunset LD_BIND_NOW LD_BIND_NOW_32 LD_BIND_NOW_64 9527c478bd9Sstevel@tonic-gateunset LD_BREADTH LD_BREADTH_32 LD_BREADTH_64 9537c478bd9Sstevel@tonic-gateunset LD_CONFIG LD_CONFIG_32 LD_CONFIG_64 9547c478bd9Sstevel@tonic-gateunset LD_DEBUG LD_DEBUG_32 LD_DEBUG_64 9557c478bd9Sstevel@tonic-gateunset LD_DEMANGLE LD_DEMANGLE_32 LD_DEMANGLE_64 9567c478bd9Sstevel@tonic-gateunset LD_FLAGS LD_FLAGS_32 LD_FLAGS_64 9577c478bd9Sstevel@tonic-gateunset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 9587c478bd9Sstevel@tonic-gateunset LD_LOADFLTR LD_LOADFLTR_32 LD_LOADFLTR_64 9597c478bd9Sstevel@tonic-gateunset LD_NOAUDIT LD_NOAUDIT_32 LD_NOAUDIT_64 9607c478bd9Sstevel@tonic-gateunset LD_NOAUXFLTR LD_NOAUXFLTR_32 LD_NOAUXFLTR_64 9617c478bd9Sstevel@tonic-gateunset LD_NOCONFIG LD_NOCONFIG_32 LD_NOCONFIG_64 9627c478bd9Sstevel@tonic-gateunset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64 9637c478bd9Sstevel@tonic-gateunset LD_NODIRECT LD_NODIRECT_32 LD_NODIRECT_64 9647c478bd9Sstevel@tonic-gateunset LD_NOLAZYLOAD LD_NOLAZYLOAD_32 LD_NOLAZYLOAD_64 9657c478bd9Sstevel@tonic-gateunset LD_NOOBJALTER LD_NOOBJALTER_32 LD_NOOBJALTER_64 9667c478bd9Sstevel@tonic-gateunset LD_NOVERSION LD_NOVERSION_32 LD_NOVERSION_64 9677c478bd9Sstevel@tonic-gateunset LD_ORIGIN LD_ORIGIN_32 LD_ORIGIN_64 9687c478bd9Sstevel@tonic-gateunset LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64 9697c478bd9Sstevel@tonic-gateunset LD_PROFILE LD_PROFILE_32 LD_PROFILE_64 9707c478bd9Sstevel@tonic-gate 9717c478bd9Sstevel@tonic-gateunset CONFIG 9727c478bd9Sstevel@tonic-gateunset GROUP 9737c478bd9Sstevel@tonic-gateunset OWNER 9747c478bd9Sstevel@tonic-gateunset REMOTE 9757c478bd9Sstevel@tonic-gateunset ENV 9767c478bd9Sstevel@tonic-gateunset ARCH 9777c478bd9Sstevel@tonic-gateunset CLASSPATH 9787c478bd9Sstevel@tonic-gateunset NAME 9797c478bd9Sstevel@tonic-gate 9807c478bd9Sstevel@tonic-gate# 9817c478bd9Sstevel@tonic-gate# Setup environmental variables 9827c478bd9Sstevel@tonic-gate# 9837c478bd9Sstevel@tonic-gateif [ -f $1 ]; then 9847c478bd9Sstevel@tonic-gate if [[ $1 = */* ]]; then 9857c478bd9Sstevel@tonic-gate . $1 9867c478bd9Sstevel@tonic-gate else 9877c478bd9Sstevel@tonic-gate . ./$1 9887c478bd9Sstevel@tonic-gate fi 9897c478bd9Sstevel@tonic-gateelse 9907c478bd9Sstevel@tonic-gate if [ -f $OPTHOME/onbld/env/$1 ]; then 9917c478bd9Sstevel@tonic-gate . $OPTHOME/onbld/env/$1 9927c478bd9Sstevel@tonic-gate else 9937c478bd9Sstevel@tonic-gate echo "Cannot find env file as either $1 or $OPTHOME/onbld/env/$1" 9947c478bd9Sstevel@tonic-gate exit 1 9957c478bd9Sstevel@tonic-gate fi 9967c478bd9Sstevel@tonic-gatefi 9977c478bd9Sstevel@tonic-gate 9981fe69678Skupfer# contents of stdenv.sh inserted after next line: 9991fe69678Skupfer# STDENV_START 10001fe69678Skupfer# STDENV_END 10011fe69678Skupfer 10027c478bd9Sstevel@tonic-gate# 10037c478bd9Sstevel@tonic-gate# place ourselves in a new task, respecting BUILD_PROJECT if set. 10047c478bd9Sstevel@tonic-gate# 10057c478bd9Sstevel@tonic-gateif [ -z "$BUILD_PROJECT" ]; then 10067c478bd9Sstevel@tonic-gate /usr/bin/newtask -c $$ 10077c478bd9Sstevel@tonic-gateelse 10087c478bd9Sstevel@tonic-gate /usr/bin/newtask -c $$ -p $BUILD_PROJECT 10097c478bd9Sstevel@tonic-gatefi 10107c478bd9Sstevel@tonic-gate 10117c478bd9Sstevel@tonic-gateps -o taskid= -p $$ | read build_taskid 10127c478bd9Sstevel@tonic-gateps -o project= -p $$ | read build_project 10137c478bd9Sstevel@tonic-gate 10147c478bd9Sstevel@tonic-gate# 10157c478bd9Sstevel@tonic-gate# See if NIGHTLY_OPTIONS is set 10167c478bd9Sstevel@tonic-gate# 10177c478bd9Sstevel@tonic-gateif [ "$NIGHTLY_OPTIONS" = "" ]; then 10187c478bd9Sstevel@tonic-gate NIGHTLY_OPTIONS="-aBm" 10197c478bd9Sstevel@tonic-gatefi 10207c478bd9Sstevel@tonic-gate 10217c478bd9Sstevel@tonic-gate# 10227c478bd9Sstevel@tonic-gate# If BRINGOVER_WS was not specified, let it default to CLONE_WS 10237c478bd9Sstevel@tonic-gate# 10247c478bd9Sstevel@tonic-gateif [ "$BRINGOVER_WS" = "" ]; then 10257c478bd9Sstevel@tonic-gate BRINGOVER_WS=$CLONE_WS 10267c478bd9Sstevel@tonic-gatefi 10277c478bd9Sstevel@tonic-gate 10287c478bd9Sstevel@tonic-gate# 1029fb23a357Skupfer# If BRINGOVER_FILES was not specified, default to usr 1030a5c06a9eSmike_s# 1031a5c06a9eSmike_sif [ "$BRINGOVER_FILES" = "" ]; then 1032fb23a357Skupfer BRINGOVER_FILES="usr" 1033a5c06a9eSmike_sfi 1034a5c06a9eSmike_s 1035fb9f9b97Skupfer# 1036fb9f9b97Skupfer# If the closed sources are not present, the closed binaries must be 1037fb9f9b97Skupfer# present for the build to succeed. If there's no pointer to the 1038fb9f9b97Skupfer# closed binaries, flag that now, rather than forcing the user to wait 1039fb9f9b97Skupfer# a couple hours (or more) to find out. 1040fb9f9b97Skupfer# 1041085d331dSkupferorig_closed_is_present="$CLOSED_IS_PRESENT" 1042085d331dSkupfercheck_closed_tree 1043fb9f9b97Skupfer 1044a5c06a9eSmike_s# 10457c478bd9Sstevel@tonic-gate# Note: changes to the option letters here should also be applied to the 1046b84bdc30Smeem# bldenv script. `d' is listed for backward compatibility. 10477c478bd9Sstevel@tonic-gate# 1048d77e7149SsommerfeNIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-} 10497c478bd9Sstevel@tonic-gateOPTIND=1 10506c3c9007Sstevelwhile getopts AaBCDdFfGIilMmNnoPpRrS:TtUuWwXxz FLAG $NIGHTLY_OPTIONS 10517c478bd9Sstevel@tonic-gatedo 10527c478bd9Sstevel@tonic-gate case $FLAG in 10537c478bd9Sstevel@tonic-gate A ) A_FLAG=y 10547c478bd9Sstevel@tonic-gate ;; 10556c3c9007Sstevel a ) a_FLAG=y 10566c3c9007Sstevel ;; 10577c478bd9Sstevel@tonic-gate B ) D_FLAG=y 10587c478bd9Sstevel@tonic-gate ;; # old version of D 10596c3c9007Sstevel C ) C_FLAG=y 10607c478bd9Sstevel@tonic-gate ;; 10617c478bd9Sstevel@tonic-gate D ) D_FLAG=y 10627c478bd9Sstevel@tonic-gate ;; 10636c3c9007Sstevel F ) F_FLAG=y 10647c478bd9Sstevel@tonic-gate ;; 10656c3c9007Sstevel f ) f_FLAG=y 10667c478bd9Sstevel@tonic-gate ;; 10677c478bd9Sstevel@tonic-gate G ) a_FLAG=y 10687c478bd9Sstevel@tonic-gate u_FLAG=y 10697c478bd9Sstevel@tonic-gate ;; 10707c478bd9Sstevel@tonic-gate I ) a_FLAG=y 10717c478bd9Sstevel@tonic-gate m_FLAG=y 10727c478bd9Sstevel@tonic-gate p_FLAG=y 10737c478bd9Sstevel@tonic-gate u_FLAG=y 10747c478bd9Sstevel@tonic-gate ;; 10757c478bd9Sstevel@tonic-gate i ) i_FLAG=y 10767c478bd9Sstevel@tonic-gate ;; 10776c3c9007Sstevel l ) l_FLAG=y 10786c3c9007Sstevel ;; 10796c3c9007Sstevel M ) M_FLAG=y 10806c3c9007Sstevel ;; 10816c3c9007Sstevel m ) m_FLAG=y 10826c3c9007Sstevel ;; 10836c3c9007Sstevel N ) N_FLAG=y 10846c3c9007Sstevel ;; 10857c478bd9Sstevel@tonic-gate n ) n_FLAG=y 10867c478bd9Sstevel@tonic-gate ;; 10877c478bd9Sstevel@tonic-gate o ) o_FLAG=y 10887c478bd9Sstevel@tonic-gate ;; 10896c3c9007Sstevel P ) P_FLAG=y 10906c3c9007Sstevel ;; # obsolete 10917c478bd9Sstevel@tonic-gate p ) p_FLAG=y 10927c478bd9Sstevel@tonic-gate ;; 10936c3c9007Sstevel R ) m_FLAG=y 10946c3c9007Sstevel p_FLAG=y 10956c3c9007Sstevel ;; 10967c478bd9Sstevel@tonic-gate r ) r_FLAG=y 10977c478bd9Sstevel@tonic-gate ;; 10986c3c9007Sstevel S ) 10996c3c9007Sstevel set_S_flag $OPTARG 11006c3c9007Sstevel ;; 11016c3c9007Sstevel T ) T_FLAG=y 11026c3c9007Sstevel ;; # obsolete 11037c478bd9Sstevel@tonic-gate t ) t_FLAG=y 11047c478bd9Sstevel@tonic-gate ;; 11057c478bd9Sstevel@tonic-gate U ) 11067c478bd9Sstevel@tonic-gate if [ -z "${PARENT_ROOT}" ]; then 11077c478bd9Sstevel@tonic-gate echo "PARENT_ROOT must be set if the U flag is" \ 11087c478bd9Sstevel@tonic-gate "present in NIGHTLY_OPTIONS." 11097c478bd9Sstevel@tonic-gate exit 1 11107c478bd9Sstevel@tonic-gate fi 11117c478bd9Sstevel@tonic-gate U_FLAG=y 11127c478bd9Sstevel@tonic-gate NIGHTLY_PARENT_ROOT=$PARENT_ROOT 11137c478bd9Sstevel@tonic-gate ;; 11146c3c9007Sstevel u ) u_FLAG=y 11157c478bd9Sstevel@tonic-gate ;; 11167c478bd9Sstevel@tonic-gate W ) W_FLAG=y 11177c478bd9Sstevel@tonic-gate ;; 11186c3c9007Sstevel 11196c3c9007Sstevel w ) w_FLAG=y 11207c478bd9Sstevel@tonic-gate ;; 11217c478bd9Sstevel@tonic-gate X ) # now that we no longer need realmode builds, just 11227c478bd9Sstevel@tonic-gate # copy IHV packages. only meaningful on x86. 11237c478bd9Sstevel@tonic-gate if [ "$MACH" = "i386" ]; then 11247c478bd9Sstevel@tonic-gate X_FLAG=y 11257c478bd9Sstevel@tonic-gate fi 11267c478bd9Sstevel@tonic-gate ;; 11276c3c9007Sstevel x ) XMOD_OPT="-x" 11286c3c9007Sstevel ;; 11296c3c9007Sstevel z ) z_FLAG=y 11306c3c9007Sstevel ;; 11317c478bd9Sstevel@tonic-gate \? ) echo "$USAGE" 11327c478bd9Sstevel@tonic-gate exit 1 11337c478bd9Sstevel@tonic-gate ;; 11347c478bd9Sstevel@tonic-gate esac 11357c478bd9Sstevel@tonic-gatedone 11367c478bd9Sstevel@tonic-gate 11377c478bd9Sstevel@tonic-gateif [ $ISUSER -ne 0 ]; then 11387c478bd9Sstevel@tonic-gate if [ "$o_FLAG" = "y" ]; then 11397c478bd9Sstevel@tonic-gate echo "Old-style build requires root permission." 11407c478bd9Sstevel@tonic-gate exit 1 11417c478bd9Sstevel@tonic-gate fi 11427c478bd9Sstevel@tonic-gate 11437c478bd9Sstevel@tonic-gate # Set default value for STAFFER, if needed. 11447c478bd9Sstevel@tonic-gate if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then 11457c478bd9Sstevel@tonic-gate STAFFER=`/usr/xpg4/bin/id -un` 11467c478bd9Sstevel@tonic-gate export STAFFER 11477c478bd9Sstevel@tonic-gate fi 11487c478bd9Sstevel@tonic-gatefi 11497c478bd9Sstevel@tonic-gate 11507c478bd9Sstevel@tonic-gateif [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then 11517c478bd9Sstevel@tonic-gate MAILTO=$STAFFER 11527c478bd9Sstevel@tonic-gate export MAILTO 11537c478bd9Sstevel@tonic-gatefi 11547c478bd9Sstevel@tonic-gate 11557c478bd9Sstevel@tonic-gatePATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin" 11567c478bd9Sstevel@tonic-gatePATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb" 11577c478bd9Sstevel@tonic-gatePATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:." 11587c478bd9Sstevel@tonic-gateexport PATH 11597c478bd9Sstevel@tonic-gate 1160fb23a357Skupfer# roots of source trees, both relative to $SRC and absolute. 1161fb23a357Skupferrelsrcdirs="." 1162fb9f9b97Skupferif [[ -d $SRC/../closed && "$CLOSED_IS_PRESENT" != no ]]; then 1163fb9f9b97Skupfer relsrcdirs="$relsrcdirs ../closed" 1164fb9f9b97Skupferfi 1165fb23a357Skupferabssrcdirs="" 1166fb23a357Skupferfor d in $relsrcdirs; do 1167fb23a357Skupfer abssrcdirs="$abssrcdirs $SRC/$d" 1168fb23a357Skupferdone 1169fb23a357Skupfer 11707c478bd9Sstevel@tonic-gateunset CH 11717c478bd9Sstevel@tonic-gateif [ "$o_FLAG" = "y" ]; then 11727c478bd9Sstevel@tonic-gate# root invoked old-style build -- make sure it works as it always has 11737c478bd9Sstevel@tonic-gate# by exporting 'CH'. The current Makefile.master doesn't use this, but 11747c478bd9Sstevel@tonic-gate# the old ones still do. 11757c478bd9Sstevel@tonic-gate PROTOCMPTERSE="protocmp.terse" 11767c478bd9Sstevel@tonic-gate CH= 11777c478bd9Sstevel@tonic-gate export CH 11787c478bd9Sstevel@tonic-gateelse 11797c478bd9Sstevel@tonic-gate PROTOCMPTERSE="protocmp.terse -gu" 11807c478bd9Sstevel@tonic-gatefi 11817c478bd9Sstevel@tonic-gatePOUND_SIGN="#" 11827c478bd9Sstevel@tonic-gate 11837c478bd9Sstevel@tonic-gate# we export POUND_SIGN to speed up the build process -- prevents evaluation of 11847c478bd9Sstevel@tonic-gate# the Makefile.master definitions. 11856fec3625Sdduvallexport o_FLAG X_FLAG POUND_SIGN 11867c478bd9Sstevel@tonic-gate 11877c478bd9Sstevel@tonic-gatemaketype="distributed" 11887c478bd9Sstevel@tonic-gateMAKE=dmake 11897c478bd9Sstevel@tonic-gate# get the dmake version string alone 11907c478bd9Sstevel@tonic-gateDMAKE_VERSION=$( $MAKE -v ) 11917c478bd9Sstevel@tonic-gateDMAKE_VERSION=${DMAKE_VERSION#*: } 11927c478bd9Sstevel@tonic-gate# focus in on just the dotted version number alone 11937c478bd9Sstevel@tonic-gateDMAKE_MAJOR=$( echo $DMAKE_VERSION | \ 11947c478bd9Sstevel@tonic-gate sed -e 's/.*\<\([^.]*\.[^ ]*\).*$/\1/' ) 11957c478bd9Sstevel@tonic-gate# extract the second (or final) integer 11967c478bd9Sstevel@tonic-gateDMAKE_MINOR=${DMAKE_MAJOR#*.} 11977c478bd9Sstevel@tonic-gateDMAKE_MINOR=${DMAKE_MINOR%%.*} 11987c478bd9Sstevel@tonic-gate# extract the first integer 11997c478bd9Sstevel@tonic-gateDMAKE_MAJOR=${DMAKE_MAJOR%%.*} 12007c478bd9Sstevel@tonic-gateCHECK_DMAKE=${CHECK_DMAKE:-y} 12017c478bd9Sstevel@tonic-gate# x86 was built on the 12th, sparc on the 13th. 12027c478bd9Sstevel@tonic-gateif [ "$CHECK_DMAKE" = "y" -a \ 12037c478bd9Sstevel@tonic-gate "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \ 12047c478bd9Sstevel@tonic-gate "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \( \ 12057c478bd9Sstevel@tonic-gate "$DMAKE_MAJOR" -lt 7 -o \ 12067c478bd9Sstevel@tonic-gate "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \) ]; then 12077c478bd9Sstevel@tonic-gate if [ -z "$DMAKE_VERSION" ]; then 12087c478bd9Sstevel@tonic-gate echo "$MAKE is missing." 12097c478bd9Sstevel@tonic-gate exit 1 12107c478bd9Sstevel@tonic-gate fi 12117c478bd9Sstevel@tonic-gate echo `whence $MAKE`" version is:" 12127c478bd9Sstevel@tonic-gate echo " ${DMAKE_VERSION}" 12137c478bd9Sstevel@tonic-gate cat <<EOF 12147c478bd9Sstevel@tonic-gate 12157c478bd9Sstevel@tonic-gateThis version may not be safe for use. Either set TEAMWARE to a better 12167c478bd9Sstevel@tonic-gatepath or (if you really want to use this version of dmake anyway), add 12177c478bd9Sstevel@tonic-gatethe following to your environment to disable this check: 12187c478bd9Sstevel@tonic-gate 12197c478bd9Sstevel@tonic-gate CHECK_DMAKE=n 12207c478bd9Sstevel@tonic-gateEOF 12217c478bd9Sstevel@tonic-gate exit 1 12227c478bd9Sstevel@tonic-gatefi 12237c478bd9Sstevel@tonic-gateexport PATH 12247c478bd9Sstevel@tonic-gateexport MAKE 12257c478bd9Sstevel@tonic-gate 12267c478bd9Sstevel@tonic-gateif [ "${SUNWSPRO}" != "" ]; then 12277c478bd9Sstevel@tonic-gate PATH="${SUNWSPRO}/bin:$PATH" 12287c478bd9Sstevel@tonic-gate export PATH 12297c478bd9Sstevel@tonic-gatefi 12307c478bd9Sstevel@tonic-gate 12317c478bd9Sstevel@tonic-gatehostname=`uname -n` 12327c478bd9Sstevel@tonic-gateif [ ! -f $HOME/.make.machines ]; then 12337c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS=4 12347c478bd9Sstevel@tonic-gateelse 12357c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS="`grep $hostname $HOME/.make.machines | \ 12367c478bd9Sstevel@tonic-gate tail -1 | awk -F= '{print $ 2;}'`" 12377c478bd9Sstevel@tonic-gate if [ "$DMAKE_MAX_JOBS" = "" ]; then 12387c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS=4 12397c478bd9Sstevel@tonic-gate fi 12407c478bd9Sstevel@tonic-gatefi 12417c478bd9Sstevel@tonic-gateDMAKE_MODE=parallel; 12427c478bd9Sstevel@tonic-gateexport DMAKE_MODE 12437c478bd9Sstevel@tonic-gateexport DMAKE_MAX_JOBS 12447c478bd9Sstevel@tonic-gate 12457c478bd9Sstevel@tonic-gateif [ -z "${ROOT}" ]; then 12467c478bd9Sstevel@tonic-gate echo "ROOT must be set." 12477c478bd9Sstevel@tonic-gate exit 1 12487c478bd9Sstevel@tonic-gatefi 12497c478bd9Sstevel@tonic-gate 12507c478bd9Sstevel@tonic-gate# 12517c478bd9Sstevel@tonic-gate# if -V flag was given, reset VERSION to V_ARG 12527c478bd9Sstevel@tonic-gate# 12537c478bd9Sstevel@tonic-gateif [ "$V_FLAG" = "y" ]; then 12547c478bd9Sstevel@tonic-gate VERSION=$V_ARG 12557c478bd9Sstevel@tonic-gatefi 12567c478bd9Sstevel@tonic-gate 125704a42e3eSszhou# 125804a42e3eSszhou# Check for IHV root for copying ihv proto area 125904a42e3eSszhou# 126004a42e3eSszhouif [ "$X_FLAG" = "y" ]; then 126104a42e3eSszhou if [ "$IA32_IHV_ROOT" = "" ]; then 126204a42e3eSszhou echo "IA32_IHV_ROOT: must be set for copying ihv proto" 126304a42e3eSszhou args_ok=n 126404a42e3eSszhou fi 126504a42e3eSszhou if [ ! -d "$IA32_IHV_ROOT" ]; then 126604a42e3eSszhou echo "$IA32_IHV_ROOT: not found" 126704a42e3eSszhou args_ok=n 126804a42e3eSszhou fi 12696fec3625Sdduvall if [ "$IA32_IHV_WS" = "" ]; then 12706fec3625Sdduvall echo "IA32_IHV_WS: must be set for copying ihv proto" 12716fec3625Sdduvall args_ok=n 12726fec3625Sdduvall fi 12736fec3625Sdduvall if [ ! -d "$IA32_IHV_WS" ]; then 12746fec3625Sdduvall echo "$IA32_IHV_WS: not found" 12756fec3625Sdduvall args_ok=n 12766fec3625Sdduvall fi 127704a42e3eSszhoufi 127804a42e3eSszhou 12797c478bd9Sstevel@tonic-gate# Append source version 12807c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" ]; then 12817c478bd9Sstevel@tonic-gate VERSION="${VERSION}:EXPORT" 12827c478bd9Sstevel@tonic-gatefi 12837c478bd9Sstevel@tonic-gate 12847c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 12857c478bd9Sstevel@tonic-gate VERSION="${VERSION}:DOMESTIC" 12867c478bd9Sstevel@tonic-gatefi 12877c478bd9Sstevel@tonic-gate 12887c478bd9Sstevel@tonic-gateif [ "$SH_FLAG" = "y" ]; then 12897c478bd9Sstevel@tonic-gate VERSION="${VERSION}:MODIFIED_SOURCE_PRODUCT" 12907c478bd9Sstevel@tonic-gatefi 12917c478bd9Sstevel@tonic-gate 12921fe69678Skupferif [ "$SO_FLAG" = "y" ]; then 12931fe69678Skupfer VERSION="${VERSION}:OPEN_ONLY" 12941fe69678Skupferfi 12951fe69678Skupfer 12967c478bd9Sstevel@tonic-gateTMPDIR="/tmp/nightly.tmpdir.$$" 12977c478bd9Sstevel@tonic-gateexport TMPDIR 12987c478bd9Sstevel@tonic-gaterm -rf ${TMPDIR} 12997c478bd9Sstevel@tonic-gatemkdir -p $TMPDIR || exit 1 13007c478bd9Sstevel@tonic-gate 13017c478bd9Sstevel@tonic-gate# 13027c478bd9Sstevel@tonic-gate# Keep elfsign's use of pkcs11_softtoken from looking in the user home 13037c478bd9Sstevel@tonic-gate# directory, which doesn't always work. Needed until all build machines 13047c478bd9Sstevel@tonic-gate# have the fix for 6271754 13057c478bd9Sstevel@tonic-gate# 13067c478bd9Sstevel@tonic-gateSOFTTOKEN_DIR=$TMPDIR 13077c478bd9Sstevel@tonic-gateexport SOFTTOKEN_DIR 13087c478bd9Sstevel@tonic-gate 13097c478bd9Sstevel@tonic-gateTOOLS=${SRC}/tools 13107c478bd9Sstevel@tonic-gateTOOLS_PROTO=${TOOLS}/proto 13117c478bd9Sstevel@tonic-gate 13127c478bd9Sstevel@tonic-gateunset CFLAGS LD_LIBRARY_PATH LDFLAGS 13137c478bd9Sstevel@tonic-gate 13147c478bd9Sstevel@tonic-gate# create directories that are automatically removed if the nightly script 13157c478bd9Sstevel@tonic-gate# fails to start correctly 13167c478bd9Sstevel@tonic-gatenewdir() { 13177c478bd9Sstevel@tonic-gate dir=$1 13187c478bd9Sstevel@tonic-gate toadd= 13197c478bd9Sstevel@tonic-gate while [ ! -d $dir ]; do 13207c478bd9Sstevel@tonic-gate toadd="$dir $toadd" 13217c478bd9Sstevel@tonic-gate dir=`dirname $dir` 13227c478bd9Sstevel@tonic-gate done 13237c478bd9Sstevel@tonic-gate torm= 13247c478bd9Sstevel@tonic-gate newlist= 13257c478bd9Sstevel@tonic-gate for dir in $toadd; do 13267c478bd9Sstevel@tonic-gate if staffer mkdir $dir; then 13277c478bd9Sstevel@tonic-gate newlist="$ISUSER $dir $newlist" 13287c478bd9Sstevel@tonic-gate torm="$dir $torm" 13297c478bd9Sstevel@tonic-gate else 13307c478bd9Sstevel@tonic-gate [ -z "$torm" ] || staffer rmdir $torm 13317c478bd9Sstevel@tonic-gate return 1 13327c478bd9Sstevel@tonic-gate fi 13337c478bd9Sstevel@tonic-gate done 13347c478bd9Sstevel@tonic-gate newdirlist="$newlist $newdirlist" 13357c478bd9Sstevel@tonic-gate return 0 13367c478bd9Sstevel@tonic-gate} 13377c478bd9Sstevel@tonic-gatenewdirlist= 13387c478bd9Sstevel@tonic-gate 13397c478bd9Sstevel@tonic-gate[ -d $CODEMGR_WS ] || newdir $CODEMGR_WS || exit 1 13407c478bd9Sstevel@tonic-gate 13417c478bd9Sstevel@tonic-gate# since this script assumes the build is from full source, it nullifies 13427c478bd9Sstevel@tonic-gate# variables likely to have been set by a "ws" script; nullification 13437c478bd9Sstevel@tonic-gate# confines the search space for headers and libraries to the proto area 13447c478bd9Sstevel@tonic-gate# built from this immediate source. 13457c478bd9Sstevel@tonic-gateENVLDLIBS1= 13467c478bd9Sstevel@tonic-gateENVLDLIBS2= 13477c478bd9Sstevel@tonic-gateENVLDLIBS3= 13487c478bd9Sstevel@tonic-gateENVCPPFLAGS1= 13497c478bd9Sstevel@tonic-gateENVCPPFLAGS2= 13507c478bd9Sstevel@tonic-gateENVCPPFLAGS3= 13517c478bd9Sstevel@tonic-gateENVCPPFLAGS4= 13527c478bd9Sstevel@tonic-gatePARENT_ROOT= 13537c478bd9Sstevel@tonic-gate 13547c478bd9Sstevel@tonic-gateexport ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \ 13557c478bd9Sstevel@tonic-gate PARENT_ROOT 13567c478bd9Sstevel@tonic-gate 13577c478bd9Sstevel@tonic-gateENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib" 13587c478bd9Sstevel@tonic-gateENVCPPFLAGS1="-I$ROOT/usr/include" 13597c478bd9Sstevel@tonic-gate 13607c478bd9Sstevel@tonic-gateexport ENVLDLIBS1 ENVLDLIBS2 13617c478bd9Sstevel@tonic-gate 13627c478bd9Sstevel@tonic-gateCPIODIR_ORIG=$CPIODIR 13637c478bd9Sstevel@tonic-gatePKGARCHIVE_ORIG=$PKGARCHIVE 13647c478bd9Sstevel@tonic-gateIA32_IHV_PKGS_ORIG=$IA32_IHV_PKGS 1365d8fd4470Sjgif [ "$SPARC_RM_PKGARCHIVE" ]; then 13667c478bd9Sstevel@tonic-gate SPARC_RM_PKGARCHIVE_ORIG=$SPARC_RM_PKGARCHIVE 1367d8fd4470Sjgfi 13687c478bd9Sstevel@tonic-gate 13697c478bd9Sstevel@tonic-gate# 13707c478bd9Sstevel@tonic-gate# Juggle the logs and optionally send mail on completion. 13717c478bd9Sstevel@tonic-gate# 13727c478bd9Sstevel@tonic-gate 13737c478bd9Sstevel@tonic-gatelogshuffle() { 13741c79753fSdarrenm LLOG="$ATLOG/log.`date '+%F'`" 13757c478bd9Sstevel@tonic-gate rm -rf $ATLOG/log.??`date '+%d'` 13761c79753fSdarrenm rm -rf $ATLOG/log.????-??-`date '+%d'` 13777c478bd9Sstevel@tonic-gate if [ -f $LLOG -o -d $LLOG ]; then 13787c478bd9Sstevel@tonic-gate LLOG=$LLOG.$$ 13797c478bd9Sstevel@tonic-gate fi 13807c478bd9Sstevel@tonic-gate mkdir $LLOG 13814802ef38Srscott export LLOG 13827c478bd9Sstevel@tonic-gate 13837c478bd9Sstevel@tonic-gate if [ "$build_ok" = "y" ]; then 13847c478bd9Sstevel@tonic-gate mv $ATLOG/proto_list_${MACH} $LLOG 138596ccc8cbSesaxe 138696ccc8cbSesaxe if [ -f $TMPDIR/wsdiff.results ]; then 138796ccc8cbSesaxe mv $TMPDIR/wsdiff.results $LLOG 138896ccc8cbSesaxe fi 13897c478bd9Sstevel@tonic-gate fi 13907c478bd9Sstevel@tonic-gate 13917c478bd9Sstevel@tonic-gate # 13927c478bd9Sstevel@tonic-gate # Now that we're about to send mail, it's time to check the noise 13937c478bd9Sstevel@tonic-gate # file. In the event that an error occurs beyond this point, it will 13947c478bd9Sstevel@tonic-gate # be recorded in the nightly.log file, but nowhere else. This would 13957c478bd9Sstevel@tonic-gate # include only errors that cause the copying of the noise log to fail 13967c478bd9Sstevel@tonic-gate # or the mail itself not to be sent. 13977c478bd9Sstevel@tonic-gate # 13987c478bd9Sstevel@tonic-gate 13997c478bd9Sstevel@tonic-gate exec >>$LOGFILE 2>&1 14007c478bd9Sstevel@tonic-gate if [ -s $build_noise_file ]; then 14017c478bd9Sstevel@tonic-gate echo "\n==== Nightly build noise ====\n" | 14027c478bd9Sstevel@tonic-gate tee -a $LOGFILE >>$mail_msg_file 14037c478bd9Sstevel@tonic-gate cat $build_noise_file >>$LOGFILE 14047c478bd9Sstevel@tonic-gate cat $build_noise_file >>$mail_msg_file 14057c478bd9Sstevel@tonic-gate echo | tee -a $LOGFILE >>$mail_msg_file 14067c478bd9Sstevel@tonic-gate fi 14077c478bd9Sstevel@tonic-gate rm -f $build_noise_file 14087c478bd9Sstevel@tonic-gate 14097c478bd9Sstevel@tonic-gate case "$build_ok" in 14107c478bd9Sstevel@tonic-gate y) 14117c478bd9Sstevel@tonic-gate state=Completed 14127c478bd9Sstevel@tonic-gate ;; 14137c478bd9Sstevel@tonic-gate i) 14147c478bd9Sstevel@tonic-gate state=Interrupted 14157c478bd9Sstevel@tonic-gate ;; 14167c478bd9Sstevel@tonic-gate *) 14177c478bd9Sstevel@tonic-gate state=Failed 14187c478bd9Sstevel@tonic-gate ;; 14197c478bd9Sstevel@tonic-gate esac 142040bc9153Srscott NIGHTLY_STATUS=$state 142140bc9153Srscott export NIGHTLY_STATUS 14227c478bd9Sstevel@tonic-gate 142340bc9153Srscott if [ -n "$POST_NIGHTLY" ]; then 142440bc9153Srscott echo "\n==== Running POST_NIGHTLY command:" \ 142540bc9153Srscott "$POST_NIGHTLY ====\n" | tee -a $mail_msg_file >> $LOGFILE 142640bc9153Srscott $POST_NIGHTLY $state 2>&1 | tee -a $mail_msg_file >> $LOGFILE 14274802ef38Srscott fi 14284802ef38Srscott 14297c478bd9Sstevel@tonic-gate cat $build_time_file $mail_msg_file > ${LLOG}/mail_msg 14307c478bd9Sstevel@tonic-gate if [ "$m_FLAG" = "y" ]; then 14317c478bd9Sstevel@tonic-gate cat $build_time_file $mail_msg_file | 14327c478bd9Sstevel@tonic-gate /usr/bin/mailx -s \ 14337c478bd9Sstevel@tonic-gate "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \ 14347c478bd9Sstevel@tonic-gate ${MAILTO} 14357c478bd9Sstevel@tonic-gate fi 14367c478bd9Sstevel@tonic-gate 14377c478bd9Sstevel@tonic-gate if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 14387c478bd9Sstevel@tonic-gate staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH} 14397c478bd9Sstevel@tonic-gate staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log 14407c478bd9Sstevel@tonic-gate fi 14417c478bd9Sstevel@tonic-gate 14427c478bd9Sstevel@tonic-gate mv $LOGFILE $LLOG 14437c478bd9Sstevel@tonic-gate} 14447c478bd9Sstevel@tonic-gate 14457c478bd9Sstevel@tonic-gate# 14467c478bd9Sstevel@tonic-gate# Remove the locks and temporary files on any exit 14477c478bd9Sstevel@tonic-gate# 14487c478bd9Sstevel@tonic-gatecleanup() { 14497c478bd9Sstevel@tonic-gate logshuffle 14507c478bd9Sstevel@tonic-gate 14517c478bd9Sstevel@tonic-gate [ -z "$lockfile" ] || staffer rm -f $lockfile 14527c478bd9Sstevel@tonic-gate [ -z "$atloglockfile" ] || rm -f $atloglockfile 14537c478bd9Sstevel@tonic-gate [ -z "$ulockfile" ] || staffer rm -f $ulockfile 14547c478bd9Sstevel@tonic-gate [ -z "$Ulockfile" ] || rm -f $Ulockfile 14557c478bd9Sstevel@tonic-gate 14567c478bd9Sstevel@tonic-gate set -- $newdirlist 14577c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 14587c478bd9Sstevel@tonic-gate ISUSER=$1 staffer rmdir $2 14597c478bd9Sstevel@tonic-gate shift; shift 14607c478bd9Sstevel@tonic-gate done 14617c478bd9Sstevel@tonic-gate rm -rf $TMPDIR 14627c478bd9Sstevel@tonic-gate} 14637c478bd9Sstevel@tonic-gate 14647c478bd9Sstevel@tonic-gatecleanup_signal() { 14657c478bd9Sstevel@tonic-gate build_ok=i 14667c478bd9Sstevel@tonic-gate # this will trigger cleanup(), above. 14677c478bd9Sstevel@tonic-gate exit 1 14687c478bd9Sstevel@tonic-gate} 14697c478bd9Sstevel@tonic-gate 14707c478bd9Sstevel@tonic-gatetrap cleanup 0 14717c478bd9Sstevel@tonic-gatetrap cleanup_signal 1 2 3 15 14727c478bd9Sstevel@tonic-gate 14737c478bd9Sstevel@tonic-gate# 14747c478bd9Sstevel@tonic-gate# Generic lock file processing -- make sure that the lock file doesn't 14757c478bd9Sstevel@tonic-gate# exist. If it does, it should name the build host and PID. If it 14767c478bd9Sstevel@tonic-gate# doesn't, then make sure we can create it. Clean up locks that are 14777c478bd9Sstevel@tonic-gate# known to be stale (assumes host name is unique among build systems 14787c478bd9Sstevel@tonic-gate# for the workspace). 14797c478bd9Sstevel@tonic-gatecreate_lock() { 14807c478bd9Sstevel@tonic-gate lockf=$1 14817c478bd9Sstevel@tonic-gate lockvar=$2 14827c478bd9Sstevel@tonic-gate if [ -f $lockf ]; then 14837c478bd9Sstevel@tonic-gate basews=`basename $CODEMGR_WS` 14847c478bd9Sstevel@tonic-gate if read host user pid < $lockf; then 14857c478bd9Sstevel@tonic-gate if [ "$host" != "$hostname" ]; then 14867c478bd9Sstevel@tonic-gate echo "$MACH build of $basews apparently" \ 14877c478bd9Sstevel@tonic-gate "already started by $user on $host as $pid." 14887c478bd9Sstevel@tonic-gate elif kill -s 0 $pid 2>/dev/null; then 14897c478bd9Sstevel@tonic-gate echo "$MACH build of $basews already started" \ 14907c478bd9Sstevel@tonic-gate "by $user as $pid." 14917c478bd9Sstevel@tonic-gate else 14927c478bd9Sstevel@tonic-gate # stale lock; clear it out and continue 14937c478bd9Sstevel@tonic-gate rm -f $lockf 14947c478bd9Sstevel@tonic-gate fi 14957c478bd9Sstevel@tonic-gate else 14967c478bd9Sstevel@tonic-gate echo "$MACH build of $basews already running." 14977c478bd9Sstevel@tonic-gate fi 14987c478bd9Sstevel@tonic-gate fi 14997c478bd9Sstevel@tonic-gate if [ -f $lockf ]; then 15007c478bd9Sstevel@tonic-gate echo "Lock file is $lockf." 15017c478bd9Sstevel@tonic-gate exit 1 15027c478bd9Sstevel@tonic-gate fi 15037c478bd9Sstevel@tonic-gate ldir=`dirname $lockf` 15047c478bd9Sstevel@tonic-gate [ -d $ldir ] || newdir $ldir || exit 1 15057c478bd9Sstevel@tonic-gate eval $lockvar=$lockf 15067c478bd9Sstevel@tonic-gate staffer sh -c "echo $hostname $STAFFER $$ > $lockf" || exit 1 15077c478bd9Sstevel@tonic-gate} 15087c478bd9Sstevel@tonic-gate 15097c478bd9Sstevel@tonic-gate# Ensure no other instance of this script is running on this host. 15107c478bd9Sstevel@tonic-gate# LOCKNAME can be set in <env_file>, and is by default, but is not 15117c478bd9Sstevel@tonic-gate# required due to the use of $ATLOG below. 15127c478bd9Sstevel@tonic-gateif [ -n "$LOCKNAME" ]; then 15137c478bd9Sstevel@tonic-gate create_lock /tmp/$LOCKNAME "lockfile" 15147c478bd9Sstevel@tonic-gatefi 15157c478bd9Sstevel@tonic-gate# 15167c478bd9Sstevel@tonic-gate# Create from one, two, or three other locks: 15177c478bd9Sstevel@tonic-gate# $ATLOG/nightly.lock 15187c478bd9Sstevel@tonic-gate# - protects against multiple builds in same workspace 15197c478bd9Sstevel@tonic-gate# $PARENT_WS/usr/src/nightly.$MACH.lock 15207c478bd9Sstevel@tonic-gate# - protects against multiple 'u' copy-backs 15217c478bd9Sstevel@tonic-gate# $NIGHTLY_PARENT_ROOT/nightly.lock 15227c478bd9Sstevel@tonic-gate# - protects against multiple 'U' copy-backs 15237c478bd9Sstevel@tonic-gate# 15247c478bd9Sstevel@tonic-gate# Overriding ISUSER to 1 causes the lock to be created as root if the 15257c478bd9Sstevel@tonic-gate# script is run as root. The default is to create it as $STAFFER. 15267c478bd9Sstevel@tonic-gateISUSER=1 create_lock $ATLOG/nightly.lock "atloglockfile" 15277c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" ]; then 15287c478bd9Sstevel@tonic-gate create_lock $PARENT_WS/usr/src/nightly.$MACH.lock "ulockfile" 15297c478bd9Sstevel@tonic-gatefi 15307c478bd9Sstevel@tonic-gateif [ "$U_FLAG" = "y" ]; then 15317c478bd9Sstevel@tonic-gate # NIGHTLY_PARENT_ROOT is written as root if script invoked as root. 15327c478bd9Sstevel@tonic-gate ISUSER=1 create_lock $NIGHTLY_PARENT_ROOT/nightly.lock "Ulockfile" 15337c478bd9Sstevel@tonic-gatefi 15347c478bd9Sstevel@tonic-gate 15357c478bd9Sstevel@tonic-gate# Locks have been taken, so we're doing a build and we're committed to 15367c478bd9Sstevel@tonic-gate# the directories we may have created so far. 15377c478bd9Sstevel@tonic-gatenewdirlist= 15387c478bd9Sstevel@tonic-gate 15397c478bd9Sstevel@tonic-gate# 15407c478bd9Sstevel@tonic-gate# Create mail_msg_file 15417c478bd9Sstevel@tonic-gate# 15427c478bd9Sstevel@tonic-gatemail_msg_file="${TMPDIR}/mail_msg" 15437c478bd9Sstevel@tonic-gatetouch $mail_msg_file 15447c478bd9Sstevel@tonic-gatebuild_time_file="${TMPDIR}/build_time" 15457c478bd9Sstevel@tonic-gate# 15467c478bd9Sstevel@tonic-gate# Move old LOGFILE aside 15477c478bd9Sstevel@tonic-gate# ATLOG directory already made by 'create_lock' above 15487c478bd9Sstevel@tonic-gate# 15497c478bd9Sstevel@tonic-gateif [ -f $LOGFILE ]; then 15507c478bd9Sstevel@tonic-gate mv -f $LOGFILE ${LOGFILE}- 15517c478bd9Sstevel@tonic-gatefi 15527c478bd9Sstevel@tonic-gate# 15537c478bd9Sstevel@tonic-gate# Build OsNet source 15547c478bd9Sstevel@tonic-gate# 15557c478bd9Sstevel@tonic-gateSTART_DATE=`date` 15567c478bd9Sstevel@tonic-gateSECONDS=0 15577c478bd9Sstevel@tonic-gateecho "\n==== Nightly $maketype build started: $START_DATE ====" \ 15587c478bd9Sstevel@tonic-gate | tee -a $LOGFILE > $build_time_file 15597c478bd9Sstevel@tonic-gate 15607c478bd9Sstevel@tonic-gate# make sure we log only to the nightly build file 15617c478bd9Sstevel@tonic-gatebuild_noise_file="${TMPDIR}/build_noise" 15627c478bd9Sstevel@tonic-gateexec </dev/null >$build_noise_file 2>&1 15637c478bd9Sstevel@tonic-gate 15647c478bd9Sstevel@tonic-gateecho "\n==== list of environment variables ====\n" >> $LOGFILE 15657c478bd9Sstevel@tonic-gateenv >> $LOGFILE 15667c478bd9Sstevel@tonic-gate 15677c478bd9Sstevel@tonic-gateecho "\n==== Nightly argument issues ====\n" | tee -a $mail_msg_file >> $LOGFILE 15687c478bd9Sstevel@tonic-gate 1569d77e7149Ssommerfeif [ "$P_FLAG" = "y" ]; then 1570d77e7149Ssommerfe obsolete_build GPROF | tee -a $mail_msg_file >> $LOGFILE 1571d77e7149Ssommerfefi 1572d77e7149Ssommerfe 1573d77e7149Ssommerfeif [ "$T_FLAG" = "y" ]; then 1574d77e7149Ssommerfe obsolete_build TRACE | tee -a $mail_msg_file >> $LOGFILE 1575d77e7149Ssommerfefi 1576d77e7149Ssommerfe 15771fe69678Skupferif is_source_build; then 15787c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "y" -o "$i_CMD_LINE_FLAG" = "y" ]; then 15797c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support incremental" \ 15807c478bd9Sstevel@tonic-gate "builds; forcing clobber\n" | tee -a $mail_msg_file >> $LOGFILE 15817c478bd9Sstevel@tonic-gate i_FLAG=n 15827c478bd9Sstevel@tonic-gate i_CMD_LINE_FLAG=n 15837c478bd9Sstevel@tonic-gate fi 15847c478bd9Sstevel@tonic-gate if [ "$N_FLAG" = "n" ]; then 15857c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support protocmp;" \ 15867c478bd9Sstevel@tonic-gate "protocmp disabled\n" | \ 15877c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 15887c478bd9Sstevel@tonic-gate N_FLAG=y 15897c478bd9Sstevel@tonic-gate fi 15907c478bd9Sstevel@tonic-gate if [ "$l_FLAG" = "y" ]; then 15917c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support lint;" \ 15927c478bd9Sstevel@tonic-gate "lint disabled\n" | tee -a $mail_msg_file >> $LOGFILE 15937c478bd9Sstevel@tonic-gate l_FLAG=n 15947c478bd9Sstevel@tonic-gate fi 15957c478bd9Sstevel@tonic-gate if [ "$C_FLAG" = "y" ]; then 15967c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support cstyle;" \ 15977c478bd9Sstevel@tonic-gate "cstyle check disabled\n" | tee -a $mail_msg_file >> $LOGFILE 15987c478bd9Sstevel@tonic-gate C_FLAG=n 15997c478bd9Sstevel@tonic-gate fi 16007c478bd9Sstevel@tonic-gateelse 16017c478bd9Sstevel@tonic-gate if [ "$N_FLAG" = "y" ]; then 16027c478bd9Sstevel@tonic-gate if [ "$p_FLAG" = "y" ]; then 16037c478bd9Sstevel@tonic-gate cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 16047c478bd9Sstevel@tonic-gateWARNING: the p option (create packages) is set, but so is the N option (do 16057c478bd9Sstevel@tonic-gate not run protocmp); this is dangerous; you should unset the N option 16067c478bd9Sstevel@tonic-gateEOF 16077c478bd9Sstevel@tonic-gate else 16087c478bd9Sstevel@tonic-gate cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 16097c478bd9Sstevel@tonic-gateWarning: the N option (do not run protocmp) is set; it probably shouldn't be 16107c478bd9Sstevel@tonic-gateEOF 16117c478bd9Sstevel@tonic-gate fi 16127c478bd9Sstevel@tonic-gate echo "" | tee -a $mail_msg_file >> $LOGFILE 16137c478bd9Sstevel@tonic-gate fi 16147c478bd9Sstevel@tonic-gatefi 16157c478bd9Sstevel@tonic-gate 16167c478bd9Sstevel@tonic-gateif [ "$a_FLAG" = "y" -a "$D_FLAG" = "n" -a "$F_FLAG" = "y" ]; then 16177c478bd9Sstevel@tonic-gate echo "WARNING: Neither DEBUG nor non-DEBUG build requested, but the" \ 16187c478bd9Sstevel@tonic-gate "'a' option was set." | tee -a $mail_msg_file >> $LOGFILE 16197c478bd9Sstevel@tonic-gatefi 16207c478bd9Sstevel@tonic-gate 16217c478bd9Sstevel@tonic-gateif [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 16227c478bd9Sstevel@tonic-gate echo "WARNING: DEBUG build not requested, but lint will be with" \ 16237c478bd9Sstevel@tonic-gate "DEBUG enabled.\n" \ 16247c478bd9Sstevel@tonic-gate | tee -a $mail_msg_file >> $LOGFILE 16257c478bd9Sstevel@tonic-gatefi 16267c478bd9Sstevel@tonic-gate 16277c478bd9Sstevel@tonic-gateif [ "$f_FLAG" = "y" ]; then 16287c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "y" ]; then 16297c478bd9Sstevel@tonic-gate echo "WARNING: the -f flag cannot be used during incremental" \ 16307c478bd9Sstevel@tonic-gate "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE 16317c478bd9Sstevel@tonic-gate f_FLAG=n 16327c478bd9Sstevel@tonic-gate fi 16337c478bd9Sstevel@tonic-gate if [ "$p_FLAG" != "y" -o "$l_FLAG" != "y" ]; then 16347c478bd9Sstevel@tonic-gate echo "WARNING: the -f flag requires -l and -p; ignoring -f\n" | \ 16357c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16367c478bd9Sstevel@tonic-gate f_FLAG=n 16377c478bd9Sstevel@tonic-gate fi 16387c478bd9Sstevel@tonic-gatefi 16397c478bd9Sstevel@tonic-gate 164096ccc8cbSesaxeif [ "$w_FLAG" = "y" -a ! -d $ROOT ]; then 164196ccc8cbSesaxe echo "WARNING: -w specified, but no pre-existing proto area found;" \ 164296ccc8cbSesaxe "ignoring -w\n" | tee -a $mail_msg_file >> $LOGFILE 164396ccc8cbSesaxe w_FLAG=n 164496ccc8cbSesaxefi 164596ccc8cbSesaxe 16467c478bd9Sstevel@tonic-gateif [ "$t_FLAG" = "n" ]; then 16477c478bd9Sstevel@tonic-gate # 16487c478bd9Sstevel@tonic-gate # We're not doing a tools build, so make sure elfsign(1) is 16497c478bd9Sstevel@tonic-gate # new enough to safely sign non-crypto binaries. We test 16507c478bd9Sstevel@tonic-gate # debugging output from elfsign to detect the old version. 16517c478bd9Sstevel@tonic-gate # 16527c478bd9Sstevel@tonic-gate newelfsigntest=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \ 16537c478bd9Sstevel@tonic-gate -e /usr/lib/security/pkcs11_softtoken.so.1 2>&1 \ 16547c478bd9Sstevel@tonic-gate | egrep algorithmOID` 16557c478bd9Sstevel@tonic-gate if [ -z "$newelfsigntest" ]; then 16567c478bd9Sstevel@tonic-gate echo "WARNING: /usr/bin/elfsign out of date;" \ 16577c478bd9Sstevel@tonic-gate "will only sign crypto modules\n" | \ 16587c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16597c478bd9Sstevel@tonic-gate export ELFSIGN_OBJECT=true 16607c478bd9Sstevel@tonic-gate elif [ "$VERIFY_ELFSIGN" = "y" ]; then 16617c478bd9Sstevel@tonic-gate echo "WARNING: VERIFY_ELFSIGN=y requires" \ 16627c478bd9Sstevel@tonic-gate "the -t flag; ignoring VERIFY_ELFSIGN\n" | \ 16637c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16647c478bd9Sstevel@tonic-gate fi 16657c478bd9Sstevel@tonic-gatefi 16667c478bd9Sstevel@tonic-gate 16677c478bd9Sstevel@tonic-gateecho "==== Build environment ====\n" | tee -a $mail_msg_file >> $LOGFILE 16687c478bd9Sstevel@tonic-gate 16697c478bd9Sstevel@tonic-gate# System 16707c478bd9Sstevel@tonic-gatewhence uname | tee -a $mail_msg_file >> $LOGFILE 16717c478bd9Sstevel@tonic-gateuname -a 2>&1 | tee -a $mail_msg_file >> $LOGFILE 16727c478bd9Sstevel@tonic-gateecho | tee -a $mail_msg_file >> $LOGFILE 16737c478bd9Sstevel@tonic-gate 16747c478bd9Sstevel@tonic-gate# nightly (will fail in year 2100 due to SCCS flaw) 16757c478bd9Sstevel@tonic-gateecho "$0 $@" | tee -a $mail_msg_file >> $LOGFILE 1676*23259b79Srotondoecho "nightly.sh version 1.110 2007/03/09\n" | tee -a $mail_msg_file >> $LOGFILE 16777c478bd9Sstevel@tonic-gate 16787c478bd9Sstevel@tonic-gate# make 16797c478bd9Sstevel@tonic-gatewhence $MAKE | tee -a $mail_msg_file >> $LOGFILE 16807c478bd9Sstevel@tonic-gate$MAKE -v | tee -a $mail_msg_file >> $LOGFILE 16817c478bd9Sstevel@tonic-gateecho "number of concurrent jobs = $DMAKE_MAX_JOBS" | 16827c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16837c478bd9Sstevel@tonic-gate 16847c478bd9Sstevel@tonic-gate# 16857c478bd9Sstevel@tonic-gate# Report the compiler versions. 16867c478bd9Sstevel@tonic-gate# 16877c478bd9Sstevel@tonic-gateif [ -f $SRC/Makefile ]; then 16887c478bd9Sstevel@tonic-gate srcroot=$SRC 16897c478bd9Sstevel@tonic-gateelif [ -f $BRINGOVER_WS/usr/src/Makefile ]; then 16907c478bd9Sstevel@tonic-gate srcroot=$BRINGOVER_WS/usr/src 16917c478bd9Sstevel@tonic-gateelse 16927c478bd9Sstevel@tonic-gate echo "\nUnable to find \"Makefile\" in $BRINGOVER_WS/usr/src or $SRC." | 16937c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16947c478bd9Sstevel@tonic-gate exit 1 16957c478bd9Sstevel@tonic-gatefi 16967c478bd9Sstevel@tonic-gate 16977c478bd9Sstevel@tonic-gate( cd $srcroot 16987c478bd9Sstevel@tonic-gate for target in cc-version cc64-version java-version; do 16997c478bd9Sstevel@tonic-gate echo 17007c478bd9Sstevel@tonic-gate # 17017c478bd9Sstevel@tonic-gate # Put statefile somewhere we know we can write to rather than trip 1702b84bdc30Smeem # over a read-only $srcroot. 17037c478bd9Sstevel@tonic-gate # 17047c478bd9Sstevel@tonic-gate rm -f $TMPDIR/make-state 170532f1e47bSsommerfe export SRC=$srcroot 1706b84bdc30Smeem if $MAKE -K $TMPDIR/make-state -e $target 2>/dev/null; then 17077c478bd9Sstevel@tonic-gate continue 17087c478bd9Sstevel@tonic-gate fi 17097c478bd9Sstevel@tonic-gate touch $TMPDIR/nocompiler 17107c478bd9Sstevel@tonic-gate done 17117c478bd9Sstevel@tonic-gate echo 17127c478bd9Sstevel@tonic-gate) | tee -a $mail_msg_file >> $LOGFILE 17137c478bd9Sstevel@tonic-gate 17147c478bd9Sstevel@tonic-gateif [ -f $TMPDIR/nocompiler ]; then 17157c478bd9Sstevel@tonic-gate rm -f $TMPDIR/nocompiler 17167c478bd9Sstevel@tonic-gate build_ok=n 17177c478bd9Sstevel@tonic-gate echo "Aborting due to missing compiler." | 17187c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17197c478bd9Sstevel@tonic-gate exit 1 17207c478bd9Sstevel@tonic-gatefi 17217c478bd9Sstevel@tonic-gate 17227c478bd9Sstevel@tonic-gate# as 17237c478bd9Sstevel@tonic-gatewhence as | tee -a $mail_msg_file >> $LOGFILE 17247c478bd9Sstevel@tonic-gateas -V 2>&1 | head -1 | tee -a $mail_msg_file >> $LOGFILE 17257c478bd9Sstevel@tonic-gateecho | tee -a $mail_msg_file >> $LOGFILE 17267c478bd9Sstevel@tonic-gate 17277c478bd9Sstevel@tonic-gate# Check that we're running a capable link-editor 17287c478bd9Sstevel@tonic-gatewhence ld | tee -a $mail_msg_file >> $LOGFILE 17297c478bd9Sstevel@tonic-gateLDVER=`ld -V 2>&1` 17307c478bd9Sstevel@tonic-gateecho $LDVER | tee -a $mail_msg_file >> $LOGFILE 17317c478bd9Sstevel@tonic-gateLDVER=`echo $LDVER | sed -e "s/.*-1\.//" -e "s/:.*//"` 17327c478bd9Sstevel@tonic-gateif [ `expr $LDVER \< 422` -eq 1 ]; then 17337c478bd9Sstevel@tonic-gate echo "The link-editor needs to be at version 422 or higher to build" | \ 17347c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17357c478bd9Sstevel@tonic-gate echo "the latest stuff, hope your build works." | \ 17367c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17377c478bd9Sstevel@tonic-gatefi 17387c478bd9Sstevel@tonic-gate 17397c478bd9Sstevel@tonic-gateecho "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \ 17407c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17417c478bd9Sstevel@tonic-gate 17427c478bd9Sstevel@tonic-gateecho "\n==== Build version ====\n" | tee -a $mail_msg_file >> $LOGFILE 17437c478bd9Sstevel@tonic-gateecho $VERSION | tee -a $mail_msg_file >> $LOGFILE 17447c478bd9Sstevel@tonic-gate 174596ccc8cbSesaxe# Save the current proto area if we're comparing against the last build 174696ccc8cbSesaxeif [ "$w_FLAG" = "y" -a -d "$ROOT" ]; then 174796ccc8cbSesaxe if [ -d "$ROOT.prev" ]; then 174896ccc8cbSesaxe rm -rf $ROOT.prev 174996ccc8cbSesaxe fi 175096ccc8cbSesaxe mv $ROOT $ROOT.prev 175196ccc8cbSesaxefi 175296ccc8cbSesaxe 17537c478bd9Sstevel@tonic-gate# 17547c478bd9Sstevel@tonic-gate# Decide whether to clobber 17557c478bd9Sstevel@tonic-gate# 17567c478bd9Sstevel@tonic-gateif [ "$i_FLAG" = "n" -a -d "$SRC" ]; then 17577c478bd9Sstevel@tonic-gate echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE 17587c478bd9Sstevel@tonic-gate 17597c478bd9Sstevel@tonic-gate cd $SRC 17607c478bd9Sstevel@tonic-gate # remove old clobber file 17617c478bd9Sstevel@tonic-gate rm -f $SRC/clobber.out 17627c478bd9Sstevel@tonic-gate rm -f $SRC/clobber-${MACH}.out 17637c478bd9Sstevel@tonic-gate 17647c478bd9Sstevel@tonic-gate # Remove all .make.state* files, just in case we are restarting 17657c478bd9Sstevel@tonic-gate # the build after having interrupted a previous 'make clobber'. 17667c478bd9Sstevel@tonic-gate find . \( -name SCCS -o -name 'interfaces.*' \) -prune \ 17677c478bd9Sstevel@tonic-gate -o -name '.make.*' -print | xargs rm -f 17687c478bd9Sstevel@tonic-gate 17697c478bd9Sstevel@tonic-gate $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE 17707c478bd9Sstevel@tonic-gate echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file 17717c478bd9Sstevel@tonic-gate grep "$MAKE:" $SRC/clobber-${MACH}.out | 17727c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 17737c478bd9Sstevel@tonic-gate >> $mail_msg_file 17747c478bd9Sstevel@tonic-gate 17757c478bd9Sstevel@tonic-gate if [ "$t_FLAG" = "y" ]; then 17767c478bd9Sstevel@tonic-gate echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE 17777c478bd9Sstevel@tonic-gate cd ${TOOLS} 17787c478bd9Sstevel@tonic-gate rm -f ${TOOLS}/clobber-${MACH}.out 17797c478bd9Sstevel@tonic-gate $MAKE -ek clobber 2>&1 | \ 17807c478bd9Sstevel@tonic-gate tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE 17817c478bd9Sstevel@tonic-gate echo "\n==== Make tools clobber ERRORS ====\n" \ 17827c478bd9Sstevel@tonic-gate >> $mail_msg_file 17837c478bd9Sstevel@tonic-gate grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \ 17847c478bd9Sstevel@tonic-gate >> $mail_msg_file 17857c478bd9Sstevel@tonic-gate rm -rf ${TOOLS_PROTO} 17867c478bd9Sstevel@tonic-gate mkdir -p ${TOOLS_PROTO} 17877c478bd9Sstevel@tonic-gate fi 178896ccc8cbSesaxe 1789534f4022Sdduvall rm -rf $ROOT 17907c478bd9Sstevel@tonic-gate 17917c478bd9Sstevel@tonic-gate # Get back to a clean workspace as much as possible to catch 17927c478bd9Sstevel@tonic-gate # problems that only occur on fresh workspaces. 17937c478bd9Sstevel@tonic-gate # Remove all .make.state* files, libraries, and .o's that may 1794fb23a357Skupfer # have been omitted from clobber. A couple of libraries are 1795fb23a357Skupfer # under SCCS, so leave them alone. 17967c478bd9Sstevel@tonic-gate # We should probably blow away temporary directories too. 17977c478bd9Sstevel@tonic-gate cd $SRC 1798fb23a357Skupfer find $relsrcdirs \( -name SCCS -o -name 'interfaces.*' \) -prune -o \ 17997c478bd9Sstevel@tonic-gate \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \ 1800fb23a357Skupfer -name '*.o' \) -print | \ 1801fb23a357Skupfer grep -v 'tools/ctf/dwarf/.*/libdwarf' | xargs rm -f 18027c478bd9Sstevel@tonic-gateelse 18037c478bd9Sstevel@tonic-gate echo "\n==== No clobber at `date` ====\n" >> $LOGFILE 18047c478bd9Sstevel@tonic-gatefi 18057c478bd9Sstevel@tonic-gate 18067c478bd9Sstevel@tonic-gate# 18077c478bd9Sstevel@tonic-gate# Decide whether to bringover to the codemgr workspace 18087c478bd9Sstevel@tonic-gate# 18097c478bd9Sstevel@tonic-gateif [ "$n_FLAG" = "n" ]; then 18107c478bd9Sstevel@tonic-gate echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE 18117c478bd9Sstevel@tonic-gate # sleep on the parent workspace's lock 18127c478bd9Sstevel@tonic-gate while egrep -s write $BRINGOVER_WS/Codemgr_wsdata/locks 18137c478bd9Sstevel@tonic-gate do 18147c478bd9Sstevel@tonic-gate sleep 120 18157c478bd9Sstevel@tonic-gate done 18167c478bd9Sstevel@tonic-gate 18177c478bd9Sstevel@tonic-gate echo "\n==== BRINGOVER LOG ====\n" >> $mail_msg_file 181832f1e47bSsommerfe 181932f1e47bSsommerfe (staffer $TEAMWARE/bin/bringover -c "nightly update" -p $BRINGOVER_WS \ 182032f1e47bSsommerfe -w $CODEMGR_WS $BRINGOVER_FILES < /dev/null 2>&1 || 182132f1e47bSsommerfe touch $TMPDIR/bringover_failed 182232f1e47bSsommerfe 1823d77e7149Ssommerfe staffer bringovercheck $CODEMGR_WS >$TMPDIR/bringovercheck.out 2>&1 1824d77e7149Ssommerfe 1825d77e7149Ssommerfe if [ -s $TMPDIR/bringovercheck.out ]; then 1826d77e7149Ssommerfe echo "\n==== POST-BRINGOVER CLEANUP NOISE ====\n" 1827d77e7149Ssommerfe cat $TMPDIR/bringovercheck.out 1828d77e7149Ssommerfe fi 182932f1e47bSsommerfe 183032f1e47bSsommerfe ) | tee -a $mail_msg_file >> $LOGFILE 183132f1e47bSsommerfe 183232f1e47bSsommerfe if [ -f $TMPDIR/bringover_failed ]; then 183332f1e47bSsommerfe rm -f $TMPDIR/bringover_failed 183432f1e47bSsommerfe build_ok=n 183532f1e47bSsommerfe echo "trouble with bringover, quitting at `date`." | 18367c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 18377c478bd9Sstevel@tonic-gate exit 1 18387c478bd9Sstevel@tonic-gate fi 1839085d331dSkupfer 1840085d331dSkupfer # 1841085d331dSkupfer # Possible transition from pre-split workspace to split 1842085d331dSkupfer # workspace. See if the bringover changed anything. 1843085d331dSkupfer # 1844085d331dSkupfer CLOSED_IS_PRESENT="$orig_closed_is_present" 1845085d331dSkupfer check_closed_tree 18467c478bd9Sstevel@tonic-gateelse 18477c478bd9Sstevel@tonic-gate echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE 18487c478bd9Sstevel@tonic-gatefi 18497c478bd9Sstevel@tonic-gate 18507c478bd9Sstevel@tonic-gate# 18517c478bd9Sstevel@tonic-gate# Build tools if requested 18527c478bd9Sstevel@tonic-gate# 18537c478bd9Sstevel@tonic-gateif [ "$t_FLAG" = "y" ]; then 18547c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 18557c478bd9Sstevel@tonic-gate export RELEASE_BUILD ; RELEASE_BUILD= 18567c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 18577c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 18587c478bd9Sstevel@tonic-gate 18597c478bd9Sstevel@tonic-gate export ONBLD_TOOLS=${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld} 18607c478bd9Sstevel@tonic-gate build_tools ${TOOLS_PROTO} 18617c478bd9Sstevel@tonic-gatefi 18627c478bd9Sstevel@tonic-gate 18636fec3625Sdduvall# 18646fec3625Sdduvall# copy ihv proto area in addition to the build itself 18656fec3625Sdduvall# 18666fec3625Sdduvallif [ "$X_FLAG" = "y" ]; then 18676fec3625Sdduvall copy_ihv_proto 18686fec3625Sdduvallfi 18696fec3625Sdduvall 18707c478bd9Sstevel@tonic-gateif [ "$i_FLAG" = "y" -a "$SH_FLAG" = "y" ]; then 18717c478bd9Sstevel@tonic-gate echo "\n==== NOT Building base OS-Net source ====\n" | \ 18727c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 18737c478bd9Sstevel@tonic-gateelse 18747c478bd9Sstevel@tonic-gate normal_build 18757c478bd9Sstevel@tonic-gatefi 18767c478bd9Sstevel@tonic-gate 18777c478bd9Sstevel@tonic-gateORIG_SRC=$SRC 18787c478bd9Sstevel@tonic-gateBINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z 18797c478bd9Sstevel@tonic-gate 18801fe69678Skupfer# 18811fe69678Skupfer# For the "open" build, we don't mung any source files, so skip this 18821fe69678Skupfer# step. 18831fe69678Skupfer# 18847c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 18857c478bd9Sstevel@tonic-gate save_binaries 18867c478bd9Sstevel@tonic-gate 18877c478bd9Sstevel@tonic-gate echo "\n==== Retrieving SCCS files at `date` ====\n" >> $LOGFILE 18887c478bd9Sstevel@tonic-gate SCCSHELPER=${TMPDIR}/sccs-helper 18897c478bd9Sstevel@tonic-gate rm -f ${SCCSHELPER} 18907c478bd9Sstevel@tonic-gatecat >${SCCSHELPER} <<EOF 18917c478bd9Sstevel@tonic-gate#!/bin/ksh 18927c478bd9Sstevel@tonic-gatecd \$1 18937c478bd9Sstevel@tonic-gatecd .. 18947c478bd9Sstevel@tonic-gatesccs get SCCS >/dev/null 2>&1 18957c478bd9Sstevel@tonic-gateEOF 18967c478bd9Sstevel@tonic-gate cd $SRC 18977c478bd9Sstevel@tonic-gate chmod +x ${SCCSHELPER} 1898fb23a357Skupfer find $relsrcdirs -name SCCS | xargs -L 1 ${SCCSHELPER} 18997c478bd9Sstevel@tonic-gate rm -f ${SCCSHELPER} 19007c478bd9Sstevel@tonic-gatefi 19017c478bd9Sstevel@tonic-gate 19027c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 19031fe69678Skupfer set_up_source_build ${CODEMGR_WS} ${CRYPT_SRC} CRYPT_SRC 19047c478bd9Sstevel@tonic-gatefi 19057c478bd9Sstevel@tonic-gate 19067c478bd9Sstevel@tonic-gate# EXPORT_SRC comes after CRYPT_SRC since a domestic build will need 19077c478bd9Sstevel@tonic-gate# $SRC pointing to the export_source usr/src. 19087c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 19091fe69678Skupfer set_up_source_build ${CODEMGR_WS} ${EXPORT_SRC} EXPORT_SRC 19107c478bd9Sstevel@tonic-gatefi 19117c478bd9Sstevel@tonic-gate 19127c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 19137c478bd9Sstevel@tonic-gate # drop the crypt files in place. 19147c478bd9Sstevel@tonic-gate cd ${EXPORT_SRC} 19157c478bd9Sstevel@tonic-gate echo "\nextracting crypt_files.cpio.Z onto export_source.\n" \ 19167c478bd9Sstevel@tonic-gate >> ${LOGFILE} 19177c478bd9Sstevel@tonic-gate zcat ${CODEMGR_WS}/crypt_files.cpio.Z | \ 19187c478bd9Sstevel@tonic-gate cpio -idmucvB 2>/dev/null >> ${LOGFILE} 19197c478bd9Sstevel@tonic-gate if [ "$?" = "0" ]; then 19207c478bd9Sstevel@tonic-gate echo "\n==== DOMESTIC extraction succeeded ====\n" \ 19217c478bd9Sstevel@tonic-gate >> $mail_msg_file 19227c478bd9Sstevel@tonic-gate else 19237c478bd9Sstevel@tonic-gate echo "\n==== DOMESTIC extraction failed ====\n" \ 19247c478bd9Sstevel@tonic-gate >> $mail_msg_file 19257c478bd9Sstevel@tonic-gate fi 19267c478bd9Sstevel@tonic-gate 19277c478bd9Sstevel@tonic-gatefi 19287c478bd9Sstevel@tonic-gate 19291fe69678Skupferif [ "$SO_FLAG" = "y" ]; then 19301fe69678Skupfer # 19311fe69678Skupfer # Copy the open sources into their own tree, set up the closed 19321fe69678Skupfer # binaries, and set up the environment. 19331fe69678Skupfer # 19341fe69678Skupfer copy_source $CODEMGR_WS $OPEN_SRCDIR OPEN_SOURCE usr/src 19351fe69678Skupfer SRC=$OPEN_SRCDIR/usr/src 19361fe69678Skupfer 19371fe69678Skupfer # Try not to clobber any user-provided closed binaries. 19381fe69678Skupfer export ON_CLOSED_BINS=$CODEMGR_WS/closed$$ 19391fe69678Skupfer echo "\n==== Copying skeleton closed binaries to $ON_CLOSED_BINS ====\n" | \ 19401fe69678Skupfer tee -a $mail_msg_file >> $LOGFILE 19411fe69678Skupfer mkclosed $MACH $CODEMGR_WS/proto $ON_CLOSED_BINS >>$LOGFILE 2>&1 19421fe69678Skupfer if [ $? -ne 0 ]; then 19431fe69678Skupfer build_ok=n 19441fe69678Skupfer echo "Aborting (couldn't create closed binaries)." | 19451fe69678Skupfer tee -a $mail_msg_file >> $LOGFILE 19461fe69678Skupfer fi 19471fe69678Skupfer CLOSED_IS_PRESENT=no 19481fe69678Skupferfi 19491fe69678Skupfer 19501fe69678Skupferif is_source_build && [ $build_ok = y ] ; then 19517c478bd9Sstevel@tonic-gate # remove proto area here, since we don't clobber 1952534f4022Sdduvall rm -rf "$ROOT" 19537c478bd9Sstevel@tonic-gate if [ "$t_FLAG" = "y" ]; then 19547c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 19557c478bd9Sstevel@tonic-gate export RELEASE_BUILD ; RELEASE_BUILD= 19567c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 19577c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 1958b91d9e0fSdanmcd ORIG_TOOLS=$TOOLS 19591fe69678Skupfer # 19601fe69678Skupfer # SRC was set earlier to point to the source build 19611fe69678Skupfer # source tree (e.g., $EXPORT_SRC). 19621fe69678Skupfer # 19631fe69678Skupfer TOOLS=${SRC}/tools 19641fe69678Skupfer build_tools ${SRC}/tools/proto 1965b91d9e0fSdanmcd TOOLS=$ORIG_TOOLS 19667c478bd9Sstevel@tonic-gate fi 19677c478bd9Sstevel@tonic-gate 19687c478bd9Sstevel@tonic-gate export EXPORT_RELEASE_BUILD ; EXPORT_RELEASE_BUILD=# 19697c478bd9Sstevel@tonic-gate normal_build 19707c478bd9Sstevel@tonic-gatefi 19717c478bd9Sstevel@tonic-gate 19721fe69678Skupferif [[ "$SO_FLAG" = "y" && "$build_ok" = "y" ]]; then 19731fe69678Skupfer rm -rf $ON_CLOSED_BINS 19741fe69678Skupferfi 19751fe69678Skupfer 19767c478bd9Sstevel@tonic-gateif [ "$build_ok" = "y" ]; then 19777c478bd9Sstevel@tonic-gate echo "\n==== Creating protolist system file at `date` ====" \ 19787c478bd9Sstevel@tonic-gate >> $LOGFILE 19797c478bd9Sstevel@tonic-gate protolist $ROOT > $ATLOG/proto_list_${MACH} 19807c478bd9Sstevel@tonic-gate echo "==== protolist system file created at `date` ====\n" \ 19817c478bd9Sstevel@tonic-gate >> $LOGFILE 19827c478bd9Sstevel@tonic-gate 19837c478bd9Sstevel@tonic-gate if [ "$N_FLAG" != "y" ]; then 19847c478bd9Sstevel@tonic-gate echo "\n==== Impact on packages ====\n" >> $mail_msg_file 19857c478bd9Sstevel@tonic-gate 19867c478bd9Sstevel@tonic-gate # If there is a reference proto list, compare the build's proto 19877c478bd9Sstevel@tonic-gate # list with the reference to see changes in proto areas. 19887c478bd9Sstevel@tonic-gate # Use the current exception list. 19897c478bd9Sstevel@tonic-gate exc=etc/exception_list_$MACH 19907c478bd9Sstevel@tonic-gate if [ -f $SRC/pkgdefs/$exc ]; then 19917c478bd9Sstevel@tonic-gate ELIST="-e $SRC/pkgdefs/$exc" 19927c478bd9Sstevel@tonic-gate fi 19936fec3625Sdduvall if [ "$X_FLAG" = "y" -a -f $IA32_IHV_WS/usr/src/pkgdefs/$exc ]; then 19946fec3625Sdduvall ELIST="$ELIST -e $IA32_IHV_WS/usr/src/pkgdefs/$exc" 19956fec3625Sdduvall fi 19967c478bd9Sstevel@tonic-gate 19977c478bd9Sstevel@tonic-gate if [ -f "$REF_PROTO_LIST" ]; then 1998b4add148Sdduvall # For builds that copy the IHV proto area (-X), add the 1999b4add148Sdduvall # IHV proto list to the reference list if the reference 2000b4add148Sdduvall # was built without -X. 2001b4add148Sdduvall # 2002b4add148Sdduvall # For builds that don't copy the IHV proto area, add the 2003b4add148Sdduvall # IHV proto list to the build's proto list if the 2004b4add148Sdduvall # reference was built with -X. 2005b4add148Sdduvall # 2006b4add148Sdduvall # Use the presence of the first file entry of the cached 2007b4add148Sdduvall # IHV proto list in the reference list to determine 2008b4add148Sdduvall # whether it was build with -X or not. 2009b4add148Sdduvall IHV_REF_PROTO_LIST=$SRC/pkgdefs/etc/proto_list_ihv_$MACH 2010b4add148Sdduvall grepfor=$(nawk '$1 == "f" { print $2; exit }' \ 2011b4add148Sdduvall $IHV_REF_PROTO_LIST 2> /dev/null) 2012b4add148Sdduvall if [ $? = 0 -a -n "$grepfor" ]; then 2013b4add148Sdduvall if [ "$X_FLAG" = "y" ]; then 2014b4add148Sdduvall grep -w "$grepfor" \ 2015b4add148Sdduvall $REF_PROTO_LIST > /dev/null 2016b4add148Sdduvall if [ ! "$?" = "0" ]; then 2017b4add148Sdduvall REF_IHV_PROTO="-d $IHV_REF_PROTO_LIST" 2018b4add148Sdduvall fi 2019b4add148Sdduvall else 2020b4add148Sdduvall grep -w "$grepfor" \ 2021b4add148Sdduvall $REF_PROTO_LIST > /dev/null 2022b4add148Sdduvall if [ "$?" = "0" ]; then 2023b4add148Sdduvall IHV_PROTO_LIST="$IHV_REF_PROTO_LIST" 2024b4add148Sdduvall fi 2025b4add148Sdduvall fi 2026b4add148Sdduvall fi 2027b4add148Sdduvall 20287c478bd9Sstevel@tonic-gate $PROTOCMPTERSE \ 20297c478bd9Sstevel@tonic-gate "Files in yesterday's proto area, but not today's:" \ 20307c478bd9Sstevel@tonic-gate "Files in today's proto area, but not yesterday's:" \ 20317c478bd9Sstevel@tonic-gate "Files that changed between yesterday and today:" \ 20327c478bd9Sstevel@tonic-gate ${ELIST} \ 20337c478bd9Sstevel@tonic-gate -d $REF_PROTO_LIST \ 2034b4add148Sdduvall $REF_IHV_PROTO \ 20357c478bd9Sstevel@tonic-gate $ATLOG/proto_list_${MACH} \ 2036b4add148Sdduvall $IHV_PROTO_LIST \ 20377c478bd9Sstevel@tonic-gate >> $mail_msg_file 20387c478bd9Sstevel@tonic-gate fi 20397c478bd9Sstevel@tonic-gate # Compare the build's proto list with current package 20407c478bd9Sstevel@tonic-gate # definitions to audit the quality of package definitions 20417c478bd9Sstevel@tonic-gate # and makefile install targets. Use the current exception list. 2042fb23a357Skupfer PKGDEFS_LIST="" 2043fb23a357Skupfer for d in $abssrcdirs; do 2044fb23a357Skupfer if [ -d $d/pkgdefs ]; then 2045fb23a357Skupfer PKGDEFS_LIST="$PKGDEFS_LIST -d $d/pkgdefs" 2046fb23a357Skupfer fi 2047fb23a357Skupfer done 20486fec3625Sdduvall if [ "$X_FLAG" = "y" -a -d $IA32_IHV_WS/usr/src/pkgdefs ]; then 20496fec3625Sdduvall PKGDEFS_LIST="$PKGDEFS_LIST -d $IA32_IHV_WS/usr/src/pkgdefs" 20506fec3625Sdduvall fi 20517c478bd9Sstevel@tonic-gate 20527c478bd9Sstevel@tonic-gate $PROTOCMPTERSE \ 20537c478bd9Sstevel@tonic-gate "Files missing from the proto area:" \ 20547c478bd9Sstevel@tonic-gate "Files missing from packages:" \ 20557c478bd9Sstevel@tonic-gate "Inconsistencies between pkgdefs and proto area:" \ 20567c478bd9Sstevel@tonic-gate ${ELIST} \ 20577c478bd9Sstevel@tonic-gate ${PKGDEFS_LIST} \ 20587c478bd9Sstevel@tonic-gate $ATLOG/proto_list_${MACH} \ 20597c478bd9Sstevel@tonic-gate >> $mail_msg_file 20607c478bd9Sstevel@tonic-gate fi 20617c478bd9Sstevel@tonic-gatefi 20627c478bd9Sstevel@tonic-gate 20637c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 20647c478bd9Sstevel@tonic-gate staffer cp $ATLOG/proto_list_${MACH} \ 20657c478bd9Sstevel@tonic-gate $PARENT_WS/usr/src/proto_list_${MACH} 20667c478bd9Sstevel@tonic-gatefi 20677c478bd9Sstevel@tonic-gate 20687c478bd9Sstevel@tonic-gate# Update parent proto area if necessary. This is done now 20697c478bd9Sstevel@tonic-gate# so that the proto area has either DEBUG or non-DEBUG kernels. 20707c478bd9Sstevel@tonic-gate# Note that this clears out the lock file, so we can dispense with 20717c478bd9Sstevel@tonic-gate# the variable now. 20727c478bd9Sstevel@tonic-gateif [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then 20737c478bd9Sstevel@tonic-gate echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \ 20747c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 20757c478bd9Sstevel@tonic-gate # The rm -rf command below produces predictable errors if 20767c478bd9Sstevel@tonic-gate # nightly is invoked from the parent's $ROOT/opt/onbld/bin, 20777c478bd9Sstevel@tonic-gate # and that directory is accessed via NFS. This is because 20787c478bd9Sstevel@tonic-gate # deleted-but-still-open files don't actually disappear as 20797c478bd9Sstevel@tonic-gate # expected, but rather turn into .nfsXXXX junk files, leaving 20807c478bd9Sstevel@tonic-gate # the directory non-empty. Since this is a not-unusual usage 20817c478bd9Sstevel@tonic-gate # pattern, and we still want to catch other errors here, we 20827c478bd9Sstevel@tonic-gate # take the unusal step of moving aside 'nightly' from that 20837c478bd9Sstevel@tonic-gate # directory (if we're using it). 20847c478bd9Sstevel@tonic-gate mypath=${0##*/root_$MACH/} 20857c478bd9Sstevel@tonic-gate if [ "$mypath" = $0 ]; then 20867c478bd9Sstevel@tonic-gate mypath=opt/onbld/bin/${0##*/} 20877c478bd9Sstevel@tonic-gate fi 20887c478bd9Sstevel@tonic-gate if [ $0 -ef $PARENT_WS/proto/root_$MACH/$mypath ]; then 20897c478bd9Sstevel@tonic-gate mv -f $0 $PARENT_WS/proto/root_$MACH 20907c478bd9Sstevel@tonic-gate fi 20917c478bd9Sstevel@tonic-gate rm -rf $PARENT_WS/proto/root_$MACH/* 20927c478bd9Sstevel@tonic-gate unset Ulockfile 20937c478bd9Sstevel@tonic-gate mkdir -p $NIGHTLY_PARENT_ROOT 20947c478bd9Sstevel@tonic-gate cd $ROOT 20957c478bd9Sstevel@tonic-gate ( tar cf - . | ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf - ) ) 2>&1 | 20967c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 20977c478bd9Sstevel@tonic-gatefi 20987c478bd9Sstevel@tonic-gate 20997c478bd9Sstevel@tonic-gate# 21007c478bd9Sstevel@tonic-gate# do shared library interface verification 21017c478bd9Sstevel@tonic-gate# 21027c478bd9Sstevel@tonic-gate 21037c478bd9Sstevel@tonic-gateif [ "$A_FLAG" = "y" -a "$build_ok" = "y" ]; then 21047c478bd9Sstevel@tonic-gate echo "\n==== Check versioning and ABI information ====\n" | \ 21057c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21067c478bd9Sstevel@tonic-gate 21077c478bd9Sstevel@tonic-gate rm -rf $SRC/interfaces.ref 21087c478bd9Sstevel@tonic-gate if [ -d $SRC/interfaces.out ]; then 21097c478bd9Sstevel@tonic-gate mv $SRC/interfaces.out $SRC/interfaces.ref 21107c478bd9Sstevel@tonic-gate fi 21117c478bd9Sstevel@tonic-gate rm -rf $SRC/interfaces.out 21127c478bd9Sstevel@tonic-gate mkdir -p $SRC/interfaces.out 21137c478bd9Sstevel@tonic-gate 21147c478bd9Sstevel@tonic-gate intf_check -V -m -o -b $SRC/tools/abi/etc \ 21157c478bd9Sstevel@tonic-gate -d $SRC/interfaces.out $ROOT 2>&1 | sort \ 21167c478bd9Sstevel@tonic-gate > $SRC/interfaces.out/log 21177c478bd9Sstevel@tonic-gate 21187c478bd9Sstevel@tonic-gate # report any ERROR found in log file 21197c478bd9Sstevel@tonic-gate fgrep 'ERROR' $SRC/interfaces.out/log | sed 's/^ERROR: //' | \ 21207c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21217c478bd9Sstevel@tonic-gate 21227c478bd9Sstevel@tonic-gate if [ ! -d $SRC/interfaces.ref ] ; then 21237c478bd9Sstevel@tonic-gate mkdir -p $SRC/interfaces.ref 21247c478bd9Sstevel@tonic-gate if [ -d $SRC/interfaces.out ]; then 21257c478bd9Sstevel@tonic-gate cp -r $SRC/interfaces.out/* $SRC/interfaces.ref 21267c478bd9Sstevel@tonic-gate fi 21277c478bd9Sstevel@tonic-gate fi 21287c478bd9Sstevel@tonic-gate 21297c478bd9Sstevel@tonic-gate echo "\n==== Diff versioning warnings (since last build) ====\n" | \ 21307c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21317c478bd9Sstevel@tonic-gate 21327c478bd9Sstevel@tonic-gate out_vers=`grep ^VERSION $SRC/interfaces.out/log`; 21337c478bd9Sstevel@tonic-gate ref_vers=`grep ^VERSION $SRC/interfaces.ref/log`; 21347c478bd9Sstevel@tonic-gate 21357c478bd9Sstevel@tonic-gate # Report any differences in WARNING messages between last 21367c478bd9Sstevel@tonic-gate # and current build. 21377c478bd9Sstevel@tonic-gate if [ "$out_vers" = "$ref_vers" ]; then 21387c478bd9Sstevel@tonic-gate diff $SRC/interfaces.ref/log $SRC/interfaces.out/log | \ 21397c478bd9Sstevel@tonic-gate fgrep 'WARNING' | sed 's/WARNING: //' | \ 21407c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21417c478bd9Sstevel@tonic-gate fi 21427c478bd9Sstevel@tonic-gatefi 21437c478bd9Sstevel@tonic-gate 21447c478bd9Sstevel@tonic-gateif [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then 21457c478bd9Sstevel@tonic-gate echo "\n==== Check ELF runtime attributes ====\n" | \ 21467c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21477c478bd9Sstevel@tonic-gate 21487c478bd9Sstevel@tonic-gate LDDUSAGE="^ldd: does not support -e" 21497c478bd9Sstevel@tonic-gate LDDWRONG="wrong class" 21507c478bd9Sstevel@tonic-gate CRLERROR="^crle:" 21517c478bd9Sstevel@tonic-gate CRLECONF="^crle: configuration file:" 21527c478bd9Sstevel@tonic-gate 21537c478bd9Sstevel@tonic-gate rm -f $SRC/runtime.ref 21547c478bd9Sstevel@tonic-gate if [ -f $SRC/runtime.out ]; then 21557c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 21567c478bd9Sstevel@tonic-gate $SRC/runtime.out > $SRC/runtime.ref 21577c478bd9Sstevel@tonic-gate fi 21587c478bd9Sstevel@tonic-gate 21597c478bd9Sstevel@tonic-gate # If we're doing a debug build the proto area will be left with 21607c478bd9Sstevel@tonic-gate # debuggable objects, thus don't assert -s. 21617c478bd9Sstevel@tonic-gate if [ "$D_FLAG" = "y" ]; then 21627c478bd9Sstevel@tonic-gate rtime_sflag="" 21637c478bd9Sstevel@tonic-gate else 21647c478bd9Sstevel@tonic-gate rtime_sflag="-s" 21657c478bd9Sstevel@tonic-gate fi 21667c478bd9Sstevel@tonic-gate check_rtime -d $ROOT -i -m -o $rtime_sflag $ROOT 2>&1 | \ 21677c478bd9Sstevel@tonic-gate egrep -v ": unreferenced object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \ 21687c478bd9Sstevel@tonic-gate egrep -v ": unused object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \ 21697c478bd9Sstevel@tonic-gate sort >$SRC/runtime.out 21707c478bd9Sstevel@tonic-gate 21717c478bd9Sstevel@tonic-gate # Determine any processing errors that will affect the final output 21727c478bd9Sstevel@tonic-gate # and display these first. 21737c478bd9Sstevel@tonic-gate grep -l "$LDDUSAGE" $SRC/runtime.out > /dev/null 21747c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 21757c478bd9Sstevel@tonic-gate echo "WARNING: ldd(1) does not support -e. The version of ldd(1)" | \ 21767c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21777c478bd9Sstevel@tonic-gate echo "on your system is old - 4390308 (s81_30) is required.\n" | \ 21787c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21797c478bd9Sstevel@tonic-gate fi 21807c478bd9Sstevel@tonic-gate grep -l "$LDDWRONG" $SRC/runtime.out > /dev/null 21817c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 21827c478bd9Sstevel@tonic-gate echo "WARNING: wrong class message detected. ldd(1) was unable" | \ 21837c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21847c478bd9Sstevel@tonic-gate echo "to execute an object, thus it could not be checked fully." | \ 21857c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21867c478bd9Sstevel@tonic-gate echo "Perhaps a 64-bit object was encountered on a 32-bit system," | \ 21877c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21887c478bd9Sstevel@tonic-gate echo "or an i386 object was encountered on a sparc system?\n" | \ 21897c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21907c478bd9Sstevel@tonic-gate fi 21917c478bd9Sstevel@tonic-gate grep -l "$CRLECONF" $SRC/runtime.out > /dev/null 21927c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 21937c478bd9Sstevel@tonic-gate echo "WARNING: creation of an alternative dependency cache failed." | \ 21947c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21957c478bd9Sstevel@tonic-gate echo "Dependencies will bind to the base system libraries.\n" | \ 21967c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21977c478bd9Sstevel@tonic-gate grep "$CRLECONF" $SRC/runtime.out | \ 21987c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21997c478bd9Sstevel@tonic-gate grep "$CRLERROR" $SRC/runtime.out | grep -v "$CRLECONF" | \ 22007c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 22017c478bd9Sstevel@tonic-gate echo "\n" | tee -a $LOGFILE >> $mail_msg_file 22027c478bd9Sstevel@tonic-gate fi 22037c478bd9Sstevel@tonic-gate 22047c478bd9Sstevel@tonic-gate egrep '<dependency no longer necessary>' $SRC/runtime.out | \ 22057c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 22067c478bd9Sstevel@tonic-gate 22077c478bd9Sstevel@tonic-gate # NEEDED= and RPATH= are informational; report anything else that we 22087c478bd9Sstevel@tonic-gate # haven't already. 22097c478bd9Sstevel@tonic-gate egrep -v "NEEDED=|RPATH=|$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 22107c478bd9Sstevel@tonic-gate $SRC/runtime.out | tee -a $LOGFILE >> $mail_msg_file 22117c478bd9Sstevel@tonic-gate 22127c478bd9Sstevel@tonic-gate # probably should compare against a 'known ok runpaths' list 22137c478bd9Sstevel@tonic-gate if [ ! -f $SRC/runtime.ref ]; then 22147c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 22157c478bd9Sstevel@tonic-gate $SRC/runtime.out > $SRC/runtime.ref 22167c478bd9Sstevel@tonic-gate fi 22177c478bd9Sstevel@tonic-gate 22187c478bd9Sstevel@tonic-gate echo "\n==== Diff ELF runtime attributes (since last build) ====\n" \ 22197c478bd9Sstevel@tonic-gate >> $mail_msg_file 22207c478bd9Sstevel@tonic-gate 22217c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" $SRC/runtime.out | \ 22227c478bd9Sstevel@tonic-gate diff $SRC/runtime.ref - >> $mail_msg_file 22237c478bd9Sstevel@tonic-gatefi 22247c478bd9Sstevel@tonic-gate 22257c478bd9Sstevel@tonic-gate# DEBUG lint of kernel begins 22267c478bd9Sstevel@tonic-gate 22277c478bd9Sstevel@tonic-gateif [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 22287c478bd9Sstevel@tonic-gate if [ "$LINTDIRS" = "" ]; then 22297c478bd9Sstevel@tonic-gate # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y" 22307c478bd9Sstevel@tonic-gate LINTDIRS="$SRC y" 22317c478bd9Sstevel@tonic-gate fi 22327c478bd9Sstevel@tonic-gate set $LINTDIRS 22337c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 22347c478bd9Sstevel@tonic-gate dolint $1 $2; shift; shift 22357c478bd9Sstevel@tonic-gate done 22367c478bd9Sstevel@tonic-gateelse 22377c478bd9Sstevel@tonic-gate echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE 22387c478bd9Sstevel@tonic-gatefi 22397c478bd9Sstevel@tonic-gate 22407c478bd9Sstevel@tonic-gate# "make check" begins 22417c478bd9Sstevel@tonic-gate 22427c478bd9Sstevel@tonic-gateif [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then 22437c478bd9Sstevel@tonic-gate # remove old check.out 22447c478bd9Sstevel@tonic-gate rm -f $SRC/check.out 22457c478bd9Sstevel@tonic-gate 22467c478bd9Sstevel@tonic-gate rm -f $SRC/check-${MACH}.out 22477c478bd9Sstevel@tonic-gate cd $SRC 22487c478bd9Sstevel@tonic-gate $MAKE -ek check 2>&1 | tee -a $SRC/check-${MACH}.out >> $LOGFILE 22497c478bd9Sstevel@tonic-gate echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file 22507c478bd9Sstevel@tonic-gate 22517c478bd9Sstevel@tonic-gate grep ":" $SRC/check-${MACH}.out | 22527c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 22537c478bd9Sstevel@tonic-gate sort | uniq >> $mail_msg_file 22547c478bd9Sstevel@tonic-gateelse 22557c478bd9Sstevel@tonic-gate echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE 22567c478bd9Sstevel@tonic-gatefi 22577c478bd9Sstevel@tonic-gate 22587c478bd9Sstevel@tonic-gateecho "\n==== Find core files ====\n" | \ 22597c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 22607c478bd9Sstevel@tonic-gate 2261fb23a357Skupferfind $abssrcdirs -name core -a -type f -exec file {} \; | \ 22627c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 22637c478bd9Sstevel@tonic-gate 22647c478bd9Sstevel@tonic-gateif [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 22657c478bd9Sstevel@tonic-gate echo "\n==== Diff unreferenced files (since last build) ====\n" \ 22667c478bd9Sstevel@tonic-gate | tee -a $LOGFILE >>$mail_msg_file 22677c478bd9Sstevel@tonic-gate rm -f $SRC/unref-${MACH}.ref 22687c478bd9Sstevel@tonic-gate if [ -f $SRC/unref-${MACH}.out ]; then 22697c478bd9Sstevel@tonic-gate mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 22707c478bd9Sstevel@tonic-gate fi 22717c478bd9Sstevel@tonic-gate 2272fb23a357Skupfer findunref -t $SRC/.build.tstamp $SRC/.. \ 2273fb23a357Skupfer ${TOOLS}/findunref/exception_list \ 2274fb23a357Skupfer 2>> $mail_msg_file | sort | \ 2275fb23a357Skupfer sed -e s=^./src/=./= -e s=^./closed/=../closed/= \ 2276fb23a357Skupfer > $SRC/unref-${MACH}.out 22777c478bd9Sstevel@tonic-gate 22787c478bd9Sstevel@tonic-gate if [ ! -f $SRC/unref-${MACH}.ref ]; then 22797c478bd9Sstevel@tonic-gate cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 22807c478bd9Sstevel@tonic-gate fi 22817c478bd9Sstevel@tonic-gate 22827c478bd9Sstevel@tonic-gate diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file 22837c478bd9Sstevel@tonic-gatefi 22847c478bd9Sstevel@tonic-gate 22857c478bd9Sstevel@tonic-gate# Verify that the usual lists of files, such as exception lists, 22867c478bd9Sstevel@tonic-gate# contain only valid references to files. If the build has failed, 22877c478bd9Sstevel@tonic-gate# then don't check the proto area. 22887c478bd9Sstevel@tonic-gateCHECK_PATHS=${CHECK_PATHS:-y} 22897c478bd9Sstevel@tonic-gateif [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then 22907c478bd9Sstevel@tonic-gate echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \ 22917c478bd9Sstevel@tonic-gate >>$mail_msg_file 22927c478bd9Sstevel@tonic-gate arg=-b 22937c478bd9Sstevel@tonic-gate [ "$build_ok" = y ] && arg= 22947c478bd9Sstevel@tonic-gate checkpaths $arg $ROOT 2>&1 | tee -a $LOGFILE >>$mail_msg_file 22957c478bd9Sstevel@tonic-gatefi 22967c478bd9Sstevel@tonic-gate 22977c478bd9Sstevel@tonic-gateif [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then 22987c478bd9Sstevel@tonic-gate echo "\n==== Impact on file permissions ====\n" \ 22997c478bd9Sstevel@tonic-gate >> $mail_msg_file 23007c478bd9Sstevel@tonic-gate # 23017c478bd9Sstevel@tonic-gate # Get pkginfo files from usr/src/pkgdefs 23027c478bd9Sstevel@tonic-gate # 23037c478bd9Sstevel@tonic-gate pmodes -qvdP \ 2304fb9f9b97Skupfer `for d in $abssrcdirs; do 2305fb9f9b97Skupfer if [ -d "$d/pkgdefs" ] 23067c478bd9Sstevel@tonic-gate then 2307fb9f9b97Skupfer find $d/pkgdefs -name pkginfo.tmpl -print -o -name .del\* -prune 23087c478bd9Sstevel@tonic-gate fi 23097c478bd9Sstevel@tonic-gate done | sed -e 's:/pkginfo.tmpl$::' | sort -u ` >> $mail_msg_file 23107c478bd9Sstevel@tonic-gatefi 23117c478bd9Sstevel@tonic-gate 231296ccc8cbSesaxeif [ "$w_FLAG" = "y" -a "$build_ok" = "y" ]; then 2313534f4022Sdduvall echo "\n==== Objects that differ since last build ====\n" | \ 231496ccc8cbSesaxe tee -a $LOGFILE >> $mail_msg_file 231596ccc8cbSesaxe 231696ccc8cbSesaxe if [ "$t_FLAG" = "y" ]; then 2317534f4022Sdduvall wsdiff -t -r ${TMPDIR}/wsdiff.results $ROOT.prev $ROOT | \ 231896ccc8cbSesaxe tee -a $LOGFILE >> $mail_msg_file 231996ccc8cbSesaxe else 2320534f4022Sdduvall wsdiff -r ${TMPDIR}/wsdiff.results $ROOT.prev $ROOT | \ 232196ccc8cbSesaxe tee -a $LOGFILE >> $mail_msg_file 232296ccc8cbSesaxe fi 232396ccc8cbSesaxefi 232496ccc8cbSesaxe 23257c478bd9Sstevel@tonic-gateEND_DATE=`date` 23267c478bd9Sstevel@tonic-gateecho "==== Nightly $maketype build completed: $END_DATE ====" | \ 23277c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 23287c478bd9Sstevel@tonic-gate 23297c478bd9Sstevel@tonic-gatetypeset -Z2 minutes 23307c478bd9Sstevel@tonic-gatetypeset -Z2 seconds 23317c478bd9Sstevel@tonic-gate 23327c478bd9Sstevel@tonic-gateelapsed_time=$SECONDS 23337c478bd9Sstevel@tonic-gate((hours = elapsed_time / 3600 )) 23347c478bd9Sstevel@tonic-gate((minutes = elapsed_time / 60 % 60)) 23357c478bd9Sstevel@tonic-gate((seconds = elapsed_time % 60)) 23367c478bd9Sstevel@tonic-gate 23377c478bd9Sstevel@tonic-gateecho "\n==== Total build time ====" | \ 23387c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 23397c478bd9Sstevel@tonic-gateecho "\nreal ${hours}:${minutes}:${seconds}" | \ 23407c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 23417c478bd9Sstevel@tonic-gate 23427c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" -a "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 23437c478bd9Sstevel@tonic-gate staffer cp ${SRC}/unref-${MACH}.out $PARENT_WS/usr/src/ 23447c478bd9Sstevel@tonic-gate 23457c478bd9Sstevel@tonic-gate # 23467c478bd9Sstevel@tonic-gate # Produce a master list of unreferenced files -- ideally, we'd 23477c478bd9Sstevel@tonic-gate # generate the master just once after all of the nightlies 23487c478bd9Sstevel@tonic-gate # have finished, but there's no simple way to know when that 23497c478bd9Sstevel@tonic-gate # will be. Instead, we assume that we're the last nightly to 23507c478bd9Sstevel@tonic-gate # finish and merge all of the unref-${MACH}.out files in 23517c478bd9Sstevel@tonic-gate # $PARENT_WS/usr/src/. If we are in fact the final ${MACH} to 23527c478bd9Sstevel@tonic-gate # finish, then this file will be the authoritative master 23537c478bd9Sstevel@tonic-gate # list. Otherwise, another ${MACH}'s nightly will eventually 23547c478bd9Sstevel@tonic-gate # overwrite ours with its own master, but in the meantime our 23557c478bd9Sstevel@tonic-gate # temporary "master" will be no worse than any older master 23567c478bd9Sstevel@tonic-gate # which was already on the parent. 23577c478bd9Sstevel@tonic-gate # 23587c478bd9Sstevel@tonic-gate 23597c478bd9Sstevel@tonic-gate set -- $PARENT_WS/usr/src/unref-*.out 23607c478bd9Sstevel@tonic-gate cp "$1" ${TMPDIR}/unref.merge 23617c478bd9Sstevel@tonic-gate shift 23627c478bd9Sstevel@tonic-gate 23637c478bd9Sstevel@tonic-gate for unreffile; do 23647c478bd9Sstevel@tonic-gate comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$ 23657c478bd9Sstevel@tonic-gate mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge 23667c478bd9Sstevel@tonic-gate done 23677c478bd9Sstevel@tonic-gate 23687c478bd9Sstevel@tonic-gate staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out 23697c478bd9Sstevel@tonic-gatefi 23707c478bd9Sstevel@tonic-gate 23717c478bd9Sstevel@tonic-gate# 23727c478bd9Sstevel@tonic-gate# All done save for the sweeping up. 23737c478bd9Sstevel@tonic-gate# (whichever exit we hit here will trigger the "cleanup" trap which 23747c478bd9Sstevel@tonic-gate# optionally sends mail on completion). 23757c478bd9Sstevel@tonic-gate# 23767c478bd9Sstevel@tonic-gateif [ "$build_ok" = "y" ]; then 23777c478bd9Sstevel@tonic-gate exit 0 23787c478bd9Sstevel@tonic-gatefi 23797c478bd9Sstevel@tonic-gateexit 1 2380