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# 224e5b757fSkupfer 237c478bd9Sstevel@tonic-gate# 246c3c9007Sstevel# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate# Use is subject to license terms. 267c478bd9Sstevel@tonic-gate# 277c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 287c478bd9Sstevel@tonic-gate# 297c478bd9Sstevel@tonic-gate# Based on the nightly script from the integration folks, 307c478bd9Sstevel@tonic-gate# Mostly modified and owned by mike_s. 317c478bd9Sstevel@tonic-gate# Changes also by kjc, dmk. 327c478bd9Sstevel@tonic-gate# 337c478bd9Sstevel@tonic-gate# BRINGOVER_WS may be specified in the env file. 347c478bd9Sstevel@tonic-gate# The default is the old behavior of CLONE_WS 357c478bd9Sstevel@tonic-gate# 367c478bd9Sstevel@tonic-gate# -i on the command line, means fast options, so when it's on the 37d77e7149Ssommerfe# command line (only), lint and check builds are skipped no matter what 38d77e7149Ssommerfe# the setting of their individual flags are in NIGHTLY_OPTIONS. 397c478bd9Sstevel@tonic-gate# 407c478bd9Sstevel@tonic-gate# LINTDIRS can be set in the env file, format is a list of: 417c478bd9Sstevel@tonic-gate# 427c478bd9Sstevel@tonic-gate# /dirname-to-run-lint-on flag 437c478bd9Sstevel@tonic-gate# 447c478bd9Sstevel@tonic-gate# Where flag is: y - enable lint noise diff output 457c478bd9Sstevel@tonic-gate# n - disable lint noise diff output 467c478bd9Sstevel@tonic-gate# 477c478bd9Sstevel@tonic-gate# For example: LINTDIRS="$SRC/uts n $SRC/stand y $SRC/psm y" 487c478bd9Sstevel@tonic-gate# 497c478bd9Sstevel@tonic-gate# -A flag in NIGHTLY_OPTIONS checks ABI diffs in .so files 507c478bd9Sstevel@tonic-gate# This option requires a couple of scripts. 517c478bd9Sstevel@tonic-gate# 527c478bd9Sstevel@tonic-gate# OPTHOME and TEAMWARE may be set in the environment to override /opt 537c478bd9Sstevel@tonic-gate# and /opt/teamware defaults. 547c478bd9Sstevel@tonic-gate# 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate# 577c478bd9Sstevel@tonic-gate# The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout 587c478bd9Sstevel@tonic-gate# under certain circumstances, which can really screw things up; unset it. 597c478bd9Sstevel@tonic-gate# 607c478bd9Sstevel@tonic-gateunset CDPATH 617c478bd9Sstevel@tonic-gate 624e5b757fSkupfer# 634e5b757fSkupfer# Print the tag string used to identify a build (e.g., "DEBUG 644e5b757fSkupfer# open-only") 654e5b757fSkupfer# usage: tagstring debug-part open-part 664e5b757fSkupfer# 674e5b757fSkupfertagstring() { 684e5b757fSkupfer debug_part=$1 694e5b757fSkupfer open_part=$2 704e5b757fSkupfer 714e5b757fSkupfer if [ -n "$open_part" ]; then 724e5b757fSkupfer echo "$debug_part $open_part" 734e5b757fSkupfer else 744e5b757fSkupfer echo "$debug_part" 754e5b757fSkupfer fi 764e5b757fSkupfer} 774e5b757fSkupfer 784e5b757fSkupfer# 794e5b757fSkupfer# Function to do a DEBUG and non-DEBUG build. Needed because we might 807c478bd9Sstevel@tonic-gate# need to do another for the source build, and since we only deliver DEBUG or 817c478bd9Sstevel@tonic-gate# non-DEBUG packages. 824e5b757fSkupfer# 834e5b757fSkupfer# usage: normal_build [-O] 844e5b757fSkupfer# -O OpenSolaris delivery build. Put the proto area, BFU archives, 854e5b757fSkupfer# and packages in -open directories. Use skeleton closed 864e5b757fSkupfer# binaries. Skip the package build (until 6414822 is fixed). 874e5b757fSkupfer# 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gatenormal_build() { 907c478bd9Sstevel@tonic-gate 914e5b757fSkupfer orig_p_FLAG=$p_FLAG 924e5b757fSkupfer 934e5b757fSkupfer suffix="" 944e5b757fSkupfer open_only="" 954e5b757fSkupfer while getopts O FLAG $*; do 964e5b757fSkupfer case $FLAG in 974e5b757fSkupfer O) 984e5b757fSkupfer suffix="-open" 994e5b757fSkupfer open_only="open-only" 1004e5b757fSkupfer p_FLAG=n 1014e5b757fSkupfer ;; 1024e5b757fSkupfer esac 1034e5b757fSkupfer done 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate # non-DEBUG build begins 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate if [ "$F_FLAG" = "n" ]; then 1084e5b757fSkupfer set_non_debug_build_flags 1094e5b757fSkupfer mytag=`tagstring "non-DEBUG" "$open_only"` 1104e5b757fSkupfer build "$mytag" "$suffix-nd" $MULTI_PROTO 1114e5b757fSkupfer if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a \ 1124e5b757fSkupfer "$p_FLAG" = "y" ]; then 1137c478bd9Sstevel@tonic-gate copy_ihv_pkgs non-DEBUG -nd 1147c478bd9Sstevel@tonic-gate fi 1157c478bd9Sstevel@tonic-gate else 1164e5b757fSkupfer echo "\n==== No non-DEBUG $open_only build ====\n" >> $LOGFILE 1177c478bd9Sstevel@tonic-gate fi 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate # non-DEBUG build ends 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate # DEBUG build begins 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate if [ "$D_FLAG" = "y" ]; then 1244e5b757fSkupfer set_debug_build_flags 1254e5b757fSkupfer mytag=`tagstring "DEBUG" "$open_only"` 1264e5b757fSkupfer build "$mytag" "$suffix" $MULTI_PROTO 1274e5b757fSkupfer if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a \ 1284e5b757fSkupfer "$p_FLAG" = "y" ]; then 1297c478bd9Sstevel@tonic-gate copy_ihv_pkgs DEBUG "" 1307c478bd9Sstevel@tonic-gate fi 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate else 1334e5b757fSkupfer echo "\n==== No DEBUG $open_only build ====\n" >> $LOGFILE 1347c478bd9Sstevel@tonic-gate fi 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate # DEBUG build ends 1374e5b757fSkupfer 1384e5b757fSkupfer p_FLAG=$orig_p_FLAG 1397c478bd9Sstevel@tonic-gate} 1407c478bd9Sstevel@tonic-gate 1411fe69678Skupfer# 1421fe69678Skupfer# usage: filelist DESTDIR PATTERN 1431fe69678Skupfer# 1447c478bd9Sstevel@tonic-gatefilelist() { 1457c478bd9Sstevel@tonic-gate DEST=$1 1467c478bd9Sstevel@tonic-gate PATTERN=$2 1477c478bd9Sstevel@tonic-gate cd ${DEST} 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate OBJFILES=${ORIG_SRC}/xmod/obj_files 1507c478bd9Sstevel@tonic-gate if [ ! -f ${OBJFILES} ]; then 1517c478bd9Sstevel@tonic-gate return; 1527c478bd9Sstevel@tonic-gate fi 1531fe69678Skupfer for i in `grep -v '^#' ${OBJFILES} | \ 1547c478bd9Sstevel@tonic-gate grep ${PATTERN} | cut -d: -f2 | tr -d ' \t'` 1557c478bd9Sstevel@tonic-gate do 1567c478bd9Sstevel@tonic-gate # wildcard expansion 1577c478bd9Sstevel@tonic-gate for j in $i 1587c478bd9Sstevel@tonic-gate do 1597c478bd9Sstevel@tonic-gate if [ -f "$j" ]; then 1607c478bd9Sstevel@tonic-gate echo $j 1617c478bd9Sstevel@tonic-gate fi 1627c478bd9Sstevel@tonic-gate if [ -d "$j" ]; then 1637c478bd9Sstevel@tonic-gate echo $j 1647c478bd9Sstevel@tonic-gate fi 1657c478bd9Sstevel@tonic-gate done 1667c478bd9Sstevel@tonic-gate done | sort | uniq 1677c478bd9Sstevel@tonic-gate} 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate# function to save off binaries after a full build for later 1707c478bd9Sstevel@tonic-gate# restoration 1717c478bd9Sstevel@tonic-gatesave_binaries() { 1727c478bd9Sstevel@tonic-gate # save off list of binaries 1737c478bd9Sstevel@tonic-gate echo "\n==== Saving binaries from build at `date` ====\n" | \ 1747c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 1757c478bd9Sstevel@tonic-gate rm -f ${BINARCHIVE} 1767c478bd9Sstevel@tonic-gate cd ${CODEMGR_WS} 1777c478bd9Sstevel@tonic-gate filelist ${CODEMGR_WS} '^preserve:' >> $LOGFILE 1787c478bd9Sstevel@tonic-gate filelist ${CODEMGR_WS} '^preserve:' | \ 1797c478bd9Sstevel@tonic-gate cpio -ocB 2>/dev/null | compress \ 1807c478bd9Sstevel@tonic-gate > ${BINARCHIVE} 1817c478bd9Sstevel@tonic-gate} 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate# delete files 1841fe69678Skupfer# usage: hybridize_files DESTDIR MAKE_TARGET 1857c478bd9Sstevel@tonic-gatehybridize_files() { 1867c478bd9Sstevel@tonic-gate DEST=$1 1877c478bd9Sstevel@tonic-gate MAKETARG=$2 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate echo "\n==== Hybridizing files at `date` ====\n" | \ 1907c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 1917c478bd9Sstevel@tonic-gate for i in `filelist ${DEST} '^delete:'` 1927c478bd9Sstevel@tonic-gate do 1937c478bd9Sstevel@tonic-gate echo "removing ${i}." | tee -a $mail_msg_file >> $LOGFILE 1947c478bd9Sstevel@tonic-gate rm -rf "${i}" 1957c478bd9Sstevel@tonic-gate done 1967c478bd9Sstevel@tonic-gate for i in `filelist ${DEST} '^hybridize:' ` 1977c478bd9Sstevel@tonic-gate do 1987c478bd9Sstevel@tonic-gate echo "hybridizing ${i}." | tee -a $mail_msg_file >> $LOGFILE 1997c478bd9Sstevel@tonic-gate rm -f ${i}+ 2007c478bd9Sstevel@tonic-gate sed -e "/^# HYBRID DELETE START/,/^# HYBRID DELETE END/d" \ 2017c478bd9Sstevel@tonic-gate < ${i} > ${i}+ 2027c478bd9Sstevel@tonic-gate mv ${i}+ ${i} 2037c478bd9Sstevel@tonic-gate done 2047c478bd9Sstevel@tonic-gate} 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gate# restore binaries into the proper source tree. 2071fe69678Skupfer# usage: restore_binaries DESTDIR MAKE_TARGET 2087c478bd9Sstevel@tonic-gaterestore_binaries() { 2097c478bd9Sstevel@tonic-gate DEST=$1 2107c478bd9Sstevel@tonic-gate MAKETARG=$2 2117c478bd9Sstevel@tonic-gate 2127c478bd9Sstevel@tonic-gate echo "\n==== Restoring binaries to ${MAKETARG} at `date` ====\n" | \ 2137c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2147c478bd9Sstevel@tonic-gate cd ${DEST} 2157c478bd9Sstevel@tonic-gate zcat ${BINARCHIVE} | \ 2167c478bd9Sstevel@tonic-gate cpio -idmucvB 2>/dev/null | tee -a $mail_msg_file >> ${LOGFILE} 2177c478bd9Sstevel@tonic-gate} 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate# rename files we save binaries of 2201fe69678Skupfer# usage: rename_files DESTDIR MAKE_TARGET 2217c478bd9Sstevel@tonic-gaterename_files() { 2227c478bd9Sstevel@tonic-gate DEST=$1 2237c478bd9Sstevel@tonic-gate MAKETARG=$2 2247c478bd9Sstevel@tonic-gate echo "\n==== Renaming source files in ${MAKETARG} at `date` ====\n" | \ 2257c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2267c478bd9Sstevel@tonic-gate for i in `filelist ${DEST} '^rename:'` 2277c478bd9Sstevel@tonic-gate do 2287c478bd9Sstevel@tonic-gate echo ${i} | tee -a $mail_msg_file >> ${LOGFILE} 2297c478bd9Sstevel@tonic-gate rm -f ${i}.export 2307c478bd9Sstevel@tonic-gate mv ${i} ${i}.export 2317c478bd9Sstevel@tonic-gate done 2327c478bd9Sstevel@tonic-gate} 2337c478bd9Sstevel@tonic-gate 2341fe69678Skupfer# 2351fe69678Skupfer# Copy some or all of the source tree. 2361fe69678Skupfer# usage: copy_source CODEMGR_WS DESTDIR LABEL SRCROOT 2371fe69678Skupfer# 2381fe69678Skupfercopy_source() { 2397c478bd9Sstevel@tonic-gate WS=$1 2407c478bd9Sstevel@tonic-gate DEST=$2 2411fe69678Skupfer label=$3 2421fe69678Skupfer srcroot=$4 2437c478bd9Sstevel@tonic-gate 2441fe69678Skupfer echo "\n==== Creating ${DEST} source from ${WS} ($label) ====\n" | \ 2457c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate echo "cleaning out ${DEST}." >> $LOGFILE 2487c478bd9Sstevel@tonic-gate rm -rf "${DEST}" >> $LOGFILE 2>&1 2497c478bd9Sstevel@tonic-gate 2507c478bd9Sstevel@tonic-gate mkdir -p ${DEST} 2517c478bd9Sstevel@tonic-gate cd ${WS} 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate echo "creating ${DEST}." >> $LOGFILE 2541fe69678Skupfer find $srcroot -name 's\.*' -a -type f -print | \ 2557c478bd9Sstevel@tonic-gate sed -e 's,SCCS\/s.,,' | \ 2567c478bd9Sstevel@tonic-gate grep -v '/\.del-*' | \ 2577c478bd9Sstevel@tonic-gate cpio -pd ${DEST} >>$LOGFILE 2>&1 2581fe69678Skupfer} 2597c478bd9Sstevel@tonic-gate 2601fe69678Skupfer# 2611fe69678Skupfer# function to create (but not build) the export/crypt source tree. 2621fe69678Skupfer# usage: set_up_source_build CODEMGR_WS DESTDIR MAKE_TARGET 2631fe69678Skupfer# Sets SRC to the modified source tree, for use by the caller when it 2641fe69678Skupfer# builds the tree. 2651fe69678Skupfer# 2661fe69678Skupferset_up_source_build() { 2671fe69678Skupfer WS=$1 2681fe69678Skupfer DEST=$2 2691fe69678Skupfer MAKETARG=$3 2701fe69678Skupfer 2711fe69678Skupfer copy_source $WS $DEST $MAKETARG usr 2727c478bd9Sstevel@tonic-gate SRC=${DEST}/usr/src 2737c478bd9Sstevel@tonic-gate 2747c478bd9Sstevel@tonic-gate cd $SRC 2757c478bd9Sstevel@tonic-gate rm -f ${MAKETARG}.out 2767c478bd9Sstevel@tonic-gate echo "making ${MAKETARG} in ${SRC}." >> $LOGFILE 2777c478bd9Sstevel@tonic-gate /bin/time $MAKE -e ${MAKETARG} 2>&1 | \ 2787c478bd9Sstevel@tonic-gate tee -a $SRC/${MAKETARG}.out >> $LOGFILE 2797c478bd9Sstevel@tonic-gate echo "\n==== ${MAKETARG} build errors ====\n" >> $mail_msg_file 2807c478bd9Sstevel@tonic-gate egrep ":" $SRC/${MAKETARG}.out | \ 2817c478bd9Sstevel@tonic-gate egrep -e "(^${MAKE}:|[ ]error[: \n])" | \ 2827c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 2837c478bd9Sstevel@tonic-gate egrep -v "warning" >> $mail_msg_file 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gate echo "clearing state files." >> $LOGFILE 2867c478bd9Sstevel@tonic-gate find . -name '.make*' -exec rm -f {} \; 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate cd ${DEST} 2897c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "CRYPT_SRC" ]; then 2907c478bd9Sstevel@tonic-gate rm -f ${CODEMGR_WS}/crypt_files.cpio.Z 2917c478bd9Sstevel@tonic-gate echo "\n==== xmod/cry_files that don't exist ====\n" | \ 2927c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2937c478bd9Sstevel@tonic-gate CRYPT_FILES=${WS}/usr/src/xmod/cry_files 2947c478bd9Sstevel@tonic-gate for i in `cat ${CRYPT_FILES}` 2957c478bd9Sstevel@tonic-gate do 2967c478bd9Sstevel@tonic-gate # make sure the files exist 2977c478bd9Sstevel@tonic-gate if [ -f "$i" ]; then 2987c478bd9Sstevel@tonic-gate continue 2997c478bd9Sstevel@tonic-gate fi 3007c478bd9Sstevel@tonic-gate if [ -d "$i" ]; then 3017c478bd9Sstevel@tonic-gate continue 3027c478bd9Sstevel@tonic-gate fi 3037c478bd9Sstevel@tonic-gate echo "$i" | tee -a $mail_msg_file >> $LOGFILE 3047c478bd9Sstevel@tonic-gate done 3057c478bd9Sstevel@tonic-gate find `cat ${CRYPT_FILES}` -print 2>/dev/null | \ 3067c478bd9Sstevel@tonic-gate cpio -ocB 2>/dev/null | \ 3077c478bd9Sstevel@tonic-gate compress > ${CODEMGR_WS}/crypt_files.cpio.Z 3087c478bd9Sstevel@tonic-gate fi 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "EXPORT_SRC" ]; then 3117c478bd9Sstevel@tonic-gate # rename first, since we might restore a file 3127c478bd9Sstevel@tonic-gate # of the same name (mapfiles) 3137c478bd9Sstevel@tonic-gate rename_files ${EXPORT_SRC} EXPORT_SRC 3147c478bd9Sstevel@tonic-gate if [ "$SH_FLAG" = "y" ]; then 3157c478bd9Sstevel@tonic-gate hybridize_files ${EXPORT_SRC} EXPORT_SRC 3167c478bd9Sstevel@tonic-gate fi 3177c478bd9Sstevel@tonic-gate fi 3187c478bd9Sstevel@tonic-gate 3197c478bd9Sstevel@tonic-gate # save the cleartext 3207c478bd9Sstevel@tonic-gate echo "\n==== Creating ${MAKETARG}.cpio.Z ====\n" | \ 3217c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 3227c478bd9Sstevel@tonic-gate cd ${DEST} 3237c478bd9Sstevel@tonic-gate rm -f ${MAKETARG}.cpio.Z 324fb23a357Skupfer find usr -depth -print | \ 3257c478bd9Sstevel@tonic-gate grep -v usr/src/${MAKETARG}.out | \ 3267c478bd9Sstevel@tonic-gate cpio -ocB 2>/dev/null | \ 3277c478bd9Sstevel@tonic-gate compress > ${CODEMGR_WS}/${MAKETARG}.cpio.Z 3287c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "EXPORT_SRC" ]; then 3297c478bd9Sstevel@tonic-gate restore_binaries ${EXPORT_SRC} EXPORT_SRC 3307c478bd9Sstevel@tonic-gate fi 3317c478bd9Sstevel@tonic-gate 3327c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "CRYPT_SRC" ]; then 3337c478bd9Sstevel@tonic-gate restore_binaries ${CRYPT_SRC} CRYPT_SRC 3347c478bd9Sstevel@tonic-gate fi 3357c478bd9Sstevel@tonic-gate 3367c478bd9Sstevel@tonic-gate} 3377c478bd9Sstevel@tonic-gate 3384e5b757fSkupfer# Return library search directive as function of given root. 3394e5b757fSkupfermyldlibs() { 3404e5b757fSkupfer echo "-L$1/lib -L$1/usr/lib" 3414e5b757fSkupfer} 3427c478bd9Sstevel@tonic-gate 3434e5b757fSkupfer# Return header search directive as function of given root. 3444e5b757fSkupfermyheaders() { 3454e5b757fSkupfer echo "-I$1/usr/include" 3464e5b757fSkupfer} 3474e5b757fSkupfer 3484e5b757fSkupfer# 3494e5b757fSkupfer# Function to do the build, including cpio archive and package generation. 3504e5b757fSkupfer# usage: build LABEL SUFFIX MULTIPROTO 3514e5b757fSkupfer# - LABEL is used to tag build output. 3524e5b757fSkupfer# - SUFFIX is used to distinguish files (e.g., debug vs non-debug). 3534e5b757fSkupfer# - If MULTIPROTO is "yes", it means to name the proto area according to 3544e5b757fSkupfer# SUFFIX. Otherwise ("no"), (re)use the standard proto area. 3554e5b757fSkupfer# 3567c478bd9Sstevel@tonic-gatebuild() { 3577c478bd9Sstevel@tonic-gate LABEL=$1 3587c478bd9Sstevel@tonic-gate SUFFIX=$2 3594e5b757fSkupfer MULTIPROTO=$3 3607c478bd9Sstevel@tonic-gate INSTALLOG=install${SUFFIX}-${MACH} 3617c478bd9Sstevel@tonic-gate NOISE=noise${SUFFIX}-${MACH} 3627c478bd9Sstevel@tonic-gate CPIODIR=${CPIODIR_ORIG}${SUFFIX} 3637c478bd9Sstevel@tonic-gate PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX} 364d8fd4470Sjg if [ "$SPARC_RM_PKGARCHIVE_ORIG" ]; then 365d8fd4470Sjg SPARC_RM_PKGARCHIVE=${SPARC_RM_PKGARCHIVE_ORIG}${SUFFIX} 366d8fd4470Sjg fi 3677c478bd9Sstevel@tonic-gate 3684e5b757fSkupfer ORIGROOT=$ROOT 3694e5b757fSkupfer [ $MULTIPROTO = no ] || export ROOT=$ROOT$SUFFIX 3704e5b757fSkupfer 3714e5b757fSkupfer export ENVLDLIBS1=`myldlibs $ROOT` 3724e5b757fSkupfer export ENVCPPFLAGS1=`myheaders $ROOT` 3734e5b757fSkupfer 3747c478bd9Sstevel@tonic-gate this_build_ok=y 3757c478bd9Sstevel@tonic-gate # 3767c478bd9Sstevel@tonic-gate # Build OS-Networking source 3777c478bd9Sstevel@tonic-gate # 3787c478bd9Sstevel@tonic-gate echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \ 3797c478bd9Sstevel@tonic-gate >> $LOGFILE 3807c478bd9Sstevel@tonic-gate 3817c478bd9Sstevel@tonic-gate rm -f $SRC/${INSTALLOG}.out 3827c478bd9Sstevel@tonic-gate cd $SRC 3837c478bd9Sstevel@tonic-gate /bin/time $MAKE -e install 2>&1 | \ 3847c478bd9Sstevel@tonic-gate tee -a $SRC/${INSTALLOG}.out >> $LOGFILE 38532f1e47bSsommerfe 38632f1e47bSsommerfe echo "\n==== SCCS Noise ($LABEL) ====\n" >> $mail_msg_file 38732f1e47bSsommerfe 38832f1e47bSsommerfe egrep 'sccs(check| get)' $SRC/${INSTALLOG}.out >> $mail_msg_file 38932f1e47bSsommerfe 3907c478bd9Sstevel@tonic-gate echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file 3917c478bd9Sstevel@tonic-gate egrep ":" $SRC/${INSTALLOG}.out | 3927c478bd9Sstevel@tonic-gate egrep -e "(^${MAKE}:|[ ]error[: \n])" | \ 3937c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 3947c478bd9Sstevel@tonic-gate egrep -v "cc .* -o error " | \ 3957c478bd9Sstevel@tonic-gate egrep -v "warning" >> $mail_msg_file 3967c478bd9Sstevel@tonic-gate if [ "$?" = "0" ]; then 3977c478bd9Sstevel@tonic-gate build_ok=n 3987c478bd9Sstevel@tonic-gate this_build_ok=n 3997c478bd9Sstevel@tonic-gate fi 4007c478bd9Sstevel@tonic-gate grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \ 4017c478bd9Sstevel@tonic-gate >> $mail_msg_file 4027c478bd9Sstevel@tonic-gate if [ "$?" = "0" ]; then 4037c478bd9Sstevel@tonic-gate build_ok=n 4047c478bd9Sstevel@tonic-gate this_build_ok=n 4057c478bd9Sstevel@tonic-gate fi 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gate if [ "$W_FLAG" = "n" ]; then 4087c478bd9Sstevel@tonic-gate echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file 4097c478bd9Sstevel@tonic-gate egrep -i warning: $SRC/${INSTALLOG}.out \ 4107c478bd9Sstevel@tonic-gate | egrep -v '^tic:' \ 4117c478bd9Sstevel@tonic-gate | egrep -v "symbol \`timezone' has differing types:" \ 4127c478bd9Sstevel@tonic-gate | egrep -v "parameter <PSTAMP> set to" \ 4137c478bd9Sstevel@tonic-gate | egrep -v "Ignoring unknown host" \ 4147c478bd9Sstevel@tonic-gate | egrep -v "redefining segment flags attribute for" \ 4157c478bd9Sstevel@tonic-gate >> $mail_msg_file 4167c478bd9Sstevel@tonic-gate fi 4177c478bd9Sstevel@tonic-gate 4187c478bd9Sstevel@tonic-gate echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \ 4197c478bd9Sstevel@tonic-gate >> $LOGFILE 4207c478bd9Sstevel@tonic-gate 4217c478bd9Sstevel@tonic-gate echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file 4227c478bd9Sstevel@tonic-gate tail -3 $SRC/${INSTALLOG}.out >>$mail_msg_file 4237c478bd9Sstevel@tonic-gate 4247c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "n" -a "$W_FLAG" = "n" ]; then 4257c478bd9Sstevel@tonic-gate rm -f $SRC/${NOISE}.ref 4267c478bd9Sstevel@tonic-gate if [ -f $SRC/${NOISE}.out ]; then 4277c478bd9Sstevel@tonic-gate mv $SRC/${NOISE}.out $SRC/${NOISE}.ref 4287c478bd9Sstevel@tonic-gate fi 4297c478bd9Sstevel@tonic-gate grep : $SRC/${INSTALLOG}.out \ 4307c478bd9Sstevel@tonic-gate | egrep -v '^/' \ 4317c478bd9Sstevel@tonic-gate | egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \ 4327c478bd9Sstevel@tonic-gate | egrep -v '^tic:' \ 4337c478bd9Sstevel@tonic-gate | egrep -v '^mcs' \ 4347c478bd9Sstevel@tonic-gate | egrep -v '^LD_LIBRARY_PATH=' \ 4357c478bd9Sstevel@tonic-gate | egrep -v 'ar: creating' \ 4367c478bd9Sstevel@tonic-gate | egrep -v 'ar: writing' \ 4377c478bd9Sstevel@tonic-gate | egrep -v 'conflicts:' \ 4387c478bd9Sstevel@tonic-gate | egrep -v ':saved created' \ 4397c478bd9Sstevel@tonic-gate | egrep -v '^stty.*c:' \ 4407c478bd9Sstevel@tonic-gate | egrep -v '^mfgname.c:' \ 4417c478bd9Sstevel@tonic-gate | egrep -v '^uname-i.c:' \ 4427c478bd9Sstevel@tonic-gate | egrep -v '^volumes.c:' \ 4437c478bd9Sstevel@tonic-gate | egrep -v '^lint library construction:' \ 4447c478bd9Sstevel@tonic-gate | egrep -v 'tsort: INFORM:' \ 4457c478bd9Sstevel@tonic-gate | egrep -v 'stripalign:' \ 4467c478bd9Sstevel@tonic-gate | egrep -v 'chars, width' \ 4477c478bd9Sstevel@tonic-gate | egrep -v "symbol \`timezone' has differing types:" \ 4487c478bd9Sstevel@tonic-gate | egrep -v 'PSTAMP' \ 4497c478bd9Sstevel@tonic-gate | egrep -v '|%WHOANDWHERE%|' \ 4507c478bd9Sstevel@tonic-gate | egrep -v '^Manifying' \ 4517c478bd9Sstevel@tonic-gate | egrep -v 'Ignoring unknown host' \ 4527c478bd9Sstevel@tonic-gate | egrep -v 'Processing method:' \ 4537c478bd9Sstevel@tonic-gate | egrep -v '^Writing' \ 4547c478bd9Sstevel@tonic-gate | egrep -v 'spellin1:' \ 4557c478bd9Sstevel@tonic-gate | egrep -v '^adding:' \ 4567c478bd9Sstevel@tonic-gate | egrep -v "^echo 'msgid" \ 4577c478bd9Sstevel@tonic-gate | egrep -v '^echo ' \ 4587c478bd9Sstevel@tonic-gate | egrep -v '\.c:$' \ 4597c478bd9Sstevel@tonic-gate | egrep -v '^Adding file:' \ 4607c478bd9Sstevel@tonic-gate | egrep -v 'CLASSPATH=' \ 4617c478bd9Sstevel@tonic-gate | egrep -v '\/var\/mail\/:saved' \ 4627c478bd9Sstevel@tonic-gate | egrep -v -- '-DUTS_VERSION=' \ 4637c478bd9Sstevel@tonic-gate | egrep -v '^Running Mkbootstrap' \ 4647c478bd9Sstevel@tonic-gate | egrep -v '^Applet length read:' \ 4657c478bd9Sstevel@tonic-gate | egrep -v 'bytes written:' \ 4667c478bd9Sstevel@tonic-gate | egrep -v '^File:SolarisAuthApplet.bin' \ 4677c478bd9Sstevel@tonic-gate | egrep -v -i 'jibversion' \ 4687c478bd9Sstevel@tonic-gate | egrep -v '^Output size:' \ 4697c478bd9Sstevel@tonic-gate | egrep -v '^Solo size statistics:' \ 4707c478bd9Sstevel@tonic-gate | egrep -v '^Using ROM API Version' \ 4717c478bd9Sstevel@tonic-gate | egrep -v '^Zero Signature length:' \ 4727c478bd9Sstevel@tonic-gate | egrep -v '^Note \(probably harmless\):' \ 4737c478bd9Sstevel@tonic-gate | egrep -v '::' \ 4747c478bd9Sstevel@tonic-gate | egrep -v -- '-xcache' \ 475010b217aSwesolows | egrep -v '^\+' \ 47603eb5f54Swesolows | egrep -v '^cc1: note: -fwritable-strings' \ 477c817a439Sjohnz | egrep -v 'svccfg-native -s svc:/' \ 4787c478bd9Sstevel@tonic-gate | sort | uniq >$SRC/${NOISE}.out 4797c478bd9Sstevel@tonic-gate if [ ! -f $SRC/${NOISE}.ref ]; then 4807c478bd9Sstevel@tonic-gate cp $SRC/${NOISE}.out $SRC/${NOISE}.ref 4817c478bd9Sstevel@tonic-gate fi 4827c478bd9Sstevel@tonic-gate echo "\n==== Build noise differences ($LABEL) ====\n" \ 4837c478bd9Sstevel@tonic-gate >>$mail_msg_file 4847c478bd9Sstevel@tonic-gate diff $SRC/${NOISE}.ref $SRC/${NOISE}.out >>$mail_msg_file 4857c478bd9Sstevel@tonic-gate fi 4867c478bd9Sstevel@tonic-gate 4877c478bd9Sstevel@tonic-gate # 48823259b79Srotondo # Re-sign selected binaries using signing server 48923259b79Srotondo # (gatekeeper builds only) 49023259b79Srotondo # 491*2210853dSjohnz if [ -n "$CODESIGN_USER" -a "$this_build_ok" = "y" ]; then 49223259b79Srotondo echo "\n==== Signing proto area at `date` ====\n" >> $LOGFILE 49323259b79Srotondo signing_file="${TMPDIR}/signing" 49423259b79Srotondo rm -f ${signing_file} 49523259b79Srotondo export CODESIGN_USER 49623259b79Srotondo signproto $SRC/tools/codesign/creds 2>&1 | \ 49723259b79Srotondo tee -a ${signing_file} >> $LOGFILE 49823259b79Srotondo echo "\n==== Finished signing proto area at `date` ====\n" \ 49923259b79Srotondo >> $LOGFILE 50023259b79Srotondo echo "\n==== Crypto module signing errors ($LABEL) ====\n" \ 50123259b79Srotondo >> $mail_msg_file 50223259b79Srotondo egrep 'WARNING|ERROR' ${signing_file} >> $mail_msg_file 503*2210853dSjohnz if [ $? = 0 ]; then 504*2210853dSjohnz build_ok=n 505*2210853dSjohnz this_build_ok=n 506*2210853dSjohnz fi 50723259b79Srotondo fi 50823259b79Srotondo 50923259b79Srotondo # 5107c478bd9Sstevel@tonic-gate # Create cpio archives for preintegration testing (PIT) 5117c478bd9Sstevel@tonic-gate # 5127c478bd9Sstevel@tonic-gate if [ "$a_FLAG" = "y" -a "$this_build_ok" = "y" ]; then 5137c478bd9Sstevel@tonic-gate echo "\n==== Creating $LABEL cpio archives at `date` ====\n" \ 5147c478bd9Sstevel@tonic-gate >> $LOGFILE 5157c478bd9Sstevel@tonic-gate makebfu_file="${TMPDIR}/makebfu" 5167c478bd9Sstevel@tonic-gate rm -f ${makebfu_file} 5177c478bd9Sstevel@tonic-gate makebfu 2>&1 | \ 5187c478bd9Sstevel@tonic-gate tee -a ${makebfu_file} >> $LOGFILE 5197c478bd9Sstevel@tonic-gate echo "\n==== cpio archives build errors ($LABEL) ====\n" \ 5207c478bd9Sstevel@tonic-gate >> $mail_msg_file 5217c478bd9Sstevel@tonic-gate grep -v "^Creating .* archive:" ${makebfu_file} | \ 5227c478bd9Sstevel@tonic-gate grep -v "^Making" | \ 5237c478bd9Sstevel@tonic-gate grep -v "^$" | \ 5247c478bd9Sstevel@tonic-gate sort | uniq >> $mail_msg_file 5257c478bd9Sstevel@tonic-gate rm -f ${makebfu_file} 5267c478bd9Sstevel@tonic-gate # hack for test folks 5277c478bd9Sstevel@tonic-gate if [ -z "`echo $PARENT_WS|egrep '^\/ws\/'`" ]; then 5287c478bd9Sstevel@tonic-gate X=/net/`uname -n`${CPIODIR} 5297c478bd9Sstevel@tonic-gate else 5307c478bd9Sstevel@tonic-gate X=${CPIODIR} 5317c478bd9Sstevel@tonic-gate fi 5327c478bd9Sstevel@tonic-gate echo "Archive_directory: ${X}" >${TMPDIR}/f 5337c478bd9Sstevel@tonic-gate cp ${TMPDIR}/f ${CPIODIR}/../../.${MACH}_wgtrun 5347c478bd9Sstevel@tonic-gate rm -f ${TMPDIR}/f 5357c478bd9Sstevel@tonic-gate 5367c478bd9Sstevel@tonic-gate else 5377c478bd9Sstevel@tonic-gate echo "\n==== Not creating $LABEL cpio archives ====\n" \ 5387c478bd9Sstevel@tonic-gate >> $LOGFILE 5397c478bd9Sstevel@tonic-gate fi 5407c478bd9Sstevel@tonic-gate 5417c478bd9Sstevel@tonic-gate # 5427c478bd9Sstevel@tonic-gate # Building Packages 5437c478bd9Sstevel@tonic-gate # 5447c478bd9Sstevel@tonic-gate if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then 5457c478bd9Sstevel@tonic-gate echo "\n==== Creating $LABEL packages at `date` ====\n" \ 5467c478bd9Sstevel@tonic-gate >> $LOGFILE 5477c478bd9Sstevel@tonic-gate rm -f $SRC/pkgdefs/${INSTALLOG}.out 5487c478bd9Sstevel@tonic-gate echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE 5497c478bd9Sstevel@tonic-gate rm -rf $PKGARCHIVE 5507c478bd9Sstevel@tonic-gate mkdir -p $PKGARCHIVE 551d8fd4470Sjg 552d8fd4470Sjg # 553d8fd4470Sjg # Optional build of sparc realmode on i386 554d8fd4470Sjg # 555d8fd4470Sjg if [ "$MACH" = "i386" ] && [ "${SPARC_RM_PKGARCHIVE}" ]; then 556d8fd4470Sjg echo "Clearing out ${SPARC_RM_PKGARCHIVE} ..." \ 557d8fd4470Sjg >> $LOGFILE 558d8fd4470Sjg rm -rf ${SPARC_RM_PKGARCHIVE} 559d8fd4470Sjg mkdir -p ${SPARC_RM_PKGARCHIVE} 560d8fd4470Sjg fi 561d8fd4470Sjg 5627c478bd9Sstevel@tonic-gate cd $SRC/pkgdefs 5637c478bd9Sstevel@tonic-gate $MAKE -e install 2>&1 | \ 5647c478bd9Sstevel@tonic-gate tee -a $SRC/pkgdefs/${INSTALLOG}.out >> $LOGFILE 5657c478bd9Sstevel@tonic-gate echo "\n==== Package build errors ($LABEL) ====\n" \ 5667c478bd9Sstevel@tonic-gate >> $mail_msg_file 5677c478bd9Sstevel@tonic-gate egrep "${MAKE}|ERROR|WARNING" $SRC/pkgdefs/${INSTALLOG}.out | \ 5687c478bd9Sstevel@tonic-gate grep ':' | \ 5697c478bd9Sstevel@tonic-gate grep -v PSTAMP | \ 5707c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 5717c478bd9Sstevel@tonic-gate >> $mail_msg_file 5727c478bd9Sstevel@tonic-gate else 5737c478bd9Sstevel@tonic-gate echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE 5747c478bd9Sstevel@tonic-gate fi 5754e5b757fSkupfer 5764e5b757fSkupfer ROOT=$ORIGROOT 5777c478bd9Sstevel@tonic-gate} 5787c478bd9Sstevel@tonic-gate 5791fe69678Skupfer# Usage: dolint /dir y|n 5807c478bd9Sstevel@tonic-gate# Arg. 2 is a flag to turn on/off the lint diff output 5811fe69678Skupferdolint() { 5827c478bd9Sstevel@tonic-gate if [ ! -d "$1" ]; then 5831fe69678Skupfer echo "dolint error: $1 is not a directory" 5847c478bd9Sstevel@tonic-gate exit 1 5857c478bd9Sstevel@tonic-gate fi 5867c478bd9Sstevel@tonic-gate 5877c478bd9Sstevel@tonic-gate if [ "$2" != "y" -a "$2" != "n" ]; then 5881fe69678Skupfer echo "dolint internal error: $2 should be 'y' or 'n'" 5897c478bd9Sstevel@tonic-gate exit 1 5907c478bd9Sstevel@tonic-gate fi 5917c478bd9Sstevel@tonic-gate 5927c478bd9Sstevel@tonic-gate lintdir=$1 5937c478bd9Sstevel@tonic-gate dodiff=$2 5947c478bd9Sstevel@tonic-gate base=`basename $lintdir` 5957c478bd9Sstevel@tonic-gate LINTOUT=$lintdir/lint-${MACH}.out 5967c478bd9Sstevel@tonic-gate LINTNOISE=$lintdir/lint-noise-${MACH} 5974e5b757fSkupfer export ENVLDLIBS1=`myldlibs $ROOT` 5984e5b757fSkupfer export ENVCPPFLAGS1=`myheaders $ROOT` 5997c478bd9Sstevel@tonic-gate 6004e5b757fSkupfer set_debug_build_flags 6017c478bd9Sstevel@tonic-gate 6027c478bd9Sstevel@tonic-gate # 6037c478bd9Sstevel@tonic-gate # '$MAKE lint' in $lintdir 6047c478bd9Sstevel@tonic-gate # 6057c478bd9Sstevel@tonic-gate echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE 6067c478bd9Sstevel@tonic-gate 6077c478bd9Sstevel@tonic-gate # remove old lint.out 6087c478bd9Sstevel@tonic-gate rm -f $lintdir/lint.out $lintdir/lint-noise.out 6097c478bd9Sstevel@tonic-gate if [ -f $lintdir/lint-noise.ref ]; then 6107c478bd9Sstevel@tonic-gate mv $lintdir/lint-noise.ref ${LINTNOISE}.ref 6117c478bd9Sstevel@tonic-gate fi 6127c478bd9Sstevel@tonic-gate 6137c478bd9Sstevel@tonic-gate rm -f $LINTOUT 6147c478bd9Sstevel@tonic-gate cd $lintdir 6157c478bd9Sstevel@tonic-gate # 6167c478bd9Sstevel@tonic-gate # Remove all .ln files to ensure a full reference file 6177c478bd9Sstevel@tonic-gate # 6187c478bd9Sstevel@tonic-gate rm -f Nothing_to_remove \ 6197c478bd9Sstevel@tonic-gate `find . -name SCCS -prune -o -type f -name '*.ln' -print ` 6207c478bd9Sstevel@tonic-gate 6217c478bd9Sstevel@tonic-gate /bin/time $MAKE -ek lint 2>&1 | \ 6227c478bd9Sstevel@tonic-gate tee -a $LINTOUT >> $LOGFILE 6237c478bd9Sstevel@tonic-gate echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file 6247c478bd9Sstevel@tonic-gate grep "$MAKE:" $LINTOUT | 6257c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 6267c478bd9Sstevel@tonic-gate >> $mail_msg_file 6277c478bd9Sstevel@tonic-gate 6287c478bd9Sstevel@tonic-gate echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE 6297c478bd9Sstevel@tonic-gate 6307c478bd9Sstevel@tonic-gate echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \ 6317c478bd9Sstevel@tonic-gate >>$mail_msg_file 6327c478bd9Sstevel@tonic-gate tail -3 $LINTOUT >>$mail_msg_file 6337c478bd9Sstevel@tonic-gate 6347c478bd9Sstevel@tonic-gate rm -f ${LINTNOISE}.ref 6357c478bd9Sstevel@tonic-gate if [ -f ${LINTNOISE}.out ]; then 6367c478bd9Sstevel@tonic-gate mv ${LINTNOISE}.out ${LINTNOISE}.ref 6377c478bd9Sstevel@tonic-gate fi 6387c478bd9Sstevel@tonic-gate grep : $LINTOUT | \ 6397c478bd9Sstevel@tonic-gate egrep -v '^(real|user|sys)' | 6407c478bd9Sstevel@tonic-gate egrep -v '(library construction)' | \ 6417c478bd9Sstevel@tonic-gate egrep -v ': global crosschecks' | \ 6427c478bd9Sstevel@tonic-gate egrep -v 'Ignoring unknown host' | \ 6437c478bd9Sstevel@tonic-gate egrep -v '\.c:$' | \ 6447c478bd9Sstevel@tonic-gate sort | uniq > ${LINTNOISE}.out 6457c478bd9Sstevel@tonic-gate if [ ! -f ${LINTNOISE}.ref ]; then 6467c478bd9Sstevel@tonic-gate cp ${LINTNOISE}.out ${LINTNOISE}.ref 6477c478bd9Sstevel@tonic-gate fi 6487c478bd9Sstevel@tonic-gate if [ "$dodiff" != "n" ]; then 6497c478bd9Sstevel@tonic-gate echo "\n==== lint warnings $base ====\n" \ 6507c478bd9Sstevel@tonic-gate >>$mail_msg_file 6517c478bd9Sstevel@tonic-gate # should be none, though there are a few that were filtered out 6527c478bd9Sstevel@tonic-gate # above 6537c478bd9Sstevel@tonic-gate egrep -i '(warning|lint):' ${LINTNOISE}.out \ 6547c478bd9Sstevel@tonic-gate | sort | uniq >> $mail_msg_file 6557c478bd9Sstevel@tonic-gate echo "\n==== lint noise differences $base ====\n" \ 6567c478bd9Sstevel@tonic-gate >> $mail_msg_file 6577c478bd9Sstevel@tonic-gate diff ${LINTNOISE}.ref ${LINTNOISE}.out \ 6587c478bd9Sstevel@tonic-gate >> $mail_msg_file 6597c478bd9Sstevel@tonic-gate fi 6607c478bd9Sstevel@tonic-gate} 6617c478bd9Sstevel@tonic-gate 6627c478bd9Sstevel@tonic-gate# Install proto area from IHV build 6637c478bd9Sstevel@tonic-gate 6647c478bd9Sstevel@tonic-gatecopy_ihv_proto() { 6657c478bd9Sstevel@tonic-gate 6666fec3625Sdduvall echo "\n==== Installing IHV proto area ====\n" \ 6677c478bd9Sstevel@tonic-gate >> $LOGFILE 6687c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_ROOT" ]; then 6697c478bd9Sstevel@tonic-gate if [ ! -d "$ROOT" ]; then 6707c478bd9Sstevel@tonic-gate echo "mkdir -p $ROOT" >> $LOGFILE 6717c478bd9Sstevel@tonic-gate mkdir -p $ROOT 6727c478bd9Sstevel@tonic-gate fi 6736fec3625Sdduvall echo "copying $IA32_IHV_ROOT to $ROOT\n" >> $LOGFILE 6747c478bd9Sstevel@tonic-gate cd $IA32_IHV_ROOT 6757c478bd9Sstevel@tonic-gate tar -cf - . | (cd $ROOT; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6767c478bd9Sstevel@tonic-gate else 6777c478bd9Sstevel@tonic-gate echo "$IA32_IHV_ROOT: not found" >> $LOGFILE 6787c478bd9Sstevel@tonic-gate fi 6794e5b757fSkupfer 6804e5b757fSkupfer if [ "$MULTI_PROTO" = yes ]; then 6814e5b757fSkupfer if [ ! -d "$ROOT-nd" ]; then 6824e5b757fSkupfer echo "mkdir -p $ROOT-nd" >> $LOGFILE 6834e5b757fSkupfer mkdir -p $ROOT-nd 6844e5b757fSkupfer fi 6854e5b757fSkupfer # If there's a non-debug version of the IHV proto area, 6864e5b757fSkupfer # copy it, but copy something if there's not. 6874e5b757fSkupfer if [ -d "$IA32_IHV_ROOT-nd" ]; then 6884e5b757fSkupfer echo "copying $IA32_IHV_ROOT-nd to $ROOT-nd\n" >> $LOGFILE 6894e5b757fSkupfer cd $IA32_IHV_ROOT-nd 6904e5b757fSkupfer elif [ -d "$IA32_IHV_ROOT" ]; then 6914e5b757fSkupfer echo "copying $IA32_IHV_ROOT to $ROOT-nd\n" >> $LOGFILE 6924e5b757fSkupfer cd $IA32_IHV_ROOT 6934e5b757fSkupfer else 6944e5b757fSkupfer echo "$IA32_IHV_ROOT{-nd,}: not found" >> $LOGFILE 6954e5b757fSkupfer return 6964e5b757fSkupfer fi 6974e5b757fSkupfer tar -cf - . | (cd $ROOT-nd; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6984e5b757fSkupfer fi 6997c478bd9Sstevel@tonic-gate} 7007c478bd9Sstevel@tonic-gate 7017c478bd9Sstevel@tonic-gate# Install IHV packages in PKGARCHIVE 7021fe69678Skupfer# usage: copy_ihv_pkgs LABEL SUFFIX 7037c478bd9Sstevel@tonic-gatecopy_ihv_pkgs() { 7047c478bd9Sstevel@tonic-gate LABEL=$1 7057c478bd9Sstevel@tonic-gate SUFFIX=$2 7067c478bd9Sstevel@tonic-gate # always use non-DEBUG IHV packages 7077c478bd9Sstevel@tonic-gate IA32_IHV_PKGS=${IA32_IHV_PKGS_ORIG}-nd 7087c478bd9Sstevel@tonic-gate PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX} 7097c478bd9Sstevel@tonic-gate 7107c478bd9Sstevel@tonic-gate echo "\n==== Installing IHV packages from $IA32_IHV_PKGS ($LABEL) ====\n" \ 7117c478bd9Sstevel@tonic-gate >> $LOGFILE 7127c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_PKGS" ]; then 7137c478bd9Sstevel@tonic-gate cd $IA32_IHV_PKGS 7147c478bd9Sstevel@tonic-gate tar -cf - * | \ 7157c478bd9Sstevel@tonic-gate (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 7167c478bd9Sstevel@tonic-gate else 7177c478bd9Sstevel@tonic-gate echo "$IA32_IHV_PKGS: not found" >> $LOGFILE 7187c478bd9Sstevel@tonic-gate fi 7197c478bd9Sstevel@tonic-gate 7207c478bd9Sstevel@tonic-gate echo "\n==== Installing IHV packages from $IA32_IHV_BINARY_PKGS ($LABEL) ====\n" \ 7217c478bd9Sstevel@tonic-gate >> $LOGFILE 7227c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_BINARY_PKGS" ]; then 7237c478bd9Sstevel@tonic-gate cd $IA32_IHV_BINARY_PKGS 7247c478bd9Sstevel@tonic-gate tar -cf - * | \ 7257c478bd9Sstevel@tonic-gate (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 7267c478bd9Sstevel@tonic-gate else 7277c478bd9Sstevel@tonic-gate echo "$IA32_IHV_BINARY_PKGS: not found" >> $LOGFILE 7287c478bd9Sstevel@tonic-gate fi 7297c478bd9Sstevel@tonic-gate} 7307c478bd9Sstevel@tonic-gate 7314e5b757fSkupfer# 7324e5b757fSkupfer# Build and install the onbld tools. 7334e5b757fSkupfer# 7341fe69678Skupfer# usage: build_tools DESTROOT 7354e5b757fSkupfer# 7364e5b757fSkupfer# returns non-zero status if the build was successful. 7374e5b757fSkupfer# 7387c478bd9Sstevel@tonic-gatebuild_tools() { 7397c478bd9Sstevel@tonic-gate DESTROOT=$1 7407c478bd9Sstevel@tonic-gate 7417c478bd9Sstevel@tonic-gate INSTALLOG=install-${MACH} 7427c478bd9Sstevel@tonic-gate 7437c478bd9Sstevel@tonic-gate echo "\n==== Building tools at `date` ====\n" \ 7447c478bd9Sstevel@tonic-gate >> $LOGFILE 7457c478bd9Sstevel@tonic-gate 7467c478bd9Sstevel@tonic-gate rm -f ${TOOLS}/${INSTALLOG}.out 7477c478bd9Sstevel@tonic-gate cd ${TOOLS} 7487c478bd9Sstevel@tonic-gate /bin/time $MAKE ROOT=${DESTROOT} -e install 2>&1 | \ 7497c478bd9Sstevel@tonic-gate tee -a ${TOOLS}/${INSTALLOG}.out >> $LOGFILE 7507c478bd9Sstevel@tonic-gate 7517c478bd9Sstevel@tonic-gate echo "\n==== Tools build errors ====\n" >> $mail_msg_file 7527c478bd9Sstevel@tonic-gate 7537c478bd9Sstevel@tonic-gate egrep ":" ${TOOLS}/${INSTALLOG}.out | 7547c478bd9Sstevel@tonic-gate egrep -e "(${MAKE}:|[ ]error[: \n])" | \ 7557c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 7567c478bd9Sstevel@tonic-gate egrep -v warning >> $mail_msg_file 7574e5b757fSkupfer return $? 7584e5b757fSkupfer} 7594e5b757fSkupfer 7604e5b757fSkupfer# 7614e5b757fSkupfer# Set up to use locally installed tools. 7624e5b757fSkupfer# 7634e5b757fSkupfer# usage: use_tools TOOLSROOT 7644e5b757fSkupfer# 7654e5b757fSkupferuse_tools() { 7664e5b757fSkupfer TOOLSROOT=$1 7674e5b757fSkupfer 7684e5b757fSkupfer STABS=${TOOLSROOT}/opt/onbld/bin/${MACH}/stabs 7697c478bd9Sstevel@tonic-gate export STABS 7704e5b757fSkupfer CTFSTABS=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfstabs 7717c478bd9Sstevel@tonic-gate export CTFSTABS 7724e5b757fSkupfer GENOFFSETS=${TOOLSROOT}/opt/onbld/bin/genoffsets 7737c478bd9Sstevel@tonic-gate export GENOFFSETS 7747c478bd9Sstevel@tonic-gate 7754e5b757fSkupfer CTFCONVERT=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfconvert 7767c478bd9Sstevel@tonic-gate export CTFCONVERT 7774e5b757fSkupfer CTFMERGE=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfmerge 7787c478bd9Sstevel@tonic-gate export CTFMERGE 7797c478bd9Sstevel@tonic-gate 7804e5b757fSkupfer CTFCVTPTBL=${TOOLSROOT}/opt/onbld/bin/ctfcvtptbl 7817c478bd9Sstevel@tonic-gate export CTFCVTPTBL 7824e5b757fSkupfer CTFFINDMOD=${TOOLSROOT}/opt/onbld/bin/ctffindmod 7837c478bd9Sstevel@tonic-gate export CTFFINDMOD 7847c478bd9Sstevel@tonic-gate 7857c478bd9Sstevel@tonic-gate if [ "$VERIFY_ELFSIGN" = "y" ]; then 7864e5b757fSkupfer ELFSIGN=${TOOLSROOT}/opt/onbld/bin/elfsigncmp 7877c478bd9Sstevel@tonic-gate else 7884e5b757fSkupfer ELFSIGN=${TOOLSROOT}/opt/onbld/bin/${MACH}/elfsign 7897c478bd9Sstevel@tonic-gate fi 7907c478bd9Sstevel@tonic-gate export ELFSIGN 7917c478bd9Sstevel@tonic-gate 7924e5b757fSkupfer PATH="${TOOLSROOT}/opt/onbld/bin/${MACH}:${PATH}" 7934e5b757fSkupfer PATH="${TOOLSROOT}/opt/onbld/bin:${PATH}" 7947c478bd9Sstevel@tonic-gate export PATH 7957c478bd9Sstevel@tonic-gate 7967c478bd9Sstevel@tonic-gate echo "\n==== New environment settings. ====\n" >> $LOGFILE 7977c478bd9Sstevel@tonic-gate echo "STABS=${STABS}" >> $LOGFILE 7987c478bd9Sstevel@tonic-gate echo "CTFSTABS=${CTFSTABS}" >> $LOGFILE 7997c478bd9Sstevel@tonic-gate echo "CTFCONVERT=${CTFCONVERT}" >> $LOGFILE 8007c478bd9Sstevel@tonic-gate echo "CTFMERGE=${CTFMERGE}" >> $LOGFILE 8017c478bd9Sstevel@tonic-gate echo "CTFCVTPTBL=${CTFCVTPTBL}" >> $LOGFILE 8027c478bd9Sstevel@tonic-gate echo "CTFFINDMOD=${CTFFINDMOD}" >> $LOGFILE 8037c478bd9Sstevel@tonic-gate echo "ELFSIGN=${ELFSIGN}" >> $LOGFILE 8047c478bd9Sstevel@tonic-gate echo "PATH=${PATH}" >> $LOGFILE 8057c478bd9Sstevel@tonic-gate} 8067c478bd9Sstevel@tonic-gate 8077c478bd9Sstevel@tonic-gatestaffer() { 8087c478bd9Sstevel@tonic-gate if [ $ISUSER -ne 0 ]; then 8097c478bd9Sstevel@tonic-gate "$@" 8107c478bd9Sstevel@tonic-gate else 8117c478bd9Sstevel@tonic-gate arg="\"$1\"" 8127c478bd9Sstevel@tonic-gate shift 8137c478bd9Sstevel@tonic-gate for i 8147c478bd9Sstevel@tonic-gate do 8157c478bd9Sstevel@tonic-gate arg="$arg \"$i\"" 8167c478bd9Sstevel@tonic-gate done 8177c478bd9Sstevel@tonic-gate eval su $STAFFER -c \'$arg\' 8187c478bd9Sstevel@tonic-gate fi 8197c478bd9Sstevel@tonic-gate} 8207c478bd9Sstevel@tonic-gate 821085d331dSkupfer# 822085d331dSkupfer# Verify that the closed tree is present if it needs to be. 823085d331dSkupfer# Sets CLOSED_IS_PRESENT for future use. 824085d331dSkupfer# 825085d331dSkupfercheck_closed_tree() { 826085d331dSkupfer if [ -z "$CLOSED_IS_PRESENT" ]; then 827085d331dSkupfer if [ -d $SRC/../closed ]; then 828085d331dSkupfer CLOSED_IS_PRESENT="yes" 829085d331dSkupfer else 830085d331dSkupfer CLOSED_IS_PRESENT="no" 831085d331dSkupfer fi 832085d331dSkupfer export CLOSED_IS_PRESENT 833085d331dSkupfer fi 834085d331dSkupfer if [[ "$CLOSED_IS_PRESENT" = no && ! -d "$ON_CLOSED_BINS" ]]; then 835085d331dSkupfer # 836085d331dSkupfer # If it's an old (pre-split) tree or an empty 837085d331dSkupfer # workspace, don't complain. 838085d331dSkupfer # 839085d331dSkupfer if grep -s CLOSED_BUILD $SRC/Makefile.master > /dev/null; then 840085d331dSkupfer echo "If the closed sources are not present," \ 841085d331dSkupfer "ON_CLOSED_BINS" 842085d331dSkupfer echo "must point to the closed binaries tree." 843085d331dSkupfer exit 1 844085d331dSkupfer fi 845085d331dSkupfer fi 846085d331dSkupfer} 8477c478bd9Sstevel@tonic-gate 848d77e7149Ssommerfeobsolete_build() { 849d77e7149Ssommerfe echo "WARNING: Obsolete $1 build requested; request will be ignored" 850d77e7149Ssommerfe} 851d77e7149Ssommerfe 8524e5b757fSkupfer# 8534e5b757fSkupfer# wrapper over wsdiff. 8544e5b757fSkupfer# usage: do_wsdiff LABEL OLDPROTO NEWPROTO 8554e5b757fSkupfer# 8564e5b757fSkupferdo_wsdiff() { 8574e5b757fSkupfer label=$1 8584e5b757fSkupfer oldproto=$2 8594e5b757fSkupfer newproto=$3 8604e5b757fSkupfer 8614e5b757fSkupfer echo "\n==== Objects that differ since last build ($label) ====\n" | \ 8624e5b757fSkupfer tee -a $LOGFILE >> $mail_msg_file 8634e5b757fSkupfer 8644e5b757fSkupfer wsdiff="wsdiff" 8654e5b757fSkupfer [ "$t_FLAG" = y ] && wsdiff="wsdiff -t" 8664e5b757fSkupfer 8674e5b757fSkupfer $wsdiff -r ${TMPDIR}/wsdiff.results $oldproto $newproto 2>&1 | \ 8684e5b757fSkupfer tee -a $LOGFILE >> $mail_msg_file 8694e5b757fSkupfer} 8704e5b757fSkupfer 8714e5b757fSkupfer# 8724e5b757fSkupfer# Functions for setting build flags (debug/non-debug). Keep them 8734e5b757fSkupfer# together. 8744e5b757fSkupfer# 8754e5b757fSkupfer 8764e5b757fSkupferset_non_debug_build_flags() { 8774e5b757fSkupfer export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 8784e5b757fSkupfer export RELEASE_BUILD ; RELEASE_BUILD= 8794e5b757fSkupfer unset EXTRA_OPTIONS 8804e5b757fSkupfer unset EXTRA_CFLAGS 8814e5b757fSkupfer} 8824e5b757fSkupfer 8834e5b757fSkupferset_debug_build_flags() { 8844e5b757fSkupfer export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 8854e5b757fSkupfer unset RELEASE_BUILD 8864e5b757fSkupfer unset EXTRA_OPTIONS 8874e5b757fSkupfer unset EXTRA_CFLAGS 8884e5b757fSkupfer} 8894e5b757fSkupfer 890d77e7149Ssommerfe 8917c478bd9Sstevel@tonic-gateMACH=`uname -p` 8927c478bd9Sstevel@tonic-gate 8937c478bd9Sstevel@tonic-gateif [ "$OPTHOME" = "" ]; then 8947c478bd9Sstevel@tonic-gate OPTHOME=/opt 8957c478bd9Sstevel@tonic-gate export OPTHOME 8967c478bd9Sstevel@tonic-gatefi 8977c478bd9Sstevel@tonic-gateif [ "$TEAMWARE" = "" ]; then 8987c478bd9Sstevel@tonic-gate TEAMWARE=$OPTHOME/teamware 8997c478bd9Sstevel@tonic-gate export TEAMWARE 9007c478bd9Sstevel@tonic-gatefi 9017c478bd9Sstevel@tonic-gate 9021fe69678SkupferUSAGE='Usage: nightly [-in] [-V VERS ] [ -S E|D|H|O ] <env_file> 9037c478bd9Sstevel@tonic-gate 9047c478bd9Sstevel@tonic-gateWhere: 905d77e7149Ssommerfe -i Fast incremental options (no clobber, lint, check) 9067c478bd9Sstevel@tonic-gate -n Do not do a bringover 9077c478bd9Sstevel@tonic-gate -V VERS set the build version string to VERS 9087c478bd9Sstevel@tonic-gate -S Build a variant of the source product 9097c478bd9Sstevel@tonic-gate E - build exportable source 9107c478bd9Sstevel@tonic-gate D - build domestic source (exportable + crypt) 9117c478bd9Sstevel@tonic-gate H - build hybrid source (binaries + deleted source) 9121fe69678Skupfer O - build (only) open source 9137c478bd9Sstevel@tonic-gate 9147c478bd9Sstevel@tonic-gate <env_file> file in Bourne shell syntax that sets and exports 9157c478bd9Sstevel@tonic-gate variables that configure the operation of this script and many of 9167c478bd9Sstevel@tonic-gate the scripts this one calls. If <env_file> does not exist, 9177c478bd9Sstevel@tonic-gate it will be looked for in $OPTHOME/onbld/env. 9187c478bd9Sstevel@tonic-gate 9197c478bd9Sstevel@tonic-gatenon-DEBUG is the default build type. Build options can be set in the 9207c478bd9Sstevel@tonic-gateNIGHTLY_OPTIONS variable in the <env_file> as follows: 9217c478bd9Sstevel@tonic-gate 9227c478bd9Sstevel@tonic-gate -A check for ABI differences in .so files 9237c478bd9Sstevel@tonic-gate -C check for cstyle/hdrchk errors 9247c478bd9Sstevel@tonic-gate -D do a build with DEBUG on 9257c478bd9Sstevel@tonic-gate -F do _not_ do a non-DEBUG build 9267c478bd9Sstevel@tonic-gate -G gate keeper default group of options (-au) 9277c478bd9Sstevel@tonic-gate -I integration engineer default group of options (-ampu) 9287c478bd9Sstevel@tonic-gate -M do not run pmodes (safe file permission checker) 9297c478bd9Sstevel@tonic-gate -N do not run protocmp 9304e5b757fSkupfer -O generate OpenSolaris deliverables 9317c478bd9Sstevel@tonic-gate -R default group of options for building a release (-mp) 9327c478bd9Sstevel@tonic-gate -U update proto area in the parent 9337c478bd9Sstevel@tonic-gate -V VERS set the build version string to VERS 93404a42e3eSszhou -X copy x86 IHV proto area 9357c478bd9Sstevel@tonic-gate -a create cpio archives 9367c478bd9Sstevel@tonic-gate -f find unreferenced files 9377c478bd9Sstevel@tonic-gate -i do an incremental build (no "make clobber") 9387c478bd9Sstevel@tonic-gate -l do "make lint" in $LINTDIRS (default: $SRC y) 9397c478bd9Sstevel@tonic-gate -m send mail to $MAILTO at end of build 9407c478bd9Sstevel@tonic-gate -n do not do a bringover 9417c478bd9Sstevel@tonic-gate -o build using root privileges to set OWNER/GROUP (old style) 9427c478bd9Sstevel@tonic-gate -p create packages 9437c478bd9Sstevel@tonic-gate -r check ELF runtime attributes in the proto area 9447c478bd9Sstevel@tonic-gate -t build and use the tools in $SRC/tools 9457c478bd9Sstevel@tonic-gate -u update proto_list_$MACH and friends in the parent workspace; 9467c478bd9Sstevel@tonic-gate when used with -f, also build an unrefmaster.out in the parent 94796ccc8cbSesaxe -w report on differences between previous and current proto areas 9487c478bd9Sstevel@tonic-gate -z compress cpio archives with gzip 9497c478bd9Sstevel@tonic-gate -W Do not report warnings (freeware gate ONLY) 9507c478bd9Sstevel@tonic-gate -S Build a variant of the source product 9517c478bd9Sstevel@tonic-gate E - build exportable source 9527c478bd9Sstevel@tonic-gate D - build domestic source (exportable + crypt) 9537c478bd9Sstevel@tonic-gate H - build hybrid source (binaries + deleted source) 9541fe69678Skupfer O - build (only) open source 9557c478bd9Sstevel@tonic-gate' 9567c478bd9Sstevel@tonic-gate# 9577c478bd9Sstevel@tonic-gate# -x less public handling of xmod source for the source product 9587c478bd9Sstevel@tonic-gate# 9597c478bd9Sstevel@tonic-gate# A log file will be generated under the name $LOGFILE 9601c79753fSdarrenm# for partially completed build and log.`date '+%F'` 9617c478bd9Sstevel@tonic-gate# in the same directory for fully completed builds. 9627c478bd9Sstevel@tonic-gate# 9637c478bd9Sstevel@tonic-gate 9647c478bd9Sstevel@tonic-gate# default values for low-level FLAGS; G I R are group FLAGS 9657c478bd9Sstevel@tonic-gateA_FLAG=n 9667c478bd9Sstevel@tonic-gatea_FLAG=n 9677c478bd9Sstevel@tonic-gateC_FLAG=n 9686c3c9007SstevelD_FLAG=n 9697c478bd9Sstevel@tonic-gateF_FLAG=n 9707c478bd9Sstevel@tonic-gatef_FLAG=n 9717c478bd9Sstevel@tonic-gatei_FLAG=n; i_CMD_LINE_FLAG=n 9727c478bd9Sstevel@tonic-gatel_FLAG=n 9736c3c9007SstevelM_FLAG=n 9747c478bd9Sstevel@tonic-gatem_FLAG=n 9756c3c9007SstevelN_FLAG=n 9766c3c9007Ssteveln_FLAG=n 9774e5b757fSkupferO_FLAG=n 9786c3c9007Sstevelo_FLAG=n 9796c3c9007SstevelP_FLAG=n 9807c478bd9Sstevel@tonic-gatep_FLAG=n 9817c478bd9Sstevel@tonic-gater_FLAG=n 9826c3c9007SstevelT_FLAG=n 9837c478bd9Sstevel@tonic-gatet_FLAG=n 9847c478bd9Sstevel@tonic-gateU_FLAG=n 9856c3c9007Sstevelu_FLAG=n 9867c478bd9Sstevel@tonic-gateV_FLAG=n 9877c478bd9Sstevel@tonic-gateW_FLAG=n 9886c3c9007Sstevelw_FLAG=n 9896c3c9007SstevelX_FLAG=n 9906c3c9007Sstevelz_FLAG=n 9917c478bd9Sstevel@tonic-gateSD_FLAG=n 9926c3c9007SstevelSE_FLAG=n 9937c478bd9Sstevel@tonic-gateSH_FLAG=n 9941fe69678SkupferSO_FLAG=n 9957c478bd9Sstevel@tonic-gate# 9967c478bd9Sstevel@tonic-gateXMOD_OPT= 9977c478bd9Sstevel@tonic-gate# 9987c478bd9Sstevel@tonic-gatebuild_ok=y 9991fe69678Skupfer 10001fe69678Skupferis_source_build() { 10011fe69678Skupfer [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o \ 10021fe69678Skupfer "$SH_FLAG" = "y" -o "$SO_FLAG" = "y" ] 10031fe69678Skupfer return $? 10041fe69678Skupfer} 10051fe69678Skupfer 10067c478bd9Sstevel@tonic-gate# 10077c478bd9Sstevel@tonic-gate# examine arguments 10087c478bd9Sstevel@tonic-gate# 10097c478bd9Sstevel@tonic-gate 10101fe69678Skupfer# 10111fe69678Skupfer# single function for setting -S flag and doing error checking. 10121fe69678Skupfer# usage: set_S_flag <type> 10131fe69678Skupfer# where <type> is the source build type ("E", "D", ...). 10141fe69678Skupfer# 10151fe69678Skupferset_S_flag() { 10161fe69678Skupfer if is_source_build; then 10171fe69678Skupfer echo "Can only build one source variant at a time." 10181fe69678Skupfer exit 1 10191fe69678Skupfer fi 10201fe69678Skupfer if [ "$1" = "E" ]; then 10211fe69678Skupfer SE_FLAG=y 10221fe69678Skupfer elif [ "$1" = "D" ]; then 10231fe69678Skupfer SD_FLAG=y 10241fe69678Skupfer elif [ "$1" = "H" ]; then 10251fe69678Skupfer SH_FLAG=y 10261fe69678Skupfer elif [ "$1" = "O" ]; then 10271fe69678Skupfer SO_FLAG=y 10281fe69678Skupfer else 10291fe69678Skupfer echo "$USAGE" 10301fe69678Skupfer exit 1 10311fe69678Skupfer fi 10321fe69678Skupfer} 10331fe69678Skupfer 10347c478bd9Sstevel@tonic-gateOPTIND=1 10356c3c9007Sstevelwhile getopts inS:tV: FLAG 10367c478bd9Sstevel@tonic-gatedo 10377c478bd9Sstevel@tonic-gate case $FLAG in 10387c478bd9Sstevel@tonic-gate i ) i_FLAG=y; i_CMD_LINE_FLAG=y 10397c478bd9Sstevel@tonic-gate ;; 10407c478bd9Sstevel@tonic-gate n ) n_FLAG=y 10417c478bd9Sstevel@tonic-gate ;; 10427c478bd9Sstevel@tonic-gate S ) 10431fe69678Skupfer set_S_flag $OPTARG 10447c478bd9Sstevel@tonic-gate ;; 10457c478bd9Sstevel@tonic-gate t ) t_FLAG=y 10467c478bd9Sstevel@tonic-gate ;; 10476c3c9007Sstevel V ) V_FLAG=y 10486c3c9007Sstevel V_ARG="$OPTARG" 10496c3c9007Sstevel ;; 10507c478bd9Sstevel@tonic-gate \? ) echo "$USAGE" 10517c478bd9Sstevel@tonic-gate exit 1 10527c478bd9Sstevel@tonic-gate ;; 10537c478bd9Sstevel@tonic-gate esac 10547c478bd9Sstevel@tonic-gatedone 10557c478bd9Sstevel@tonic-gate 10567c478bd9Sstevel@tonic-gate# correct argument count after options 10577c478bd9Sstevel@tonic-gateshift `expr $OPTIND - 1` 10587c478bd9Sstevel@tonic-gate 10597c478bd9Sstevel@tonic-gate# test that the path to the environment-setting file was given 10607c478bd9Sstevel@tonic-gateif [ $# -ne 1 ]; then 10617c478bd9Sstevel@tonic-gate echo "$USAGE" 10627c478bd9Sstevel@tonic-gate exit 1 10637c478bd9Sstevel@tonic-gatefi 10647c478bd9Sstevel@tonic-gate 10657c478bd9Sstevel@tonic-gate# check if user is running nightly as root 10667c478bd9Sstevel@tonic-gate# ISUSER is set non-zero if an ordinary user runs nightly, or is zero 10677c478bd9Sstevel@tonic-gate# when root invokes nightly. 10687c478bd9Sstevel@tonic-gate/usr/bin/id | grep '^uid=0(' >/dev/null 2>&1 10697c478bd9Sstevel@tonic-gateISUSER=$?; export ISUSER 10707c478bd9Sstevel@tonic-gate 10717c478bd9Sstevel@tonic-gate# 10727c478bd9Sstevel@tonic-gate# force locale to C 10737c478bd9Sstevel@tonic-gateLC_COLLATE=C; export LC_COLLATE 10747c478bd9Sstevel@tonic-gateLC_CTYPE=C; export LC_CTYPE 10757c478bd9Sstevel@tonic-gateLC_MESSAGES=C; export LC_MESSAGES 10767c478bd9Sstevel@tonic-gateLC_MONETARY=C; export LC_MONETARY 10777c478bd9Sstevel@tonic-gateLC_NUMERIC=C; export LC_NUMERIC 10787c478bd9Sstevel@tonic-gateLC_TIME=C; export LC_TIME 10797c478bd9Sstevel@tonic-gate 10807c478bd9Sstevel@tonic-gate# clear environment variables we know to be bad for the build 10817c478bd9Sstevel@tonic-gateunset LD_OPTIONS 10827c478bd9Sstevel@tonic-gateunset LD_AUDIT LD_AUDIT_32 LD_AUDIT_64 10837c478bd9Sstevel@tonic-gateunset LD_BIND_NOW LD_BIND_NOW_32 LD_BIND_NOW_64 10847c478bd9Sstevel@tonic-gateunset LD_BREADTH LD_BREADTH_32 LD_BREADTH_64 10857c478bd9Sstevel@tonic-gateunset LD_CONFIG LD_CONFIG_32 LD_CONFIG_64 10867c478bd9Sstevel@tonic-gateunset LD_DEBUG LD_DEBUG_32 LD_DEBUG_64 10877c478bd9Sstevel@tonic-gateunset LD_DEMANGLE LD_DEMANGLE_32 LD_DEMANGLE_64 10887c478bd9Sstevel@tonic-gateunset LD_FLAGS LD_FLAGS_32 LD_FLAGS_64 10897c478bd9Sstevel@tonic-gateunset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 10907c478bd9Sstevel@tonic-gateunset LD_LOADFLTR LD_LOADFLTR_32 LD_LOADFLTR_64 10917c478bd9Sstevel@tonic-gateunset LD_NOAUDIT LD_NOAUDIT_32 LD_NOAUDIT_64 10927c478bd9Sstevel@tonic-gateunset LD_NOAUXFLTR LD_NOAUXFLTR_32 LD_NOAUXFLTR_64 10937c478bd9Sstevel@tonic-gateunset LD_NOCONFIG LD_NOCONFIG_32 LD_NOCONFIG_64 10947c478bd9Sstevel@tonic-gateunset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64 10957c478bd9Sstevel@tonic-gateunset LD_NODIRECT LD_NODIRECT_32 LD_NODIRECT_64 10967c478bd9Sstevel@tonic-gateunset LD_NOLAZYLOAD LD_NOLAZYLOAD_32 LD_NOLAZYLOAD_64 10977c478bd9Sstevel@tonic-gateunset LD_NOOBJALTER LD_NOOBJALTER_32 LD_NOOBJALTER_64 10987c478bd9Sstevel@tonic-gateunset LD_NOVERSION LD_NOVERSION_32 LD_NOVERSION_64 10997c478bd9Sstevel@tonic-gateunset LD_ORIGIN LD_ORIGIN_32 LD_ORIGIN_64 11007c478bd9Sstevel@tonic-gateunset LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64 11017c478bd9Sstevel@tonic-gateunset LD_PROFILE LD_PROFILE_32 LD_PROFILE_64 11027c478bd9Sstevel@tonic-gate 11037c478bd9Sstevel@tonic-gateunset CONFIG 11047c478bd9Sstevel@tonic-gateunset GROUP 11057c478bd9Sstevel@tonic-gateunset OWNER 11067c478bd9Sstevel@tonic-gateunset REMOTE 11077c478bd9Sstevel@tonic-gateunset ENV 11087c478bd9Sstevel@tonic-gateunset ARCH 11097c478bd9Sstevel@tonic-gateunset CLASSPATH 11107c478bd9Sstevel@tonic-gateunset NAME 11117c478bd9Sstevel@tonic-gate 11127c478bd9Sstevel@tonic-gate# 11137c478bd9Sstevel@tonic-gate# Setup environmental variables 11147c478bd9Sstevel@tonic-gate# 11157c478bd9Sstevel@tonic-gateif [ -f $1 ]; then 11167c478bd9Sstevel@tonic-gate if [[ $1 = */* ]]; then 11177c478bd9Sstevel@tonic-gate . $1 11187c478bd9Sstevel@tonic-gate else 11197c478bd9Sstevel@tonic-gate . ./$1 11207c478bd9Sstevel@tonic-gate fi 11217c478bd9Sstevel@tonic-gateelse 11227c478bd9Sstevel@tonic-gate if [ -f $OPTHOME/onbld/env/$1 ]; then 11237c478bd9Sstevel@tonic-gate . $OPTHOME/onbld/env/$1 11247c478bd9Sstevel@tonic-gate else 11257c478bd9Sstevel@tonic-gate echo "Cannot find env file as either $1 or $OPTHOME/onbld/env/$1" 11267c478bd9Sstevel@tonic-gate exit 1 11277c478bd9Sstevel@tonic-gate fi 11287c478bd9Sstevel@tonic-gatefi 11297c478bd9Sstevel@tonic-gate 11301fe69678Skupfer# contents of stdenv.sh inserted after next line: 11311fe69678Skupfer# STDENV_START 11321fe69678Skupfer# STDENV_END 11331fe69678Skupfer 11347c478bd9Sstevel@tonic-gate# 11357c478bd9Sstevel@tonic-gate# place ourselves in a new task, respecting BUILD_PROJECT if set. 11367c478bd9Sstevel@tonic-gate# 11377c478bd9Sstevel@tonic-gateif [ -z "$BUILD_PROJECT" ]; then 11387c478bd9Sstevel@tonic-gate /usr/bin/newtask -c $$ 11397c478bd9Sstevel@tonic-gateelse 11407c478bd9Sstevel@tonic-gate /usr/bin/newtask -c $$ -p $BUILD_PROJECT 11417c478bd9Sstevel@tonic-gatefi 11427c478bd9Sstevel@tonic-gate 11437c478bd9Sstevel@tonic-gateps -o taskid= -p $$ | read build_taskid 11447c478bd9Sstevel@tonic-gateps -o project= -p $$ | read build_project 11457c478bd9Sstevel@tonic-gate 11467c478bd9Sstevel@tonic-gate# 11477c478bd9Sstevel@tonic-gate# See if NIGHTLY_OPTIONS is set 11487c478bd9Sstevel@tonic-gate# 11497c478bd9Sstevel@tonic-gateif [ "$NIGHTLY_OPTIONS" = "" ]; then 11507c478bd9Sstevel@tonic-gate NIGHTLY_OPTIONS="-aBm" 11517c478bd9Sstevel@tonic-gatefi 11527c478bd9Sstevel@tonic-gate 11537c478bd9Sstevel@tonic-gate# 11547c478bd9Sstevel@tonic-gate# If BRINGOVER_WS was not specified, let it default to CLONE_WS 11557c478bd9Sstevel@tonic-gate# 11567c478bd9Sstevel@tonic-gateif [ "$BRINGOVER_WS" = "" ]; then 11577c478bd9Sstevel@tonic-gate BRINGOVER_WS=$CLONE_WS 11587c478bd9Sstevel@tonic-gatefi 11597c478bd9Sstevel@tonic-gate 11607c478bd9Sstevel@tonic-gate# 1161fb23a357Skupfer# If BRINGOVER_FILES was not specified, default to usr 1162a5c06a9eSmike_s# 1163a5c06a9eSmike_sif [ "$BRINGOVER_FILES" = "" ]; then 1164fb23a357Skupfer BRINGOVER_FILES="usr" 1165a5c06a9eSmike_sfi 1166a5c06a9eSmike_s 1167fb9f9b97Skupfer# 1168fb9f9b97Skupfer# If the closed sources are not present, the closed binaries must be 1169fb9f9b97Skupfer# present for the build to succeed. If there's no pointer to the 1170fb9f9b97Skupfer# closed binaries, flag that now, rather than forcing the user to wait 1171fb9f9b97Skupfer# a couple hours (or more) to find out. 1172fb9f9b97Skupfer# 1173085d331dSkupferorig_closed_is_present="$CLOSED_IS_PRESENT" 1174085d331dSkupfercheck_closed_tree 1175fb9f9b97Skupfer 1176a5c06a9eSmike_s# 11777c478bd9Sstevel@tonic-gate# Note: changes to the option letters here should also be applied to the 1178b84bdc30Smeem# bldenv script. `d' is listed for backward compatibility. 11797c478bd9Sstevel@tonic-gate# 1180d77e7149SsommerfeNIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-} 11817c478bd9Sstevel@tonic-gateOPTIND=1 11824e5b757fSkupferwhile getopts AaBCDdFfGIilMmNnOoPpRrS:TtUuWwXxz FLAG $NIGHTLY_OPTIONS 11837c478bd9Sstevel@tonic-gatedo 11847c478bd9Sstevel@tonic-gate case $FLAG in 11857c478bd9Sstevel@tonic-gate A ) A_FLAG=y 11867c478bd9Sstevel@tonic-gate ;; 11876c3c9007Sstevel a ) a_FLAG=y 11886c3c9007Sstevel ;; 11897c478bd9Sstevel@tonic-gate B ) D_FLAG=y 11907c478bd9Sstevel@tonic-gate ;; # old version of D 11916c3c9007Sstevel C ) C_FLAG=y 11927c478bd9Sstevel@tonic-gate ;; 11937c478bd9Sstevel@tonic-gate D ) D_FLAG=y 11947c478bd9Sstevel@tonic-gate ;; 11956c3c9007Sstevel F ) F_FLAG=y 11967c478bd9Sstevel@tonic-gate ;; 11976c3c9007Sstevel f ) f_FLAG=y 11987c478bd9Sstevel@tonic-gate ;; 11997c478bd9Sstevel@tonic-gate G ) a_FLAG=y 12007c478bd9Sstevel@tonic-gate u_FLAG=y 12017c478bd9Sstevel@tonic-gate ;; 12027c478bd9Sstevel@tonic-gate I ) a_FLAG=y 12037c478bd9Sstevel@tonic-gate m_FLAG=y 12047c478bd9Sstevel@tonic-gate p_FLAG=y 12057c478bd9Sstevel@tonic-gate u_FLAG=y 12067c478bd9Sstevel@tonic-gate ;; 12077c478bd9Sstevel@tonic-gate i ) i_FLAG=y 12087c478bd9Sstevel@tonic-gate ;; 12096c3c9007Sstevel l ) l_FLAG=y 12106c3c9007Sstevel ;; 12116c3c9007Sstevel M ) M_FLAG=y 12126c3c9007Sstevel ;; 12136c3c9007Sstevel m ) m_FLAG=y 12146c3c9007Sstevel ;; 12156c3c9007Sstevel N ) N_FLAG=y 12166c3c9007Sstevel ;; 12177c478bd9Sstevel@tonic-gate n ) n_FLAG=y 12187c478bd9Sstevel@tonic-gate ;; 12194e5b757fSkupfer O ) O_FLAG=y 12204e5b757fSkupfer ;; 12217c478bd9Sstevel@tonic-gate o ) o_FLAG=y 12227c478bd9Sstevel@tonic-gate ;; 12236c3c9007Sstevel P ) P_FLAG=y 12246c3c9007Sstevel ;; # obsolete 12257c478bd9Sstevel@tonic-gate p ) p_FLAG=y 12267c478bd9Sstevel@tonic-gate ;; 12276c3c9007Sstevel R ) m_FLAG=y 12286c3c9007Sstevel p_FLAG=y 12296c3c9007Sstevel ;; 12307c478bd9Sstevel@tonic-gate r ) r_FLAG=y 12317c478bd9Sstevel@tonic-gate ;; 12326c3c9007Sstevel S ) 12336c3c9007Sstevel set_S_flag $OPTARG 12346c3c9007Sstevel ;; 12356c3c9007Sstevel T ) T_FLAG=y 12366c3c9007Sstevel ;; # obsolete 12377c478bd9Sstevel@tonic-gate t ) t_FLAG=y 12387c478bd9Sstevel@tonic-gate ;; 12397c478bd9Sstevel@tonic-gate U ) 12407c478bd9Sstevel@tonic-gate if [ -z "${PARENT_ROOT}" ]; then 12417c478bd9Sstevel@tonic-gate echo "PARENT_ROOT must be set if the U flag is" \ 12427c478bd9Sstevel@tonic-gate "present in NIGHTLY_OPTIONS." 12437c478bd9Sstevel@tonic-gate exit 1 12447c478bd9Sstevel@tonic-gate fi 12457c478bd9Sstevel@tonic-gate U_FLAG=y 12467c478bd9Sstevel@tonic-gate NIGHTLY_PARENT_ROOT=$PARENT_ROOT 12477c478bd9Sstevel@tonic-gate ;; 12486c3c9007Sstevel u ) u_FLAG=y 12497c478bd9Sstevel@tonic-gate ;; 12507c478bd9Sstevel@tonic-gate W ) W_FLAG=y 12517c478bd9Sstevel@tonic-gate ;; 12526c3c9007Sstevel 12536c3c9007Sstevel w ) w_FLAG=y 12547c478bd9Sstevel@tonic-gate ;; 12557c478bd9Sstevel@tonic-gate X ) # now that we no longer need realmode builds, just 12567c478bd9Sstevel@tonic-gate # copy IHV packages. only meaningful on x86. 12577c478bd9Sstevel@tonic-gate if [ "$MACH" = "i386" ]; then 12587c478bd9Sstevel@tonic-gate X_FLAG=y 12597c478bd9Sstevel@tonic-gate fi 12607c478bd9Sstevel@tonic-gate ;; 12616c3c9007Sstevel x ) XMOD_OPT="-x" 12626c3c9007Sstevel ;; 12636c3c9007Sstevel z ) z_FLAG=y 12646c3c9007Sstevel ;; 12657c478bd9Sstevel@tonic-gate \? ) echo "$USAGE" 12667c478bd9Sstevel@tonic-gate exit 1 12677c478bd9Sstevel@tonic-gate ;; 12687c478bd9Sstevel@tonic-gate esac 12697c478bd9Sstevel@tonic-gatedone 12707c478bd9Sstevel@tonic-gate 12717c478bd9Sstevel@tonic-gateif [ $ISUSER -ne 0 ]; then 12727c478bd9Sstevel@tonic-gate if [ "$o_FLAG" = "y" ]; then 12737c478bd9Sstevel@tonic-gate echo "Old-style build requires root permission." 12747c478bd9Sstevel@tonic-gate exit 1 12757c478bd9Sstevel@tonic-gate fi 12767c478bd9Sstevel@tonic-gate 12777c478bd9Sstevel@tonic-gate # Set default value for STAFFER, if needed. 12787c478bd9Sstevel@tonic-gate if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then 12797c478bd9Sstevel@tonic-gate STAFFER=`/usr/xpg4/bin/id -un` 12807c478bd9Sstevel@tonic-gate export STAFFER 12817c478bd9Sstevel@tonic-gate fi 12827c478bd9Sstevel@tonic-gatefi 12837c478bd9Sstevel@tonic-gate 12847c478bd9Sstevel@tonic-gateif [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then 12857c478bd9Sstevel@tonic-gate MAILTO=$STAFFER 12867c478bd9Sstevel@tonic-gate export MAILTO 12877c478bd9Sstevel@tonic-gatefi 12887c478bd9Sstevel@tonic-gate 12897c478bd9Sstevel@tonic-gatePATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin" 12907c478bd9Sstevel@tonic-gatePATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb" 12917c478bd9Sstevel@tonic-gatePATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:." 12927c478bd9Sstevel@tonic-gateexport PATH 12937c478bd9Sstevel@tonic-gate 1294fb23a357Skupfer# roots of source trees, both relative to $SRC and absolute. 1295fb23a357Skupferrelsrcdirs="." 1296fb9f9b97Skupferif [[ -d $SRC/../closed && "$CLOSED_IS_PRESENT" != no ]]; then 1297fb9f9b97Skupfer relsrcdirs="$relsrcdirs ../closed" 1298fb9f9b97Skupferfi 1299fb23a357Skupferabssrcdirs="" 1300fb23a357Skupferfor d in $relsrcdirs; do 1301fb23a357Skupfer abssrcdirs="$abssrcdirs $SRC/$d" 1302fb23a357Skupferdone 1303fb23a357Skupfer 13047c478bd9Sstevel@tonic-gateunset CH 13057c478bd9Sstevel@tonic-gateif [ "$o_FLAG" = "y" ]; then 13067c478bd9Sstevel@tonic-gate# root invoked old-style build -- make sure it works as it always has 13077c478bd9Sstevel@tonic-gate# by exporting 'CH'. The current Makefile.master doesn't use this, but 13087c478bd9Sstevel@tonic-gate# the old ones still do. 13097c478bd9Sstevel@tonic-gate PROTOCMPTERSE="protocmp.terse" 13107c478bd9Sstevel@tonic-gate CH= 13117c478bd9Sstevel@tonic-gate export CH 13127c478bd9Sstevel@tonic-gateelse 13137c478bd9Sstevel@tonic-gate PROTOCMPTERSE="protocmp.terse -gu" 13147c478bd9Sstevel@tonic-gatefi 13157c478bd9Sstevel@tonic-gatePOUND_SIGN="#" 13167c478bd9Sstevel@tonic-gate 13177c478bd9Sstevel@tonic-gate# we export POUND_SIGN to speed up the build process -- prevents evaluation of 13187c478bd9Sstevel@tonic-gate# the Makefile.master definitions. 13196fec3625Sdduvallexport o_FLAG X_FLAG POUND_SIGN 13207c478bd9Sstevel@tonic-gate 13217c478bd9Sstevel@tonic-gatemaketype="distributed" 13227c478bd9Sstevel@tonic-gateMAKE=dmake 13237c478bd9Sstevel@tonic-gate# get the dmake version string alone 13247c478bd9Sstevel@tonic-gateDMAKE_VERSION=$( $MAKE -v ) 13257c478bd9Sstevel@tonic-gateDMAKE_VERSION=${DMAKE_VERSION#*: } 13267c478bd9Sstevel@tonic-gate# focus in on just the dotted version number alone 13277c478bd9Sstevel@tonic-gateDMAKE_MAJOR=$( echo $DMAKE_VERSION | \ 13287c478bd9Sstevel@tonic-gate sed -e 's/.*\<\([^.]*\.[^ ]*\).*$/\1/' ) 13297c478bd9Sstevel@tonic-gate# extract the second (or final) integer 13307c478bd9Sstevel@tonic-gateDMAKE_MINOR=${DMAKE_MAJOR#*.} 13317c478bd9Sstevel@tonic-gateDMAKE_MINOR=${DMAKE_MINOR%%.*} 13327c478bd9Sstevel@tonic-gate# extract the first integer 13337c478bd9Sstevel@tonic-gateDMAKE_MAJOR=${DMAKE_MAJOR%%.*} 13347c478bd9Sstevel@tonic-gateCHECK_DMAKE=${CHECK_DMAKE:-y} 13357c478bd9Sstevel@tonic-gate# x86 was built on the 12th, sparc on the 13th. 13367c478bd9Sstevel@tonic-gateif [ "$CHECK_DMAKE" = "y" -a \ 13377c478bd9Sstevel@tonic-gate "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \ 13387c478bd9Sstevel@tonic-gate "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \( \ 13397c478bd9Sstevel@tonic-gate "$DMAKE_MAJOR" -lt 7 -o \ 13407c478bd9Sstevel@tonic-gate "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \) ]; then 13417c478bd9Sstevel@tonic-gate if [ -z "$DMAKE_VERSION" ]; then 13427c478bd9Sstevel@tonic-gate echo "$MAKE is missing." 13437c478bd9Sstevel@tonic-gate exit 1 13447c478bd9Sstevel@tonic-gate fi 13457c478bd9Sstevel@tonic-gate echo `whence $MAKE`" version is:" 13467c478bd9Sstevel@tonic-gate echo " ${DMAKE_VERSION}" 13477c478bd9Sstevel@tonic-gate cat <<EOF 13487c478bd9Sstevel@tonic-gate 13497c478bd9Sstevel@tonic-gateThis version may not be safe for use. Either set TEAMWARE to a better 13507c478bd9Sstevel@tonic-gatepath or (if you really want to use this version of dmake anyway), add 13517c478bd9Sstevel@tonic-gatethe following to your environment to disable this check: 13527c478bd9Sstevel@tonic-gate 13537c478bd9Sstevel@tonic-gate CHECK_DMAKE=n 13547c478bd9Sstevel@tonic-gateEOF 13557c478bd9Sstevel@tonic-gate exit 1 13567c478bd9Sstevel@tonic-gatefi 13577c478bd9Sstevel@tonic-gateexport PATH 13587c478bd9Sstevel@tonic-gateexport MAKE 13597c478bd9Sstevel@tonic-gate 13607c478bd9Sstevel@tonic-gateif [ "${SUNWSPRO}" != "" ]; then 13617c478bd9Sstevel@tonic-gate PATH="${SUNWSPRO}/bin:$PATH" 13627c478bd9Sstevel@tonic-gate export PATH 13637c478bd9Sstevel@tonic-gatefi 13647c478bd9Sstevel@tonic-gate 13657c478bd9Sstevel@tonic-gatehostname=`uname -n` 13667c478bd9Sstevel@tonic-gateif [ ! -f $HOME/.make.machines ]; then 13677c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS=4 13687c478bd9Sstevel@tonic-gateelse 13697c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS="`grep $hostname $HOME/.make.machines | \ 13707c478bd9Sstevel@tonic-gate tail -1 | awk -F= '{print $ 2;}'`" 13717c478bd9Sstevel@tonic-gate if [ "$DMAKE_MAX_JOBS" = "" ]; then 13727c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS=4 13737c478bd9Sstevel@tonic-gate fi 13747c478bd9Sstevel@tonic-gatefi 13757c478bd9Sstevel@tonic-gateDMAKE_MODE=parallel; 13767c478bd9Sstevel@tonic-gateexport DMAKE_MODE 13777c478bd9Sstevel@tonic-gateexport DMAKE_MAX_JOBS 13787c478bd9Sstevel@tonic-gate 13797c478bd9Sstevel@tonic-gateif [ -z "${ROOT}" ]; then 13807c478bd9Sstevel@tonic-gate echo "ROOT must be set." 13817c478bd9Sstevel@tonic-gate exit 1 13827c478bd9Sstevel@tonic-gatefi 13837c478bd9Sstevel@tonic-gate 13847c478bd9Sstevel@tonic-gate# 13857c478bd9Sstevel@tonic-gate# if -V flag was given, reset VERSION to V_ARG 13867c478bd9Sstevel@tonic-gate# 13877c478bd9Sstevel@tonic-gateif [ "$V_FLAG" = "y" ]; then 13887c478bd9Sstevel@tonic-gate VERSION=$V_ARG 13897c478bd9Sstevel@tonic-gatefi 13907c478bd9Sstevel@tonic-gate 139104a42e3eSszhou# 139204a42e3eSszhou# Check for IHV root for copying ihv proto area 139304a42e3eSszhou# 139404a42e3eSszhouif [ "$X_FLAG" = "y" ]; then 139504a42e3eSszhou if [ "$IA32_IHV_ROOT" = "" ]; then 139604a42e3eSszhou echo "IA32_IHV_ROOT: must be set for copying ihv proto" 139704a42e3eSszhou args_ok=n 139804a42e3eSszhou fi 139904a42e3eSszhou if [ ! -d "$IA32_IHV_ROOT" ]; then 140004a42e3eSszhou echo "$IA32_IHV_ROOT: not found" 140104a42e3eSszhou args_ok=n 140204a42e3eSszhou fi 14036fec3625Sdduvall if [ "$IA32_IHV_WS" = "" ]; then 14046fec3625Sdduvall echo "IA32_IHV_WS: must be set for copying ihv proto" 14056fec3625Sdduvall args_ok=n 14066fec3625Sdduvall fi 14076fec3625Sdduvall if [ ! -d "$IA32_IHV_WS" ]; then 14086fec3625Sdduvall echo "$IA32_IHV_WS: not found" 14096fec3625Sdduvall args_ok=n 14106fec3625Sdduvall fi 141104a42e3eSszhoufi 141204a42e3eSszhou 14137c478bd9Sstevel@tonic-gate# Append source version 14147c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" ]; then 14157c478bd9Sstevel@tonic-gate VERSION="${VERSION}:EXPORT" 14167c478bd9Sstevel@tonic-gatefi 14177c478bd9Sstevel@tonic-gate 14187c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 14197c478bd9Sstevel@tonic-gate VERSION="${VERSION}:DOMESTIC" 14207c478bd9Sstevel@tonic-gatefi 14217c478bd9Sstevel@tonic-gate 14227c478bd9Sstevel@tonic-gateif [ "$SH_FLAG" = "y" ]; then 14237c478bd9Sstevel@tonic-gate VERSION="${VERSION}:MODIFIED_SOURCE_PRODUCT" 14247c478bd9Sstevel@tonic-gatefi 14257c478bd9Sstevel@tonic-gate 14261fe69678Skupferif [ "$SO_FLAG" = "y" ]; then 14271fe69678Skupfer VERSION="${VERSION}:OPEN_ONLY" 14281fe69678Skupferfi 14291fe69678Skupfer 14307c478bd9Sstevel@tonic-gateTMPDIR="/tmp/nightly.tmpdir.$$" 14317c478bd9Sstevel@tonic-gateexport TMPDIR 14327c478bd9Sstevel@tonic-gaterm -rf ${TMPDIR} 14337c478bd9Sstevel@tonic-gatemkdir -p $TMPDIR || exit 1 14347c478bd9Sstevel@tonic-gate 14357c478bd9Sstevel@tonic-gate# 14367c478bd9Sstevel@tonic-gate# Keep elfsign's use of pkcs11_softtoken from looking in the user home 14377c478bd9Sstevel@tonic-gate# directory, which doesn't always work. Needed until all build machines 14387c478bd9Sstevel@tonic-gate# have the fix for 6271754 14397c478bd9Sstevel@tonic-gate# 14407c478bd9Sstevel@tonic-gateSOFTTOKEN_DIR=$TMPDIR 14417c478bd9Sstevel@tonic-gateexport SOFTTOKEN_DIR 14427c478bd9Sstevel@tonic-gate 14437c478bd9Sstevel@tonic-gateTOOLS=${SRC}/tools 14447c478bd9Sstevel@tonic-gateTOOLS_PROTO=${TOOLS}/proto 14457c478bd9Sstevel@tonic-gate 14467c478bd9Sstevel@tonic-gateunset CFLAGS LD_LIBRARY_PATH LDFLAGS 14477c478bd9Sstevel@tonic-gate 14487c478bd9Sstevel@tonic-gate# create directories that are automatically removed if the nightly script 14497c478bd9Sstevel@tonic-gate# fails to start correctly 14507c478bd9Sstevel@tonic-gatenewdir() { 14517c478bd9Sstevel@tonic-gate dir=$1 14527c478bd9Sstevel@tonic-gate toadd= 14537c478bd9Sstevel@tonic-gate while [ ! -d $dir ]; do 14547c478bd9Sstevel@tonic-gate toadd="$dir $toadd" 14557c478bd9Sstevel@tonic-gate dir=`dirname $dir` 14567c478bd9Sstevel@tonic-gate done 14577c478bd9Sstevel@tonic-gate torm= 14587c478bd9Sstevel@tonic-gate newlist= 14597c478bd9Sstevel@tonic-gate for dir in $toadd; do 14607c478bd9Sstevel@tonic-gate if staffer mkdir $dir; then 14617c478bd9Sstevel@tonic-gate newlist="$ISUSER $dir $newlist" 14627c478bd9Sstevel@tonic-gate torm="$dir $torm" 14637c478bd9Sstevel@tonic-gate else 14647c478bd9Sstevel@tonic-gate [ -z "$torm" ] || staffer rmdir $torm 14657c478bd9Sstevel@tonic-gate return 1 14667c478bd9Sstevel@tonic-gate fi 14677c478bd9Sstevel@tonic-gate done 14687c478bd9Sstevel@tonic-gate newdirlist="$newlist $newdirlist" 14697c478bd9Sstevel@tonic-gate return 0 14707c478bd9Sstevel@tonic-gate} 14717c478bd9Sstevel@tonic-gatenewdirlist= 14727c478bd9Sstevel@tonic-gate 14737c478bd9Sstevel@tonic-gate[ -d $CODEMGR_WS ] || newdir $CODEMGR_WS || exit 1 14747c478bd9Sstevel@tonic-gate 14757c478bd9Sstevel@tonic-gate# since this script assumes the build is from full source, it nullifies 14767c478bd9Sstevel@tonic-gate# variables likely to have been set by a "ws" script; nullification 14777c478bd9Sstevel@tonic-gate# confines the search space for headers and libraries to the proto area 14787c478bd9Sstevel@tonic-gate# built from this immediate source. 14797c478bd9Sstevel@tonic-gateENVLDLIBS1= 14807c478bd9Sstevel@tonic-gateENVLDLIBS2= 14817c478bd9Sstevel@tonic-gateENVLDLIBS3= 14827c478bd9Sstevel@tonic-gateENVCPPFLAGS1= 14837c478bd9Sstevel@tonic-gateENVCPPFLAGS2= 14847c478bd9Sstevel@tonic-gateENVCPPFLAGS3= 14857c478bd9Sstevel@tonic-gateENVCPPFLAGS4= 14867c478bd9Sstevel@tonic-gatePARENT_ROOT= 14877c478bd9Sstevel@tonic-gate 14887c478bd9Sstevel@tonic-gateexport ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \ 14897c478bd9Sstevel@tonic-gate PARENT_ROOT 14907c478bd9Sstevel@tonic-gate 14917c478bd9Sstevel@tonic-gateCPIODIR_ORIG=$CPIODIR 14927c478bd9Sstevel@tonic-gatePKGARCHIVE_ORIG=$PKGARCHIVE 14937c478bd9Sstevel@tonic-gateIA32_IHV_PKGS_ORIG=$IA32_IHV_PKGS 1494d8fd4470Sjgif [ "$SPARC_RM_PKGARCHIVE" ]; then 14957c478bd9Sstevel@tonic-gate SPARC_RM_PKGARCHIVE_ORIG=$SPARC_RM_PKGARCHIVE 1496d8fd4470Sjgfi 14977c478bd9Sstevel@tonic-gate 14987c478bd9Sstevel@tonic-gate# 14997c478bd9Sstevel@tonic-gate# Juggle the logs and optionally send mail on completion. 15007c478bd9Sstevel@tonic-gate# 15017c478bd9Sstevel@tonic-gate 15027c478bd9Sstevel@tonic-gatelogshuffle() { 15031c79753fSdarrenm LLOG="$ATLOG/log.`date '+%F'`" 15047c478bd9Sstevel@tonic-gate rm -rf $ATLOG/log.??`date '+%d'` 15051c79753fSdarrenm rm -rf $ATLOG/log.????-??-`date '+%d'` 15067c478bd9Sstevel@tonic-gate if [ -f $LLOG -o -d $LLOG ]; then 15077c478bd9Sstevel@tonic-gate LLOG=$LLOG.$$ 15087c478bd9Sstevel@tonic-gate fi 15097c478bd9Sstevel@tonic-gate mkdir $LLOG 15104802ef38Srscott export LLOG 15117c478bd9Sstevel@tonic-gate 15127c478bd9Sstevel@tonic-gate if [ "$build_ok" = "y" ]; then 15137c478bd9Sstevel@tonic-gate mv $ATLOG/proto_list_${MACH} $LLOG 151496ccc8cbSesaxe 151596ccc8cbSesaxe if [ -f $TMPDIR/wsdiff.results ]; then 151696ccc8cbSesaxe mv $TMPDIR/wsdiff.results $LLOG 151796ccc8cbSesaxe fi 15184e5b757fSkupfer 15194e5b757fSkupfer if [ -f $TMPDIR/wsdiff-nd.results ]; then 15204e5b757fSkupfer mv $TMPDIR/wsdiff-nd.results $LLOG 15214e5b757fSkupfer fi 15227c478bd9Sstevel@tonic-gate fi 15237c478bd9Sstevel@tonic-gate 15247c478bd9Sstevel@tonic-gate # 15257c478bd9Sstevel@tonic-gate # Now that we're about to send mail, it's time to check the noise 15267c478bd9Sstevel@tonic-gate # file. In the event that an error occurs beyond this point, it will 15277c478bd9Sstevel@tonic-gate # be recorded in the nightly.log file, but nowhere else. This would 15287c478bd9Sstevel@tonic-gate # include only errors that cause the copying of the noise log to fail 15297c478bd9Sstevel@tonic-gate # or the mail itself not to be sent. 15307c478bd9Sstevel@tonic-gate # 15317c478bd9Sstevel@tonic-gate 15327c478bd9Sstevel@tonic-gate exec >>$LOGFILE 2>&1 15337c478bd9Sstevel@tonic-gate if [ -s $build_noise_file ]; then 15347c478bd9Sstevel@tonic-gate echo "\n==== Nightly build noise ====\n" | 15357c478bd9Sstevel@tonic-gate tee -a $LOGFILE >>$mail_msg_file 15367c478bd9Sstevel@tonic-gate cat $build_noise_file >>$LOGFILE 15377c478bd9Sstevel@tonic-gate cat $build_noise_file >>$mail_msg_file 15387c478bd9Sstevel@tonic-gate echo | tee -a $LOGFILE >>$mail_msg_file 15397c478bd9Sstevel@tonic-gate fi 15407c478bd9Sstevel@tonic-gate rm -f $build_noise_file 15417c478bd9Sstevel@tonic-gate 15427c478bd9Sstevel@tonic-gate case "$build_ok" in 15437c478bd9Sstevel@tonic-gate y) 15447c478bd9Sstevel@tonic-gate state=Completed 15457c478bd9Sstevel@tonic-gate ;; 15467c478bd9Sstevel@tonic-gate i) 15477c478bd9Sstevel@tonic-gate state=Interrupted 15487c478bd9Sstevel@tonic-gate ;; 15497c478bd9Sstevel@tonic-gate *) 15507c478bd9Sstevel@tonic-gate state=Failed 15517c478bd9Sstevel@tonic-gate ;; 15527c478bd9Sstevel@tonic-gate esac 155340bc9153Srscott NIGHTLY_STATUS=$state 155440bc9153Srscott export NIGHTLY_STATUS 15557c478bd9Sstevel@tonic-gate 155640bc9153Srscott if [ -n "$POST_NIGHTLY" ]; then 155740bc9153Srscott echo "\n==== Running POST_NIGHTLY command:" \ 155840bc9153Srscott "$POST_NIGHTLY ====\n" | tee -a $mail_msg_file >> $LOGFILE 155940bc9153Srscott $POST_NIGHTLY $state 2>&1 | tee -a $mail_msg_file >> $LOGFILE 15604802ef38Srscott fi 15614802ef38Srscott 15627c478bd9Sstevel@tonic-gate cat $build_time_file $mail_msg_file > ${LLOG}/mail_msg 15637c478bd9Sstevel@tonic-gate if [ "$m_FLAG" = "y" ]; then 15647c478bd9Sstevel@tonic-gate cat $build_time_file $mail_msg_file | 15657c478bd9Sstevel@tonic-gate /usr/bin/mailx -s \ 15667c478bd9Sstevel@tonic-gate "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \ 15677c478bd9Sstevel@tonic-gate ${MAILTO} 15687c478bd9Sstevel@tonic-gate fi 15697c478bd9Sstevel@tonic-gate 15707c478bd9Sstevel@tonic-gate if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 15717c478bd9Sstevel@tonic-gate staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH} 15727c478bd9Sstevel@tonic-gate staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log 15737c478bd9Sstevel@tonic-gate fi 15747c478bd9Sstevel@tonic-gate 15757c478bd9Sstevel@tonic-gate mv $LOGFILE $LLOG 15767c478bd9Sstevel@tonic-gate} 15777c478bd9Sstevel@tonic-gate 15787c478bd9Sstevel@tonic-gate# 15797c478bd9Sstevel@tonic-gate# Remove the locks and temporary files on any exit 15807c478bd9Sstevel@tonic-gate# 15817c478bd9Sstevel@tonic-gatecleanup() { 15827c478bd9Sstevel@tonic-gate logshuffle 15837c478bd9Sstevel@tonic-gate 15847c478bd9Sstevel@tonic-gate [ -z "$lockfile" ] || staffer rm -f $lockfile 15857c478bd9Sstevel@tonic-gate [ -z "$atloglockfile" ] || rm -f $atloglockfile 15867c478bd9Sstevel@tonic-gate [ -z "$ulockfile" ] || staffer rm -f $ulockfile 15877c478bd9Sstevel@tonic-gate [ -z "$Ulockfile" ] || rm -f $Ulockfile 15887c478bd9Sstevel@tonic-gate 15897c478bd9Sstevel@tonic-gate set -- $newdirlist 15907c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 15917c478bd9Sstevel@tonic-gate ISUSER=$1 staffer rmdir $2 15927c478bd9Sstevel@tonic-gate shift; shift 15937c478bd9Sstevel@tonic-gate done 15947c478bd9Sstevel@tonic-gate rm -rf $TMPDIR 15957c478bd9Sstevel@tonic-gate} 15967c478bd9Sstevel@tonic-gate 15977c478bd9Sstevel@tonic-gatecleanup_signal() { 15987c478bd9Sstevel@tonic-gate build_ok=i 15997c478bd9Sstevel@tonic-gate # this will trigger cleanup(), above. 16007c478bd9Sstevel@tonic-gate exit 1 16017c478bd9Sstevel@tonic-gate} 16027c478bd9Sstevel@tonic-gate 16037c478bd9Sstevel@tonic-gatetrap cleanup 0 16047c478bd9Sstevel@tonic-gatetrap cleanup_signal 1 2 3 15 16057c478bd9Sstevel@tonic-gate 16067c478bd9Sstevel@tonic-gate# 16077c478bd9Sstevel@tonic-gate# Generic lock file processing -- make sure that the lock file doesn't 16087c478bd9Sstevel@tonic-gate# exist. If it does, it should name the build host and PID. If it 16097c478bd9Sstevel@tonic-gate# doesn't, then make sure we can create it. Clean up locks that are 16107c478bd9Sstevel@tonic-gate# known to be stale (assumes host name is unique among build systems 16117c478bd9Sstevel@tonic-gate# for the workspace). 16127c478bd9Sstevel@tonic-gatecreate_lock() { 16137c478bd9Sstevel@tonic-gate lockf=$1 16147c478bd9Sstevel@tonic-gate lockvar=$2 16157c478bd9Sstevel@tonic-gate if [ -f $lockf ]; then 16167c478bd9Sstevel@tonic-gate basews=`basename $CODEMGR_WS` 16177c478bd9Sstevel@tonic-gate if read host user pid < $lockf; then 16187c478bd9Sstevel@tonic-gate if [ "$host" != "$hostname" ]; then 16197c478bd9Sstevel@tonic-gate echo "$MACH build of $basews apparently" \ 16207c478bd9Sstevel@tonic-gate "already started by $user on $host as $pid." 16217c478bd9Sstevel@tonic-gate elif kill -s 0 $pid 2>/dev/null; then 16227c478bd9Sstevel@tonic-gate echo "$MACH build of $basews already started" \ 16237c478bd9Sstevel@tonic-gate "by $user as $pid." 16247c478bd9Sstevel@tonic-gate else 16257c478bd9Sstevel@tonic-gate # stale lock; clear it out and continue 16267c478bd9Sstevel@tonic-gate rm -f $lockf 16277c478bd9Sstevel@tonic-gate fi 16287c478bd9Sstevel@tonic-gate else 16297c478bd9Sstevel@tonic-gate echo "$MACH build of $basews already running." 16307c478bd9Sstevel@tonic-gate fi 16317c478bd9Sstevel@tonic-gate fi 16327c478bd9Sstevel@tonic-gate if [ -f $lockf ]; then 16337c478bd9Sstevel@tonic-gate echo "Lock file is $lockf." 16347c478bd9Sstevel@tonic-gate exit 1 16357c478bd9Sstevel@tonic-gate fi 16367c478bd9Sstevel@tonic-gate ldir=`dirname $lockf` 16377c478bd9Sstevel@tonic-gate [ -d $ldir ] || newdir $ldir || exit 1 16387c478bd9Sstevel@tonic-gate eval $lockvar=$lockf 16397c478bd9Sstevel@tonic-gate staffer sh -c "echo $hostname $STAFFER $$ > $lockf" || exit 1 16407c478bd9Sstevel@tonic-gate} 16417c478bd9Sstevel@tonic-gate 16424e5b757fSkupfer# 16434e5b757fSkupfer# Return the list of interesting proto areas, depending on the current 16444e5b757fSkupfer# options. 16454e5b757fSkupfer# 16464e5b757fSkupferallprotos() { 16474e5b757fSkupfer roots="$ROOT" 16484e5b757fSkupfer if [ $O_FLAG = y ]; then 16494e5b757fSkupfer # OpenSolaris deliveries require separate proto areas. 16504e5b757fSkupfer [ $D_FLAG = y ] && roots="$roots $ROOT-open" 16514e5b757fSkupfer [ $F_FLAG = n ] && roots="$roots $ROOT-open-nd" 16524e5b757fSkupfer fi 16534e5b757fSkupfer if [[ $D_FLAG = y && $F_FLAG = n ]]; then 16544e5b757fSkupfer [ $MULTI_PROTO = yes ] && roots="$roots $ROOT-nd" 16554e5b757fSkupfer fi 16564e5b757fSkupfer 16574e5b757fSkupfer echo $roots 16584e5b757fSkupfer} 16594e5b757fSkupfer 16607c478bd9Sstevel@tonic-gate# Ensure no other instance of this script is running on this host. 16617c478bd9Sstevel@tonic-gate# LOCKNAME can be set in <env_file>, and is by default, but is not 16627c478bd9Sstevel@tonic-gate# required due to the use of $ATLOG below. 16637c478bd9Sstevel@tonic-gateif [ -n "$LOCKNAME" ]; then 16647c478bd9Sstevel@tonic-gate create_lock /tmp/$LOCKNAME "lockfile" 16657c478bd9Sstevel@tonic-gatefi 16667c478bd9Sstevel@tonic-gate# 16677c478bd9Sstevel@tonic-gate# Create from one, two, or three other locks: 16687c478bd9Sstevel@tonic-gate# $ATLOG/nightly.lock 16697c478bd9Sstevel@tonic-gate# - protects against multiple builds in same workspace 16707c478bd9Sstevel@tonic-gate# $PARENT_WS/usr/src/nightly.$MACH.lock 16717c478bd9Sstevel@tonic-gate# - protects against multiple 'u' copy-backs 16727c478bd9Sstevel@tonic-gate# $NIGHTLY_PARENT_ROOT/nightly.lock 16737c478bd9Sstevel@tonic-gate# - protects against multiple 'U' copy-backs 16747c478bd9Sstevel@tonic-gate# 16757c478bd9Sstevel@tonic-gate# Overriding ISUSER to 1 causes the lock to be created as root if the 16767c478bd9Sstevel@tonic-gate# script is run as root. The default is to create it as $STAFFER. 16777c478bd9Sstevel@tonic-gateISUSER=1 create_lock $ATLOG/nightly.lock "atloglockfile" 16787c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" ]; then 16797c478bd9Sstevel@tonic-gate create_lock $PARENT_WS/usr/src/nightly.$MACH.lock "ulockfile" 16807c478bd9Sstevel@tonic-gatefi 16817c478bd9Sstevel@tonic-gateif [ "$U_FLAG" = "y" ]; then 16827c478bd9Sstevel@tonic-gate # NIGHTLY_PARENT_ROOT is written as root if script invoked as root. 16837c478bd9Sstevel@tonic-gate ISUSER=1 create_lock $NIGHTLY_PARENT_ROOT/nightly.lock "Ulockfile" 16847c478bd9Sstevel@tonic-gatefi 16857c478bd9Sstevel@tonic-gate 16867c478bd9Sstevel@tonic-gate# Locks have been taken, so we're doing a build and we're committed to 16877c478bd9Sstevel@tonic-gate# the directories we may have created so far. 16887c478bd9Sstevel@tonic-gatenewdirlist= 16897c478bd9Sstevel@tonic-gate 16907c478bd9Sstevel@tonic-gate# 16917c478bd9Sstevel@tonic-gate# Create mail_msg_file 16927c478bd9Sstevel@tonic-gate# 16937c478bd9Sstevel@tonic-gatemail_msg_file="${TMPDIR}/mail_msg" 16947c478bd9Sstevel@tonic-gatetouch $mail_msg_file 16957c478bd9Sstevel@tonic-gatebuild_time_file="${TMPDIR}/build_time" 16967c478bd9Sstevel@tonic-gate# 16977c478bd9Sstevel@tonic-gate# Move old LOGFILE aside 16987c478bd9Sstevel@tonic-gate# ATLOG directory already made by 'create_lock' above 16997c478bd9Sstevel@tonic-gate# 17007c478bd9Sstevel@tonic-gateif [ -f $LOGFILE ]; then 17017c478bd9Sstevel@tonic-gate mv -f $LOGFILE ${LOGFILE}- 17027c478bd9Sstevel@tonic-gatefi 17037c478bd9Sstevel@tonic-gate# 17047c478bd9Sstevel@tonic-gate# Build OsNet source 17057c478bd9Sstevel@tonic-gate# 17067c478bd9Sstevel@tonic-gateSTART_DATE=`date` 17077c478bd9Sstevel@tonic-gateSECONDS=0 17087c478bd9Sstevel@tonic-gateecho "\n==== Nightly $maketype build started: $START_DATE ====" \ 17097c478bd9Sstevel@tonic-gate | tee -a $LOGFILE > $build_time_file 17107c478bd9Sstevel@tonic-gate 17117c478bd9Sstevel@tonic-gate# make sure we log only to the nightly build file 17127c478bd9Sstevel@tonic-gatebuild_noise_file="${TMPDIR}/build_noise" 17137c478bd9Sstevel@tonic-gateexec </dev/null >$build_noise_file 2>&1 17147c478bd9Sstevel@tonic-gate 17157c478bd9Sstevel@tonic-gateecho "\n==== list of environment variables ====\n" >> $LOGFILE 17167c478bd9Sstevel@tonic-gateenv >> $LOGFILE 17177c478bd9Sstevel@tonic-gate 17187c478bd9Sstevel@tonic-gateecho "\n==== Nightly argument issues ====\n" | tee -a $mail_msg_file >> $LOGFILE 17197c478bd9Sstevel@tonic-gate 1720d77e7149Ssommerfeif [ "$P_FLAG" = "y" ]; then 1721d77e7149Ssommerfe obsolete_build GPROF | tee -a $mail_msg_file >> $LOGFILE 1722d77e7149Ssommerfefi 1723d77e7149Ssommerfe 1724d77e7149Ssommerfeif [ "$T_FLAG" = "y" ]; then 1725d77e7149Ssommerfe obsolete_build TRACE | tee -a $mail_msg_file >> $LOGFILE 1726d77e7149Ssommerfefi 1727d77e7149Ssommerfe 17281fe69678Skupferif is_source_build; then 17297c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "y" -o "$i_CMD_LINE_FLAG" = "y" ]; then 17307c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support incremental" \ 17317c478bd9Sstevel@tonic-gate "builds; forcing clobber\n" | tee -a $mail_msg_file >> $LOGFILE 17327c478bd9Sstevel@tonic-gate i_FLAG=n 17337c478bd9Sstevel@tonic-gate i_CMD_LINE_FLAG=n 17347c478bd9Sstevel@tonic-gate fi 17357c478bd9Sstevel@tonic-gate if [ "$N_FLAG" = "n" ]; then 17367c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support protocmp;" \ 17377c478bd9Sstevel@tonic-gate "protocmp disabled\n" | \ 17387c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17397c478bd9Sstevel@tonic-gate N_FLAG=y 17407c478bd9Sstevel@tonic-gate fi 17417c478bd9Sstevel@tonic-gate if [ "$l_FLAG" = "y" ]; then 17427c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support lint;" \ 17437c478bd9Sstevel@tonic-gate "lint disabled\n" | tee -a $mail_msg_file >> $LOGFILE 17447c478bd9Sstevel@tonic-gate l_FLAG=n 17457c478bd9Sstevel@tonic-gate fi 17467c478bd9Sstevel@tonic-gate if [ "$C_FLAG" = "y" ]; then 17477c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support cstyle;" \ 17487c478bd9Sstevel@tonic-gate "cstyle check disabled\n" | tee -a $mail_msg_file >> $LOGFILE 17497c478bd9Sstevel@tonic-gate C_FLAG=n 17507c478bd9Sstevel@tonic-gate fi 17517c478bd9Sstevel@tonic-gateelse 17527c478bd9Sstevel@tonic-gate if [ "$N_FLAG" = "y" ]; then 17537c478bd9Sstevel@tonic-gate if [ "$p_FLAG" = "y" ]; then 17547c478bd9Sstevel@tonic-gate cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 17557c478bd9Sstevel@tonic-gateWARNING: the p option (create packages) is set, but so is the N option (do 17567c478bd9Sstevel@tonic-gate not run protocmp); this is dangerous; you should unset the N option 17577c478bd9Sstevel@tonic-gateEOF 17587c478bd9Sstevel@tonic-gate else 17597c478bd9Sstevel@tonic-gate cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 17607c478bd9Sstevel@tonic-gateWarning: the N option (do not run protocmp) is set; it probably shouldn't be 17617c478bd9Sstevel@tonic-gateEOF 17627c478bd9Sstevel@tonic-gate fi 17637c478bd9Sstevel@tonic-gate echo "" | tee -a $mail_msg_file >> $LOGFILE 17647c478bd9Sstevel@tonic-gate fi 17657c478bd9Sstevel@tonic-gatefi 17667c478bd9Sstevel@tonic-gate 17674e5b757fSkupferif [ "$O_FLAG" = "y" -a "$a_FLAG" = "n" ]; then 17684e5b757fSkupfer echo "WARNING: OpenSolaris deliveries (-O) require archives;" \ 17694e5b757fSkupfer "enabling the -a flag." | tee -a $mail_msg_file >> $LOGFILE 17704e5b757fSkupfer a_FLAG=y 17714e5b757fSkupferfi 17724e5b757fSkupfer 17737c478bd9Sstevel@tonic-gateif [ "$a_FLAG" = "y" -a "$D_FLAG" = "n" -a "$F_FLAG" = "y" ]; then 17747c478bd9Sstevel@tonic-gate echo "WARNING: Neither DEBUG nor non-DEBUG build requested, but the" \ 17757c478bd9Sstevel@tonic-gate "'a' option was set." | tee -a $mail_msg_file >> $LOGFILE 17767c478bd9Sstevel@tonic-gatefi 17777c478bd9Sstevel@tonic-gate 17787c478bd9Sstevel@tonic-gateif [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 17794e5b757fSkupfer # 17804e5b757fSkupfer # In the past we just complained but went ahead with the lint 17814e5b757fSkupfer # pass, even though the proto area was built non-debug. It's 17824e5b757fSkupfer # unlikely that non-debug headers will make a difference, but 17834e5b757fSkupfer # rather than assuming it's a safe combination, force the user 17844e5b757fSkupfer # to specify a debug build. 17854e5b757fSkupfer # 17864e5b757fSkupfer echo "WARNING: DEBUG build not requested; disabling lint.\n" \ 17877c478bd9Sstevel@tonic-gate | tee -a $mail_msg_file >> $LOGFILE 17884e5b757fSkupfer l_FLAG=n 17897c478bd9Sstevel@tonic-gatefi 17907c478bd9Sstevel@tonic-gate 17917c478bd9Sstevel@tonic-gateif [ "$f_FLAG" = "y" ]; then 17927c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "y" ]; then 17937c478bd9Sstevel@tonic-gate echo "WARNING: the -f flag cannot be used during incremental" \ 17947c478bd9Sstevel@tonic-gate "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE 17957c478bd9Sstevel@tonic-gate f_FLAG=n 17967c478bd9Sstevel@tonic-gate fi 17977c478bd9Sstevel@tonic-gate if [ "$p_FLAG" != "y" -o "$l_FLAG" != "y" ]; then 17987c478bd9Sstevel@tonic-gate echo "WARNING: the -f flag requires -l and -p; ignoring -f\n" | \ 17997c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 18007c478bd9Sstevel@tonic-gate f_FLAG=n 18017c478bd9Sstevel@tonic-gate fi 18027c478bd9Sstevel@tonic-gatefi 18037c478bd9Sstevel@tonic-gate 180496ccc8cbSesaxeif [ "$w_FLAG" = "y" -a ! -d $ROOT ]; then 18054e5b757fSkupfer echo "WARNING: -w specified, but $ROOT does not exist;" \ 180696ccc8cbSesaxe "ignoring -w\n" | tee -a $mail_msg_file >> $LOGFILE 180796ccc8cbSesaxe w_FLAG=n 180896ccc8cbSesaxefi 180996ccc8cbSesaxe 18107c478bd9Sstevel@tonic-gateif [ "$t_FLAG" = "n" ]; then 18117c478bd9Sstevel@tonic-gate # 18127c478bd9Sstevel@tonic-gate # We're not doing a tools build, so make sure elfsign(1) is 18137c478bd9Sstevel@tonic-gate # new enough to safely sign non-crypto binaries. We test 18147c478bd9Sstevel@tonic-gate # debugging output from elfsign to detect the old version. 18157c478bd9Sstevel@tonic-gate # 18167c478bd9Sstevel@tonic-gate newelfsigntest=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \ 18177c478bd9Sstevel@tonic-gate -e /usr/lib/security/pkcs11_softtoken.so.1 2>&1 \ 18187c478bd9Sstevel@tonic-gate | egrep algorithmOID` 18197c478bd9Sstevel@tonic-gate if [ -z "$newelfsigntest" ]; then 18207c478bd9Sstevel@tonic-gate echo "WARNING: /usr/bin/elfsign out of date;" \ 18217c478bd9Sstevel@tonic-gate "will only sign crypto modules\n" | \ 18227c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 18237c478bd9Sstevel@tonic-gate export ELFSIGN_OBJECT=true 18247c478bd9Sstevel@tonic-gate elif [ "$VERIFY_ELFSIGN" = "y" ]; then 18257c478bd9Sstevel@tonic-gate echo "WARNING: VERIFY_ELFSIGN=y requires" \ 18267c478bd9Sstevel@tonic-gate "the -t flag; ignoring VERIFY_ELFSIGN\n" | \ 18277c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 18287c478bd9Sstevel@tonic-gate fi 18297c478bd9Sstevel@tonic-gatefi 18307c478bd9Sstevel@tonic-gate 18314e5b757fSkupfer[ "$O_FLAG" = y ] && MULTI_PROTO=yes 18324e5b757fSkupfer 18334e5b757fSkupfercase $MULTI_PROTO in 18344e5b757fSkupferyes|no) ;; 18354e5b757fSkupfer*) 18364e5b757fSkupfer echo "WARNING: MULTI_PROTO is \"$MULTI_PROTO\"; " \ 18374e5b757fSkupfer "should be \"yes\" or \"no\"." | tee -a $mail_msg_file >> $LOGFILE 18384e5b757fSkupfer echo "Setting MULTI_PROTO to \"no\".\n" | \ 18394e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 18404e5b757fSkupfer export MULTI_PROTO=no 18414e5b757fSkupfer ;; 18424e5b757fSkupferesac 18434e5b757fSkupfer 18447c478bd9Sstevel@tonic-gateecho "==== Build environment ====\n" | tee -a $mail_msg_file >> $LOGFILE 18457c478bd9Sstevel@tonic-gate 18467c478bd9Sstevel@tonic-gate# System 18477c478bd9Sstevel@tonic-gatewhence uname | tee -a $mail_msg_file >> $LOGFILE 18487c478bd9Sstevel@tonic-gateuname -a 2>&1 | tee -a $mail_msg_file >> $LOGFILE 18497c478bd9Sstevel@tonic-gateecho | tee -a $mail_msg_file >> $LOGFILE 18507c478bd9Sstevel@tonic-gate 18517c478bd9Sstevel@tonic-gate# nightly (will fail in year 2100 due to SCCS flaw) 18527c478bd9Sstevel@tonic-gateecho "$0 $@" | tee -a $mail_msg_file >> $LOGFILE 1853964296ffSrotondoecho "%M% version %I% 20%E%\n" | tee -a $mail_msg_file >> $LOGFILE 18547c478bd9Sstevel@tonic-gate 18557c478bd9Sstevel@tonic-gate# make 18567c478bd9Sstevel@tonic-gatewhence $MAKE | tee -a $mail_msg_file >> $LOGFILE 18577c478bd9Sstevel@tonic-gate$MAKE -v | tee -a $mail_msg_file >> $LOGFILE 18587c478bd9Sstevel@tonic-gateecho "number of concurrent jobs = $DMAKE_MAX_JOBS" | 18597c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 18607c478bd9Sstevel@tonic-gate 18617c478bd9Sstevel@tonic-gate# 18627c478bd9Sstevel@tonic-gate# Report the compiler versions. 18637c478bd9Sstevel@tonic-gate# 18647c478bd9Sstevel@tonic-gateif [ -f $SRC/Makefile ]; then 18657c478bd9Sstevel@tonic-gate srcroot=$SRC 18667c478bd9Sstevel@tonic-gateelif [ -f $BRINGOVER_WS/usr/src/Makefile ]; then 18677c478bd9Sstevel@tonic-gate srcroot=$BRINGOVER_WS/usr/src 18687c478bd9Sstevel@tonic-gateelse 18697c478bd9Sstevel@tonic-gate echo "\nUnable to find \"Makefile\" in $BRINGOVER_WS/usr/src or $SRC." | 18707c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 18717c478bd9Sstevel@tonic-gate exit 1 18727c478bd9Sstevel@tonic-gatefi 18737c478bd9Sstevel@tonic-gate 18747c478bd9Sstevel@tonic-gate( cd $srcroot 18757c478bd9Sstevel@tonic-gate for target in cc-version cc64-version java-version; do 18767c478bd9Sstevel@tonic-gate echo 18777c478bd9Sstevel@tonic-gate # 18787c478bd9Sstevel@tonic-gate # Put statefile somewhere we know we can write to rather than trip 1879b84bdc30Smeem # over a read-only $srcroot. 18807c478bd9Sstevel@tonic-gate # 18817c478bd9Sstevel@tonic-gate rm -f $TMPDIR/make-state 188232f1e47bSsommerfe export SRC=$srcroot 1883b84bdc30Smeem if $MAKE -K $TMPDIR/make-state -e $target 2>/dev/null; then 18847c478bd9Sstevel@tonic-gate continue 18857c478bd9Sstevel@tonic-gate fi 18867c478bd9Sstevel@tonic-gate touch $TMPDIR/nocompiler 18877c478bd9Sstevel@tonic-gate done 18887c478bd9Sstevel@tonic-gate echo 18897c478bd9Sstevel@tonic-gate) | tee -a $mail_msg_file >> $LOGFILE 18907c478bd9Sstevel@tonic-gate 18917c478bd9Sstevel@tonic-gateif [ -f $TMPDIR/nocompiler ]; then 18927c478bd9Sstevel@tonic-gate rm -f $TMPDIR/nocompiler 18937c478bd9Sstevel@tonic-gate build_ok=n 18947c478bd9Sstevel@tonic-gate echo "Aborting due to missing compiler." | 18957c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 18967c478bd9Sstevel@tonic-gate exit 1 18977c478bd9Sstevel@tonic-gatefi 18987c478bd9Sstevel@tonic-gate 18997c478bd9Sstevel@tonic-gate# as 19007c478bd9Sstevel@tonic-gatewhence as | tee -a $mail_msg_file >> $LOGFILE 19017c478bd9Sstevel@tonic-gateas -V 2>&1 | head -1 | tee -a $mail_msg_file >> $LOGFILE 19027c478bd9Sstevel@tonic-gateecho | tee -a $mail_msg_file >> $LOGFILE 19037c478bd9Sstevel@tonic-gate 19047c478bd9Sstevel@tonic-gate# Check that we're running a capable link-editor 19057c478bd9Sstevel@tonic-gatewhence ld | tee -a $mail_msg_file >> $LOGFILE 19067c478bd9Sstevel@tonic-gateLDVER=`ld -V 2>&1` 19077c478bd9Sstevel@tonic-gateecho $LDVER | tee -a $mail_msg_file >> $LOGFILE 19087c478bd9Sstevel@tonic-gateLDVER=`echo $LDVER | sed -e "s/.*-1\.//" -e "s/:.*//"` 19097c478bd9Sstevel@tonic-gateif [ `expr $LDVER \< 422` -eq 1 ]; then 19107c478bd9Sstevel@tonic-gate echo "The link-editor needs to be at version 422 or higher to build" | \ 19117c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 19127c478bd9Sstevel@tonic-gate echo "the latest stuff, hope your build works." | \ 19137c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 19147c478bd9Sstevel@tonic-gatefi 19157c478bd9Sstevel@tonic-gate 19167c478bd9Sstevel@tonic-gateecho "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \ 19177c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 19187c478bd9Sstevel@tonic-gate 19197c478bd9Sstevel@tonic-gateecho "\n==== Build version ====\n" | tee -a $mail_msg_file >> $LOGFILE 19207c478bd9Sstevel@tonic-gateecho $VERSION | tee -a $mail_msg_file >> $LOGFILE 19217c478bd9Sstevel@tonic-gate 192296ccc8cbSesaxe# Save the current proto area if we're comparing against the last build 192396ccc8cbSesaxeif [ "$w_FLAG" = "y" -a -d "$ROOT" ]; then 192496ccc8cbSesaxe if [ -d "$ROOT.prev" ]; then 192596ccc8cbSesaxe rm -rf $ROOT.prev 192696ccc8cbSesaxe fi 192796ccc8cbSesaxe mv $ROOT $ROOT.prev 192896ccc8cbSesaxefi 192996ccc8cbSesaxe 19304e5b757fSkupfer# Same for non-DEBUG proto area 19314e5b757fSkupferif [ "$w_FLAG" = "y" -a "$MULTI_PROTO" = yes -a -d "$ROOT-nd" ]; then 19324e5b757fSkupfer if [ -d "$ROOT-nd.prev" ]; then 19334e5b757fSkupfer rm -rf $ROOT-nd.prev 19344e5b757fSkupfer fi 19354e5b757fSkupfer mv $ROOT-nd $ROOT-nd.prev 19364e5b757fSkupferfi 19374e5b757fSkupfer 19387c478bd9Sstevel@tonic-gate# 19397c478bd9Sstevel@tonic-gate# Decide whether to clobber 19407c478bd9Sstevel@tonic-gate# 19417c478bd9Sstevel@tonic-gateif [ "$i_FLAG" = "n" -a -d "$SRC" ]; then 19427c478bd9Sstevel@tonic-gate echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE 19437c478bd9Sstevel@tonic-gate 19447c478bd9Sstevel@tonic-gate cd $SRC 19457c478bd9Sstevel@tonic-gate # remove old clobber file 19467c478bd9Sstevel@tonic-gate rm -f $SRC/clobber.out 19477c478bd9Sstevel@tonic-gate rm -f $SRC/clobber-${MACH}.out 19487c478bd9Sstevel@tonic-gate 19497c478bd9Sstevel@tonic-gate # Remove all .make.state* files, just in case we are restarting 19507c478bd9Sstevel@tonic-gate # the build after having interrupted a previous 'make clobber'. 19517c478bd9Sstevel@tonic-gate find . \( -name SCCS -o -name 'interfaces.*' \) -prune \ 19527c478bd9Sstevel@tonic-gate -o -name '.make.*' -print | xargs rm -f 19537c478bd9Sstevel@tonic-gate 19547c478bd9Sstevel@tonic-gate $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE 19557c478bd9Sstevel@tonic-gate echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file 19567c478bd9Sstevel@tonic-gate grep "$MAKE:" $SRC/clobber-${MACH}.out | 19577c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 19587c478bd9Sstevel@tonic-gate >> $mail_msg_file 19597c478bd9Sstevel@tonic-gate 19604e5b757fSkupfer if [[ "$t_FLAG" = "y" || "$O_FLAG" = "y" ]]; then 19617c478bd9Sstevel@tonic-gate echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE 19627c478bd9Sstevel@tonic-gate cd ${TOOLS} 19637c478bd9Sstevel@tonic-gate rm -f ${TOOLS}/clobber-${MACH}.out 19647c478bd9Sstevel@tonic-gate $MAKE -ek clobber 2>&1 | \ 19657c478bd9Sstevel@tonic-gate tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE 19667c478bd9Sstevel@tonic-gate echo "\n==== Make tools clobber ERRORS ====\n" \ 19677c478bd9Sstevel@tonic-gate >> $mail_msg_file 19687c478bd9Sstevel@tonic-gate grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \ 19697c478bd9Sstevel@tonic-gate >> $mail_msg_file 19707c478bd9Sstevel@tonic-gate rm -rf ${TOOLS_PROTO} 19717c478bd9Sstevel@tonic-gate mkdir -p ${TOOLS_PROTO} 19727c478bd9Sstevel@tonic-gate fi 197396ccc8cbSesaxe 19744e5b757fSkupfer rm -rf `allprotos` 19757c478bd9Sstevel@tonic-gate 19767c478bd9Sstevel@tonic-gate # Get back to a clean workspace as much as possible to catch 19777c478bd9Sstevel@tonic-gate # problems that only occur on fresh workspaces. 19787c478bd9Sstevel@tonic-gate # Remove all .make.state* files, libraries, and .o's that may 1979fb23a357Skupfer # have been omitted from clobber. A couple of libraries are 1980fb23a357Skupfer # under SCCS, so leave them alone. 19817c478bd9Sstevel@tonic-gate # We should probably blow away temporary directories too. 19827c478bd9Sstevel@tonic-gate cd $SRC 1983fb23a357Skupfer find $relsrcdirs \( -name SCCS -o -name 'interfaces.*' \) -prune -o \ 19847c478bd9Sstevel@tonic-gate \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \ 1985fb23a357Skupfer -name '*.o' \) -print | \ 1986fb23a357Skupfer grep -v 'tools/ctf/dwarf/.*/libdwarf' | xargs rm -f 19877c478bd9Sstevel@tonic-gateelse 19887c478bd9Sstevel@tonic-gate echo "\n==== No clobber at `date` ====\n" >> $LOGFILE 19897c478bd9Sstevel@tonic-gatefi 19907c478bd9Sstevel@tonic-gate 19917c478bd9Sstevel@tonic-gate# 19927c478bd9Sstevel@tonic-gate# Decide whether to bringover to the codemgr workspace 19937c478bd9Sstevel@tonic-gate# 19947c478bd9Sstevel@tonic-gateif [ "$n_FLAG" = "n" ]; then 19957c478bd9Sstevel@tonic-gate echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE 19967c478bd9Sstevel@tonic-gate # sleep on the parent workspace's lock 19977c478bd9Sstevel@tonic-gate while egrep -s write $BRINGOVER_WS/Codemgr_wsdata/locks 19987c478bd9Sstevel@tonic-gate do 19997c478bd9Sstevel@tonic-gate sleep 120 20007c478bd9Sstevel@tonic-gate done 20017c478bd9Sstevel@tonic-gate 20027c478bd9Sstevel@tonic-gate echo "\n==== BRINGOVER LOG ====\n" >> $mail_msg_file 200332f1e47bSsommerfe 200432f1e47bSsommerfe (staffer $TEAMWARE/bin/bringover -c "nightly update" -p $BRINGOVER_WS \ 200532f1e47bSsommerfe -w $CODEMGR_WS $BRINGOVER_FILES < /dev/null 2>&1 || 200632f1e47bSsommerfe touch $TMPDIR/bringover_failed 200732f1e47bSsommerfe 2008d77e7149Ssommerfe staffer bringovercheck $CODEMGR_WS >$TMPDIR/bringovercheck.out 2>&1 2009d77e7149Ssommerfe 2010d77e7149Ssommerfe if [ -s $TMPDIR/bringovercheck.out ]; then 2011d77e7149Ssommerfe echo "\n==== POST-BRINGOVER CLEANUP NOISE ====\n" 2012d77e7149Ssommerfe cat $TMPDIR/bringovercheck.out 2013d77e7149Ssommerfe fi 201432f1e47bSsommerfe 201532f1e47bSsommerfe ) | tee -a $mail_msg_file >> $LOGFILE 201632f1e47bSsommerfe 201732f1e47bSsommerfe if [ -f $TMPDIR/bringover_failed ]; then 201832f1e47bSsommerfe rm -f $TMPDIR/bringover_failed 201932f1e47bSsommerfe build_ok=n 202032f1e47bSsommerfe echo "trouble with bringover, quitting at `date`." | 20217c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 20227c478bd9Sstevel@tonic-gate exit 1 20237c478bd9Sstevel@tonic-gate fi 2024085d331dSkupfer 2025085d331dSkupfer # 2026085d331dSkupfer # Possible transition from pre-split workspace to split 2027085d331dSkupfer # workspace. See if the bringover changed anything. 2028085d331dSkupfer # 2029085d331dSkupfer CLOSED_IS_PRESENT="$orig_closed_is_present" 2030085d331dSkupfer check_closed_tree 20317c478bd9Sstevel@tonic-gateelse 20327c478bd9Sstevel@tonic-gate echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE 20337c478bd9Sstevel@tonic-gatefi 20347c478bd9Sstevel@tonic-gate 20357c478bd9Sstevel@tonic-gate# 20364e5b757fSkupfer# Build and use the workspace's tools if requested 20377c478bd9Sstevel@tonic-gate# 20384e5b757fSkupferif [[ "$t_FLAG" = "y" || "$O_FLAG" = y ]]; then 20394e5b757fSkupfer set_non_debug_build_flags 20407c478bd9Sstevel@tonic-gate 20417c478bd9Sstevel@tonic-gate build_tools ${TOOLS_PROTO} 20424e5b757fSkupfer 20434e5b757fSkupfer if [[ $? -ne 0 && "$t_FLAG" = y ]]; then 20444e5b757fSkupfer use_tools $TOOLS_PROTO 20454e5b757fSkupfer export ONBLD_TOOLS=${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld} 20464e5b757fSkupfer fi 20477c478bd9Sstevel@tonic-gatefi 20487c478bd9Sstevel@tonic-gate 20496fec3625Sdduvall# 20506fec3625Sdduvall# copy ihv proto area in addition to the build itself 20516fec3625Sdduvall# 20526fec3625Sdduvallif [ "$X_FLAG" = "y" ]; then 20536fec3625Sdduvall copy_ihv_proto 20546fec3625Sdduvallfi 20556fec3625Sdduvall 20567c478bd9Sstevel@tonic-gateif [ "$i_FLAG" = "y" -a "$SH_FLAG" = "y" ]; then 20577c478bd9Sstevel@tonic-gate echo "\n==== NOT Building base OS-Net source ====\n" | \ 20587c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 20597c478bd9Sstevel@tonic-gateelse 20604e5b757fSkupfer # timestamp the start of the normal build; the findunref tool uses it. 20614e5b757fSkupfer touch $SRC/.build.tstamp 20624e5b757fSkupfer 20637c478bd9Sstevel@tonic-gate normal_build 20647c478bd9Sstevel@tonic-gatefi 20657c478bd9Sstevel@tonic-gate 20664e5b757fSkupfer# 20674e5b757fSkupfer# Generate OpenSolaris deliverables if requested. 20684e5b757fSkupfer# 20694e5b757fSkupferif [ "$O_FLAG" = y -a "$build_ok" = y ]; then 20704e5b757fSkupfer # 20714e5b757fSkupfer # Generate skeleton (minimal) closed binaries for open-only 20724e5b757fSkupfer # build. There's no need to distinguish debug from non-debug 20734e5b757fSkupfer # binaries, but it simplifies file management to have separate 20744e5b757fSkupfer # trees. 20754e5b757fSkupfer # 20764e5b757fSkupfer 20774e5b757fSkupfer echo "\n==== Generating skeleton closed binaries for" \ 20784e5b757fSkupfer "open-only build ====\n" | \ 20794e5b757fSkupfer tee -a $LOGFILE >> $mail_msg_file 20804e5b757fSkupfer 20814e5b757fSkupfer rm -rf $CODEMGR_WS/closed.skel 20824e5b757fSkupfer if [ "$D_FLAG" = y ]; then 20834e5b757fSkupfer mkclosed $MACH $ROOT $CODEMGR_WS/closed.skel/root_$MACH \ 20844e5b757fSkupfer >>$LOGFILE 2>&1 20854e5b757fSkupfer if [ $? -ne 0 ]; then 20864e5b757fSkupfer echo "Couldn't create skeleton DEBUG closed binaries." | 20874e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 20884e5b757fSkupfer fi 20894e5b757fSkupfer fi 20904e5b757fSkupfer if [ "$F_FLAG" = n ]; then 20914e5b757fSkupfer mkclosed $MACH $ROOT-nd $CODEMGR_WS/closed.skel/root_$MACH-nd \ 20924e5b757fSkupfer >>$LOGFILE 2>&1 20934e5b757fSkupfer if [ $? -ne 0 ]; then 20944e5b757fSkupfer echo "Couldn't create skeleton non-DEBUG closed binaries." | 20954e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 20964e5b757fSkupfer fi 20974e5b757fSkupfer fi 20984e5b757fSkupfer 20994e5b757fSkupfer ORIG_CLOSED_IS_PRESENT=$CLOSED_IS_PRESENT 21004e5b757fSkupfer export CLOSED_IS_PRESENT=no 21014e5b757fSkupfer 21024e5b757fSkupfer ORIG_ON_CLOSED_BINS="$ON_CLOSED_BINS" 21034e5b757fSkupfer export ON_CLOSED_BINS=$CODEMGR_WS/closed.skel 21044e5b757fSkupfer 21054e5b757fSkupfer normal_build -O 21064e5b757fSkupfer 21074e5b757fSkupfer echo "\n==== Generating OpenSolaris tarballs ====\n" | \ 21084e5b757fSkupfer tee -a $LOGFILE >> $mail_msg_file 21094e5b757fSkupfer 21104e5b757fSkupfer cd $CODEMGR_WS 21114e5b757fSkupfer 21124e5b757fSkupfer echo "Generating THIRDPARTYLICENSE files..." >> $LOGFILE 21134e5b757fSkupfer 21144e5b757fSkupfer mktpl usr/src/tools/opensolaris/license-list >>$LOGFILE 2>&1 21154e5b757fSkupfer if [ $? -ne 0 ]; then 21164e5b757fSkupfer echo "Couldn't create THIRDPARTYLICENSE files" | 21174e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 21184e5b757fSkupfer fi 21194e5b757fSkupfer 21204e5b757fSkupfer echo "Generating closed binaries tarball(s)..." >> $LOGFILE 21214e5b757fSkupfer if [ "$D_FLAG" = y ]; then 21224e5b757fSkupfer bindrop $ROOT $ROOT-open >>$LOGFILE 2>&1 21234e5b757fSkupfer if [ $? -ne 0 ]; then 21244e5b757fSkupfer echo "Couldn't create DEBUG closed binaries." | 21254e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 21264e5b757fSkupfer fi 21274e5b757fSkupfer fi 21284e5b757fSkupfer if [ "$F_FLAG" = n ]; then 21294e5b757fSkupfer bindrop -n $ROOT-nd $ROOT-open-nd >>$LOGFILE 2>&1 21304e5b757fSkupfer if [ $? -ne 0 ]; then 21314e5b757fSkupfer echo "Couldn't create non-DEBUG closed binaries." | 21324e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 21334e5b757fSkupfer fi 21344e5b757fSkupfer fi 21354e5b757fSkupfer 21364e5b757fSkupfer echo "Generating SUNWonbld tarball..." >> $LOGFILE 21374e5b757fSkupfer PKGARCHIVE=$PKGARCHIVE_ORIG 21384e5b757fSkupfer onblddrop >> $LOGFILE 2>&1 21394e5b757fSkupfer if [ $? -ne 0 ]; then 21404e5b757fSkupfer echo "Couldn't create SUNWonbld tarball." | 21414e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 21424e5b757fSkupfer fi 21434e5b757fSkupfer 21444e5b757fSkupfer echo "Generating README.opensolaris..." >> $LOGFILE 21454e5b757fSkupfer cat $SRC/tools/opensolaris/README.opensolaris.tmpl | \ 21464e5b757fSkupfer mkreadme_osol $CODEMGR_WS/README.opensolaris >> $LOGFILE 2>&1 21474e5b757fSkupfer if [ $? -ne 0 ]; then 21484e5b757fSkupfer echo "Couldn't create README.opensolaris." | 21494e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 21504e5b757fSkupfer fi 21514e5b757fSkupfer 21524e5b757fSkupfer echo "Generating source tarball..." >> $LOGFILE 21534e5b757fSkupfer sdrop >>$LOGFILE 2>&1 21544e5b757fSkupfer if [ $? -ne 0 ]; then 21554e5b757fSkupfer echo "Couldn't create source tarball." | 21564e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 21574e5b757fSkupfer fi 21584e5b757fSkupfer 21594e5b757fSkupfer echo "Generating BFU tarball(s)..." >> $LOGFILE 21604e5b757fSkupfer if [ "$D_FLAG" = y ]; then 21614e5b757fSkupfer bfudrop nightly-open >>$LOGFILE 2>&1 21624e5b757fSkupfer if [ $? -ne 0 ]; then 21634e5b757fSkupfer echo "Couldn't create DEBUG archives tarball." | 21644e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 21654e5b757fSkupfer fi 21664e5b757fSkupfer fi 21674e5b757fSkupfer if [ "$F_FLAG" = n ]; then 21684e5b757fSkupfer bfudrop nightly-open-nd >>$LOGFILE 2>&1 21694e5b757fSkupfer if [ $? -ne 0 ]; then 21704e5b757fSkupfer echo "Couldn't create non-DEBUG archives tarball." | 21714e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 21724e5b757fSkupfer fi 21734e5b757fSkupfer fi 21744e5b757fSkupfer 21754e5b757fSkupfer ON_CLOSED_BINS=$ORIG_ON_CLOSED_BINS 21764e5b757fSkupfer CLOSED_IS_PRESENT=$ORIG_CLOSED_IS_PRESENT 21774e5b757fSkupferfi 21784e5b757fSkupfer 21797c478bd9Sstevel@tonic-gateORIG_SRC=$SRC 21807c478bd9Sstevel@tonic-gateBINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z 21817c478bd9Sstevel@tonic-gate 21821fe69678Skupfer# 21831fe69678Skupfer# For the "open" build, we don't mung any source files, so skip this 21841fe69678Skupfer# step. 21851fe69678Skupfer# 21867c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 21877c478bd9Sstevel@tonic-gate save_binaries 21887c478bd9Sstevel@tonic-gate 21897c478bd9Sstevel@tonic-gate echo "\n==== Retrieving SCCS files at `date` ====\n" >> $LOGFILE 21907c478bd9Sstevel@tonic-gate SCCSHELPER=${TMPDIR}/sccs-helper 21917c478bd9Sstevel@tonic-gate rm -f ${SCCSHELPER} 21927c478bd9Sstevel@tonic-gatecat >${SCCSHELPER} <<EOF 21937c478bd9Sstevel@tonic-gate#!/bin/ksh 21947c478bd9Sstevel@tonic-gatecd \$1 21957c478bd9Sstevel@tonic-gatecd .. 21967c478bd9Sstevel@tonic-gatesccs get SCCS >/dev/null 2>&1 21977c478bd9Sstevel@tonic-gateEOF 21987c478bd9Sstevel@tonic-gate cd $SRC 21997c478bd9Sstevel@tonic-gate chmod +x ${SCCSHELPER} 2200fb23a357Skupfer find $relsrcdirs -name SCCS | xargs -L 1 ${SCCSHELPER} 22017c478bd9Sstevel@tonic-gate rm -f ${SCCSHELPER} 22027c478bd9Sstevel@tonic-gatefi 22037c478bd9Sstevel@tonic-gate 22047c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 22051fe69678Skupfer set_up_source_build ${CODEMGR_WS} ${CRYPT_SRC} CRYPT_SRC 22067c478bd9Sstevel@tonic-gatefi 22077c478bd9Sstevel@tonic-gate 22087c478bd9Sstevel@tonic-gate# EXPORT_SRC comes after CRYPT_SRC since a domestic build will need 22097c478bd9Sstevel@tonic-gate# $SRC pointing to the export_source usr/src. 22107c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 22111fe69678Skupfer set_up_source_build ${CODEMGR_WS} ${EXPORT_SRC} EXPORT_SRC 22127c478bd9Sstevel@tonic-gatefi 22137c478bd9Sstevel@tonic-gate 22147c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 22157c478bd9Sstevel@tonic-gate # drop the crypt files in place. 22167c478bd9Sstevel@tonic-gate cd ${EXPORT_SRC} 22177c478bd9Sstevel@tonic-gate echo "\nextracting crypt_files.cpio.Z onto export_source.\n" \ 22187c478bd9Sstevel@tonic-gate >> ${LOGFILE} 22197c478bd9Sstevel@tonic-gate zcat ${CODEMGR_WS}/crypt_files.cpio.Z | \ 22207c478bd9Sstevel@tonic-gate cpio -idmucvB 2>/dev/null >> ${LOGFILE} 22217c478bd9Sstevel@tonic-gate if [ "$?" = "0" ]; then 22227c478bd9Sstevel@tonic-gate echo "\n==== DOMESTIC extraction succeeded ====\n" \ 22237c478bd9Sstevel@tonic-gate >> $mail_msg_file 22247c478bd9Sstevel@tonic-gate else 22257c478bd9Sstevel@tonic-gate echo "\n==== DOMESTIC extraction failed ====\n" \ 22267c478bd9Sstevel@tonic-gate >> $mail_msg_file 22277c478bd9Sstevel@tonic-gate fi 22287c478bd9Sstevel@tonic-gate 22297c478bd9Sstevel@tonic-gatefi 22307c478bd9Sstevel@tonic-gate 22311fe69678Skupferif [ "$SO_FLAG" = "y" ]; then 22321fe69678Skupfer # 22331fe69678Skupfer # Copy the open sources into their own tree, set up the closed 22344e5b757fSkupfer # binaries, and set up the environment. The build looks for 22354e5b757fSkupfer # the closed binaries in a location that depends on whether 22364e5b757fSkupfer # it's a DEBUG build, so we might need to make two copies. 22371fe69678Skupfer # 22381fe69678Skupfer copy_source $CODEMGR_WS $OPEN_SRCDIR OPEN_SOURCE usr/src 22391fe69678Skupfer SRC=$OPEN_SRCDIR/usr/src 22401fe69678Skupfer 22411fe69678Skupfer # Try not to clobber any user-provided closed binaries. 22421fe69678Skupfer export ON_CLOSED_BINS=$CODEMGR_WS/closed$$ 22434e5b757fSkupfer 22444e5b757fSkupfer echo "\n==== Copying skeleton closed binaries to" \ 22454e5b757fSkupfer "$ON_CLOSED_BINS ====\n" | \ 22461fe69678Skupfer tee -a $mail_msg_file >> $LOGFILE 22474e5b757fSkupfer 22484e5b757fSkupfer if [ "$D_FLAG" = y ]; then 22494e5b757fSkupfer mkclosed $MACH $ROOT $ON_CLOSED_BINS/root_$MACH >>$LOGFILE 2>&1 22501fe69678Skupfer if [ $? -ne 0 ]; then 22511fe69678Skupfer build_ok=n 22524e5b757fSkupfer echo "Couldn't create DEBUG closed binaries." | 22531fe69678Skupfer tee -a $mail_msg_file >> $LOGFILE 22541fe69678Skupfer fi 22554e5b757fSkupfer fi 22564e5b757fSkupfer if [ "$F_FLAG" = n ]; then 22574e5b757fSkupfer root=$ROOT 22584e5b757fSkupfer [ "$MULTI_PROTO" = yes ] && root=$ROOT-nd 22594e5b757fSkupfer mkclosed $MACH $root $ON_CLOSED_BINS/root_$MACH-nd \ 22604e5b757fSkupfer >>$LOGFILE 2>&1 22614e5b757fSkupfer if [ $? -ne 0 ]; then 22624e5b757fSkupfer build_ok=n 22634e5b757fSkupfer echo "Couldn't create non-DEBUG closed binaries." | 22644e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 22654e5b757fSkupfer fi 22664e5b757fSkupfer fi 22674e5b757fSkupfer 22684e5b757fSkupfer export CLOSED_IS_PRESENT=no 22691fe69678Skupferfi 22701fe69678Skupfer 22711fe69678Skupferif is_source_build && [ $build_ok = y ] ; then 22724e5b757fSkupfer # remove proto area(s) here, since we don't clobber 22734e5b757fSkupfer rm -rf `allprotos` 22747c478bd9Sstevel@tonic-gate if [ "$t_FLAG" = "y" ]; then 22754e5b757fSkupfer set_non_debug_build_flags 2276b91d9e0fSdanmcd ORIG_TOOLS=$TOOLS 22771fe69678Skupfer # 22781fe69678Skupfer # SRC was set earlier to point to the source build 22791fe69678Skupfer # source tree (e.g., $EXPORT_SRC). 22801fe69678Skupfer # 22811fe69678Skupfer TOOLS=${SRC}/tools 22821fe69678Skupfer build_tools ${SRC}/tools/proto 2283b91d9e0fSdanmcd TOOLS=$ORIG_TOOLS 22847c478bd9Sstevel@tonic-gate fi 22857c478bd9Sstevel@tonic-gate 22867c478bd9Sstevel@tonic-gate export EXPORT_RELEASE_BUILD ; EXPORT_RELEASE_BUILD=# 22877c478bd9Sstevel@tonic-gate normal_build 22887c478bd9Sstevel@tonic-gatefi 22897c478bd9Sstevel@tonic-gate 22901fe69678Skupferif [[ "$SO_FLAG" = "y" && "$build_ok" = "y" ]]; then 22911fe69678Skupfer rm -rf $ON_CLOSED_BINS 22921fe69678Skupferfi 22931fe69678Skupfer 22944e5b757fSkupfer# 22954e5b757fSkupfer# There are several checks that need to look at the proto area, but 22964e5b757fSkupfer# they only need to look at one, and they don't care whether it's 22974e5b757fSkupfer# DEBUG or non-DEBUG. 22984e5b757fSkupfer# 22994e5b757fSkupferif [[ "$MULTI_PROTO" = yes && "$D_FLAG" = n ]]; then 23004e5b757fSkupfer checkroot=$ROOT-nd 23014e5b757fSkupferelse 23024e5b757fSkupfer checkroot=$ROOT 23034e5b757fSkupferfi 23044e5b757fSkupfer 23057c478bd9Sstevel@tonic-gateif [ "$build_ok" = "y" ]; then 23067c478bd9Sstevel@tonic-gate echo "\n==== Creating protolist system file at `date` ====" \ 23077c478bd9Sstevel@tonic-gate >> $LOGFILE 23084e5b757fSkupfer protolist $checkroot > $ATLOG/proto_list_${MACH} 23097c478bd9Sstevel@tonic-gate echo "==== protolist system file created at `date` ====\n" \ 23107c478bd9Sstevel@tonic-gate >> $LOGFILE 23117c478bd9Sstevel@tonic-gate 23127c478bd9Sstevel@tonic-gate if [ "$N_FLAG" != "y" ]; then 23137c478bd9Sstevel@tonic-gate echo "\n==== Impact on packages ====\n" >> $mail_msg_file 23147c478bd9Sstevel@tonic-gate 23157c478bd9Sstevel@tonic-gate # If there is a reference proto list, compare the build's proto 23167c478bd9Sstevel@tonic-gate # list with the reference to see changes in proto areas. 23177c478bd9Sstevel@tonic-gate # Use the current exception list. 23187c478bd9Sstevel@tonic-gate exc=etc/exception_list_$MACH 23197c478bd9Sstevel@tonic-gate if [ -f $SRC/pkgdefs/$exc ]; then 23207c478bd9Sstevel@tonic-gate ELIST="-e $SRC/pkgdefs/$exc" 23217c478bd9Sstevel@tonic-gate fi 23226fec3625Sdduvall if [ "$X_FLAG" = "y" -a -f $IA32_IHV_WS/usr/src/pkgdefs/$exc ]; then 23236fec3625Sdduvall ELIST="$ELIST -e $IA32_IHV_WS/usr/src/pkgdefs/$exc" 23246fec3625Sdduvall fi 23257c478bd9Sstevel@tonic-gate 23267c478bd9Sstevel@tonic-gate if [ -f "$REF_PROTO_LIST" ]; then 2327b4add148Sdduvall # For builds that copy the IHV proto area (-X), add the 2328b4add148Sdduvall # IHV proto list to the reference list if the reference 2329b4add148Sdduvall # was built without -X. 2330b4add148Sdduvall # 2331b4add148Sdduvall # For builds that don't copy the IHV proto area, add the 2332b4add148Sdduvall # IHV proto list to the build's proto list if the 2333b4add148Sdduvall # reference was built with -X. 2334b4add148Sdduvall # 2335b4add148Sdduvall # Use the presence of the first file entry of the cached 2336b4add148Sdduvall # IHV proto list in the reference list to determine 2337b4add148Sdduvall # whether it was build with -X or not. 2338b4add148Sdduvall IHV_REF_PROTO_LIST=$SRC/pkgdefs/etc/proto_list_ihv_$MACH 2339b4add148Sdduvall grepfor=$(nawk '$1 == "f" { print $2; exit }' \ 2340b4add148Sdduvall $IHV_REF_PROTO_LIST 2> /dev/null) 2341b4add148Sdduvall if [ $? = 0 -a -n "$grepfor" ]; then 2342b4add148Sdduvall if [ "$X_FLAG" = "y" ]; then 2343b4add148Sdduvall grep -w "$grepfor" \ 2344b4add148Sdduvall $REF_PROTO_LIST > /dev/null 2345b4add148Sdduvall if [ ! "$?" = "0" ]; then 2346b4add148Sdduvall REF_IHV_PROTO="-d $IHV_REF_PROTO_LIST" 2347b4add148Sdduvall fi 2348b4add148Sdduvall else 2349b4add148Sdduvall grep -w "$grepfor" \ 2350b4add148Sdduvall $REF_PROTO_LIST > /dev/null 2351b4add148Sdduvall if [ "$?" = "0" ]; then 2352b4add148Sdduvall IHV_PROTO_LIST="$IHV_REF_PROTO_LIST" 2353b4add148Sdduvall fi 2354b4add148Sdduvall fi 2355b4add148Sdduvall fi 2356b4add148Sdduvall 23577c478bd9Sstevel@tonic-gate $PROTOCMPTERSE \ 23587c478bd9Sstevel@tonic-gate "Files in yesterday's proto area, but not today's:" \ 23597c478bd9Sstevel@tonic-gate "Files in today's proto area, but not yesterday's:" \ 23607c478bd9Sstevel@tonic-gate "Files that changed between yesterday and today:" \ 23617c478bd9Sstevel@tonic-gate ${ELIST} \ 23627c478bd9Sstevel@tonic-gate -d $REF_PROTO_LIST \ 2363b4add148Sdduvall $REF_IHV_PROTO \ 23647c478bd9Sstevel@tonic-gate $ATLOG/proto_list_${MACH} \ 2365b4add148Sdduvall $IHV_PROTO_LIST \ 23667c478bd9Sstevel@tonic-gate >> $mail_msg_file 23677c478bd9Sstevel@tonic-gate fi 23687c478bd9Sstevel@tonic-gate # Compare the build's proto list with current package 23697c478bd9Sstevel@tonic-gate # definitions to audit the quality of package definitions 23707c478bd9Sstevel@tonic-gate # and makefile install targets. Use the current exception list. 2371fb23a357Skupfer PKGDEFS_LIST="" 2372fb23a357Skupfer for d in $abssrcdirs; do 2373fb23a357Skupfer if [ -d $d/pkgdefs ]; then 2374fb23a357Skupfer PKGDEFS_LIST="$PKGDEFS_LIST -d $d/pkgdefs" 2375fb23a357Skupfer fi 2376fb23a357Skupfer done 23776fec3625Sdduvall if [ "$X_FLAG" = "y" -a -d $IA32_IHV_WS/usr/src/pkgdefs ]; then 23786fec3625Sdduvall PKGDEFS_LIST="$PKGDEFS_LIST -d $IA32_IHV_WS/usr/src/pkgdefs" 23796fec3625Sdduvall fi 23807c478bd9Sstevel@tonic-gate 23817c478bd9Sstevel@tonic-gate $PROTOCMPTERSE \ 23827c478bd9Sstevel@tonic-gate "Files missing from the proto area:" \ 23837c478bd9Sstevel@tonic-gate "Files missing from packages:" \ 23847c478bd9Sstevel@tonic-gate "Inconsistencies between pkgdefs and proto area:" \ 23857c478bd9Sstevel@tonic-gate ${ELIST} \ 23867c478bd9Sstevel@tonic-gate ${PKGDEFS_LIST} \ 23877c478bd9Sstevel@tonic-gate $ATLOG/proto_list_${MACH} \ 23887c478bd9Sstevel@tonic-gate >> $mail_msg_file 23897c478bd9Sstevel@tonic-gate fi 23907c478bd9Sstevel@tonic-gatefi 23917c478bd9Sstevel@tonic-gate 23927c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 23937c478bd9Sstevel@tonic-gate staffer cp $ATLOG/proto_list_${MACH} \ 23947c478bd9Sstevel@tonic-gate $PARENT_WS/usr/src/proto_list_${MACH} 23957c478bd9Sstevel@tonic-gatefi 23967c478bd9Sstevel@tonic-gate 23977c478bd9Sstevel@tonic-gate# Update parent proto area if necessary. This is done now 23987c478bd9Sstevel@tonic-gate# so that the proto area has either DEBUG or non-DEBUG kernels. 23997c478bd9Sstevel@tonic-gate# Note that this clears out the lock file, so we can dispense with 24007c478bd9Sstevel@tonic-gate# the variable now. 24017c478bd9Sstevel@tonic-gateif [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then 24027c478bd9Sstevel@tonic-gate echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \ 24037c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 24047c478bd9Sstevel@tonic-gate # The rm -rf command below produces predictable errors if 24057c478bd9Sstevel@tonic-gate # nightly is invoked from the parent's $ROOT/opt/onbld/bin, 24067c478bd9Sstevel@tonic-gate # and that directory is accessed via NFS. This is because 24077c478bd9Sstevel@tonic-gate # deleted-but-still-open files don't actually disappear as 24087c478bd9Sstevel@tonic-gate # expected, but rather turn into .nfsXXXX junk files, leaving 24097c478bd9Sstevel@tonic-gate # the directory non-empty. Since this is a not-unusual usage 24107c478bd9Sstevel@tonic-gate # pattern, and we still want to catch other errors here, we 24117c478bd9Sstevel@tonic-gate # take the unusal step of moving aside 'nightly' from that 24127c478bd9Sstevel@tonic-gate # directory (if we're using it). 24137c478bd9Sstevel@tonic-gate mypath=${0##*/root_$MACH/} 24147c478bd9Sstevel@tonic-gate if [ "$mypath" = $0 ]; then 24157c478bd9Sstevel@tonic-gate mypath=opt/onbld/bin/${0##*/} 24167c478bd9Sstevel@tonic-gate fi 24177c478bd9Sstevel@tonic-gate if [ $0 -ef $PARENT_WS/proto/root_$MACH/$mypath ]; then 24187c478bd9Sstevel@tonic-gate mv -f $0 $PARENT_WS/proto/root_$MACH 24197c478bd9Sstevel@tonic-gate fi 24207c478bd9Sstevel@tonic-gate rm -rf $PARENT_WS/proto/root_$MACH/* 24217c478bd9Sstevel@tonic-gate unset Ulockfile 24227c478bd9Sstevel@tonic-gate mkdir -p $NIGHTLY_PARENT_ROOT 24234e5b757fSkupfer if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then 24247c478bd9Sstevel@tonic-gate cd $ROOT 24254e5b757fSkupfer ( tar cf - . | 24264e5b757fSkupfer ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf - ) ) 2>&1 | 24277c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 24287c478bd9Sstevel@tonic-gate fi 24294e5b757fSkupfer if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n ]]; then 24304e5b757fSkupfer mkdir -p $NIGHTLY_PARENT_ROOT-nd 24314e5b757fSkupfer cd $ROOT-nd 24324e5b757fSkupfer ( tar cf - . | 24334e5b757fSkupfer ( cd $NIGHTLY_PARENT_ROOT-nd; umask 0; tar xpf - ) ) 2>&1 | 24344e5b757fSkupfer tee -a $mail_msg_file >> $LOGFILE 24354e5b757fSkupfer fi 24364e5b757fSkupferfi 24377c478bd9Sstevel@tonic-gate 24387c478bd9Sstevel@tonic-gate# 24397c478bd9Sstevel@tonic-gate# do shared library interface verification 24407c478bd9Sstevel@tonic-gate# 24417c478bd9Sstevel@tonic-gate 24427c478bd9Sstevel@tonic-gateif [ "$A_FLAG" = "y" -a "$build_ok" = "y" ]; then 24437c478bd9Sstevel@tonic-gate echo "\n==== Check versioning and ABI information ====\n" | \ 24447c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 24457c478bd9Sstevel@tonic-gate 24467c478bd9Sstevel@tonic-gate rm -rf $SRC/interfaces.ref 24477c478bd9Sstevel@tonic-gate if [ -d $SRC/interfaces.out ]; then 24487c478bd9Sstevel@tonic-gate mv $SRC/interfaces.out $SRC/interfaces.ref 24497c478bd9Sstevel@tonic-gate fi 24507c478bd9Sstevel@tonic-gate rm -rf $SRC/interfaces.out 24517c478bd9Sstevel@tonic-gate mkdir -p $SRC/interfaces.out 24527c478bd9Sstevel@tonic-gate 24537c478bd9Sstevel@tonic-gate intf_check -V -m -o -b $SRC/tools/abi/etc \ 24544e5b757fSkupfer -d $SRC/interfaces.out $checkroot 2>&1 | sort \ 24557c478bd9Sstevel@tonic-gate > $SRC/interfaces.out/log 24567c478bd9Sstevel@tonic-gate 24577c478bd9Sstevel@tonic-gate # report any ERROR found in log file 24587c478bd9Sstevel@tonic-gate fgrep 'ERROR' $SRC/interfaces.out/log | sed 's/^ERROR: //' | \ 24597c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 24607c478bd9Sstevel@tonic-gate 24617c478bd9Sstevel@tonic-gate if [ ! -d $SRC/interfaces.ref ] ; then 24627c478bd9Sstevel@tonic-gate mkdir -p $SRC/interfaces.ref 24637c478bd9Sstevel@tonic-gate if [ -d $SRC/interfaces.out ]; then 24647c478bd9Sstevel@tonic-gate cp -r $SRC/interfaces.out/* $SRC/interfaces.ref 24657c478bd9Sstevel@tonic-gate fi 24667c478bd9Sstevel@tonic-gate fi 24677c478bd9Sstevel@tonic-gate 24687c478bd9Sstevel@tonic-gate echo "\n==== Diff versioning warnings (since last build) ====\n" | \ 24697c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 24707c478bd9Sstevel@tonic-gate 24717c478bd9Sstevel@tonic-gate out_vers=`grep ^VERSION $SRC/interfaces.out/log`; 24727c478bd9Sstevel@tonic-gate ref_vers=`grep ^VERSION $SRC/interfaces.ref/log`; 24737c478bd9Sstevel@tonic-gate 24747c478bd9Sstevel@tonic-gate # Report any differences in WARNING messages between last 24757c478bd9Sstevel@tonic-gate # and current build. 24767c478bd9Sstevel@tonic-gate if [ "$out_vers" = "$ref_vers" ]; then 24777c478bd9Sstevel@tonic-gate diff $SRC/interfaces.ref/log $SRC/interfaces.out/log | \ 24787c478bd9Sstevel@tonic-gate fgrep 'WARNING' | sed 's/WARNING: //' | \ 24797c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 24807c478bd9Sstevel@tonic-gate fi 24817c478bd9Sstevel@tonic-gatefi 24827c478bd9Sstevel@tonic-gate 24837c478bd9Sstevel@tonic-gateif [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then 24847c478bd9Sstevel@tonic-gate echo "\n==== Check ELF runtime attributes ====\n" | \ 24857c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 24867c478bd9Sstevel@tonic-gate 24877c478bd9Sstevel@tonic-gate LDDUSAGE="^ldd: does not support -e" 24887c478bd9Sstevel@tonic-gate LDDWRONG="wrong class" 24897c478bd9Sstevel@tonic-gate CRLERROR="^crle:" 24907c478bd9Sstevel@tonic-gate CRLECONF="^crle: configuration file:" 24917c478bd9Sstevel@tonic-gate 24927c478bd9Sstevel@tonic-gate rm -f $SRC/runtime.ref 24937c478bd9Sstevel@tonic-gate if [ -f $SRC/runtime.out ]; then 24947c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 24957c478bd9Sstevel@tonic-gate $SRC/runtime.out > $SRC/runtime.ref 24967c478bd9Sstevel@tonic-gate fi 24977c478bd9Sstevel@tonic-gate 24987c478bd9Sstevel@tonic-gate # If we're doing a debug build the proto area will be left with 24997c478bd9Sstevel@tonic-gate # debuggable objects, thus don't assert -s. 25007c478bd9Sstevel@tonic-gate if [ "$D_FLAG" = "y" ]; then 25017c478bd9Sstevel@tonic-gate rtime_sflag="" 25027c478bd9Sstevel@tonic-gate else 25037c478bd9Sstevel@tonic-gate rtime_sflag="-s" 25047c478bd9Sstevel@tonic-gate fi 25054e5b757fSkupfer check_rtime -d $checkroot -i -m -o $rtime_sflag $checkroot 2>&1 | \ 25064e5b757fSkupfer egrep -v ": unreferenced object=$checkroot/.*/lib(w|intl|thread|pthread).so" | \ 25074e5b757fSkupfer egrep -v ": unused object=$checkroot/.*/lib(w|intl|thread|pthread).so" | \ 25087c478bd9Sstevel@tonic-gate sort >$SRC/runtime.out 25097c478bd9Sstevel@tonic-gate 25107c478bd9Sstevel@tonic-gate # Determine any processing errors that will affect the final output 25117c478bd9Sstevel@tonic-gate # and display these first. 25127c478bd9Sstevel@tonic-gate grep -l "$LDDUSAGE" $SRC/runtime.out > /dev/null 25137c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 25147c478bd9Sstevel@tonic-gate echo "WARNING: ldd(1) does not support -e. The version of ldd(1)" | \ 25157c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25167c478bd9Sstevel@tonic-gate echo "on your system is old - 4390308 (s81_30) is required.\n" | \ 25177c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25187c478bd9Sstevel@tonic-gate fi 25197c478bd9Sstevel@tonic-gate grep -l "$LDDWRONG" $SRC/runtime.out > /dev/null 25207c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 25217c478bd9Sstevel@tonic-gate echo "WARNING: wrong class message detected. ldd(1) was unable" | \ 25227c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25237c478bd9Sstevel@tonic-gate echo "to execute an object, thus it could not be checked fully." | \ 25247c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25257c478bd9Sstevel@tonic-gate echo "Perhaps a 64-bit object was encountered on a 32-bit system," | \ 25267c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25277c478bd9Sstevel@tonic-gate echo "or an i386 object was encountered on a sparc system?\n" | \ 25287c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25297c478bd9Sstevel@tonic-gate fi 25307c478bd9Sstevel@tonic-gate grep -l "$CRLECONF" $SRC/runtime.out > /dev/null 25317c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 25327c478bd9Sstevel@tonic-gate echo "WARNING: creation of an alternative dependency cache failed." | \ 25337c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25347c478bd9Sstevel@tonic-gate echo "Dependencies will bind to the base system libraries.\n" | \ 25357c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25367c478bd9Sstevel@tonic-gate grep "$CRLECONF" $SRC/runtime.out | \ 25377c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25387c478bd9Sstevel@tonic-gate grep "$CRLERROR" $SRC/runtime.out | grep -v "$CRLECONF" | \ 25397c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25407c478bd9Sstevel@tonic-gate echo "\n" | tee -a $LOGFILE >> $mail_msg_file 25417c478bd9Sstevel@tonic-gate fi 25427c478bd9Sstevel@tonic-gate 25437c478bd9Sstevel@tonic-gate egrep '<dependency no longer necessary>' $SRC/runtime.out | \ 25447c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25457c478bd9Sstevel@tonic-gate 25467c478bd9Sstevel@tonic-gate # NEEDED= and RPATH= are informational; report anything else that we 25477c478bd9Sstevel@tonic-gate # haven't already. 25487c478bd9Sstevel@tonic-gate egrep -v "NEEDED=|RPATH=|$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 25497c478bd9Sstevel@tonic-gate $SRC/runtime.out | tee -a $LOGFILE >> $mail_msg_file 25507c478bd9Sstevel@tonic-gate 25517c478bd9Sstevel@tonic-gate # probably should compare against a 'known ok runpaths' list 25527c478bd9Sstevel@tonic-gate if [ ! -f $SRC/runtime.ref ]; then 25537c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 25547c478bd9Sstevel@tonic-gate $SRC/runtime.out > $SRC/runtime.ref 25557c478bd9Sstevel@tonic-gate fi 25567c478bd9Sstevel@tonic-gate 25577c478bd9Sstevel@tonic-gate echo "\n==== Diff ELF runtime attributes (since last build) ====\n" \ 25587c478bd9Sstevel@tonic-gate >> $mail_msg_file 25597c478bd9Sstevel@tonic-gate 25607c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" $SRC/runtime.out | \ 25617c478bd9Sstevel@tonic-gate diff $SRC/runtime.ref - >> $mail_msg_file 25627c478bd9Sstevel@tonic-gatefi 25637c478bd9Sstevel@tonic-gate 25647c478bd9Sstevel@tonic-gate# DEBUG lint of kernel begins 25657c478bd9Sstevel@tonic-gate 25667c478bd9Sstevel@tonic-gateif [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 25677c478bd9Sstevel@tonic-gate if [ "$LINTDIRS" = "" ]; then 25687c478bd9Sstevel@tonic-gate # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y" 25697c478bd9Sstevel@tonic-gate LINTDIRS="$SRC y" 25707c478bd9Sstevel@tonic-gate fi 25717c478bd9Sstevel@tonic-gate set $LINTDIRS 25727c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 25737c478bd9Sstevel@tonic-gate dolint $1 $2; shift; shift 25747c478bd9Sstevel@tonic-gate done 25757c478bd9Sstevel@tonic-gateelse 25767c478bd9Sstevel@tonic-gate echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE 25777c478bd9Sstevel@tonic-gatefi 25787c478bd9Sstevel@tonic-gate 25797c478bd9Sstevel@tonic-gate# "make check" begins 25807c478bd9Sstevel@tonic-gate 25817c478bd9Sstevel@tonic-gateif [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then 25827c478bd9Sstevel@tonic-gate # remove old check.out 25837c478bd9Sstevel@tonic-gate rm -f $SRC/check.out 25847c478bd9Sstevel@tonic-gate 25857c478bd9Sstevel@tonic-gate rm -f $SRC/check-${MACH}.out 25867c478bd9Sstevel@tonic-gate cd $SRC 25877c478bd9Sstevel@tonic-gate $MAKE -ek check 2>&1 | tee -a $SRC/check-${MACH}.out >> $LOGFILE 25887c478bd9Sstevel@tonic-gate echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file 25897c478bd9Sstevel@tonic-gate 25907c478bd9Sstevel@tonic-gate grep ":" $SRC/check-${MACH}.out | 25917c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 25927c478bd9Sstevel@tonic-gate sort | uniq >> $mail_msg_file 25937c478bd9Sstevel@tonic-gateelse 25947c478bd9Sstevel@tonic-gate echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE 25957c478bd9Sstevel@tonic-gatefi 25967c478bd9Sstevel@tonic-gate 25977c478bd9Sstevel@tonic-gateecho "\n==== Find core files ====\n" | \ 25987c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 25997c478bd9Sstevel@tonic-gate 2600fb23a357Skupferfind $abssrcdirs -name core -a -type f -exec file {} \; | \ 26017c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 26027c478bd9Sstevel@tonic-gate 26037c478bd9Sstevel@tonic-gateif [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 26047c478bd9Sstevel@tonic-gate echo "\n==== Diff unreferenced files (since last build) ====\n" \ 26057c478bd9Sstevel@tonic-gate | tee -a $LOGFILE >>$mail_msg_file 26067c478bd9Sstevel@tonic-gate rm -f $SRC/unref-${MACH}.ref 26077c478bd9Sstevel@tonic-gate if [ -f $SRC/unref-${MACH}.out ]; then 26087c478bd9Sstevel@tonic-gate mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 26097c478bd9Sstevel@tonic-gate fi 26107c478bd9Sstevel@tonic-gate 2611fb23a357Skupfer findunref -t $SRC/.build.tstamp $SRC/.. \ 2612fb23a357Skupfer ${TOOLS}/findunref/exception_list \ 2613fb23a357Skupfer 2>> $mail_msg_file | sort | \ 2614fb23a357Skupfer sed -e s=^./src/=./= -e s=^./closed/=../closed/= \ 2615fb23a357Skupfer > $SRC/unref-${MACH}.out 26167c478bd9Sstevel@tonic-gate 26177c478bd9Sstevel@tonic-gate if [ ! -f $SRC/unref-${MACH}.ref ]; then 26187c478bd9Sstevel@tonic-gate cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 26197c478bd9Sstevel@tonic-gate fi 26207c478bd9Sstevel@tonic-gate 26217c478bd9Sstevel@tonic-gate diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file 26227c478bd9Sstevel@tonic-gatefi 26237c478bd9Sstevel@tonic-gate 26247c478bd9Sstevel@tonic-gate# Verify that the usual lists of files, such as exception lists, 26257c478bd9Sstevel@tonic-gate# contain only valid references to files. If the build has failed, 26267c478bd9Sstevel@tonic-gate# then don't check the proto area. 26277c478bd9Sstevel@tonic-gateCHECK_PATHS=${CHECK_PATHS:-y} 26287c478bd9Sstevel@tonic-gateif [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then 26297c478bd9Sstevel@tonic-gate echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \ 26307c478bd9Sstevel@tonic-gate >>$mail_msg_file 26317c478bd9Sstevel@tonic-gate arg=-b 26327c478bd9Sstevel@tonic-gate [ "$build_ok" = y ] && arg= 26334e5b757fSkupfer checkpaths $arg $checkroot 2>&1 | tee -a $LOGFILE >>$mail_msg_file 26347c478bd9Sstevel@tonic-gatefi 26357c478bd9Sstevel@tonic-gate 26367c478bd9Sstevel@tonic-gateif [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then 26377c478bd9Sstevel@tonic-gate echo "\n==== Impact on file permissions ====\n" \ 26387c478bd9Sstevel@tonic-gate >> $mail_msg_file 26397c478bd9Sstevel@tonic-gate # 26407c478bd9Sstevel@tonic-gate # Get pkginfo files from usr/src/pkgdefs 26417c478bd9Sstevel@tonic-gate # 26427c478bd9Sstevel@tonic-gate pmodes -qvdP \ 2643fb9f9b97Skupfer `for d in $abssrcdirs; do 2644fb9f9b97Skupfer if [ -d "$d/pkgdefs" ] 26457c478bd9Sstevel@tonic-gate then 2646fb9f9b97Skupfer find $d/pkgdefs -name pkginfo.tmpl -print -o -name .del\* -prune 26477c478bd9Sstevel@tonic-gate fi 26487c478bd9Sstevel@tonic-gate done | sed -e 's:/pkginfo.tmpl$::' | sort -u ` >> $mail_msg_file 26497c478bd9Sstevel@tonic-gatefi 26507c478bd9Sstevel@tonic-gate 265196ccc8cbSesaxeif [ "$w_FLAG" = "y" -a "$build_ok" = "y" ]; then 26524e5b757fSkupfer if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then 26534e5b757fSkupfer do_wsdiff DEBUG $ROOT.prev $ROOT 26544e5b757fSkupfer fi 265596ccc8cbSesaxe 26564e5b757fSkupfer if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n ]]; then 26574e5b757fSkupfer do_wsdiff non-DEBUG $ROOT-nd.prev $ROOT-nd 265896ccc8cbSesaxe fi 265996ccc8cbSesaxefi 266096ccc8cbSesaxe 26617c478bd9Sstevel@tonic-gateEND_DATE=`date` 26627c478bd9Sstevel@tonic-gateecho "==== Nightly $maketype build completed: $END_DATE ====" | \ 26637c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 26647c478bd9Sstevel@tonic-gate 26657c478bd9Sstevel@tonic-gatetypeset -Z2 minutes 26667c478bd9Sstevel@tonic-gatetypeset -Z2 seconds 26677c478bd9Sstevel@tonic-gate 26687c478bd9Sstevel@tonic-gateelapsed_time=$SECONDS 26697c478bd9Sstevel@tonic-gate((hours = elapsed_time / 3600 )) 26707c478bd9Sstevel@tonic-gate((minutes = elapsed_time / 60 % 60)) 26717c478bd9Sstevel@tonic-gate((seconds = elapsed_time % 60)) 26727c478bd9Sstevel@tonic-gate 26737c478bd9Sstevel@tonic-gateecho "\n==== Total build time ====" | \ 26747c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 26757c478bd9Sstevel@tonic-gateecho "\nreal ${hours}:${minutes}:${seconds}" | \ 26767c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 26777c478bd9Sstevel@tonic-gate 26787c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" -a "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 26797c478bd9Sstevel@tonic-gate staffer cp ${SRC}/unref-${MACH}.out $PARENT_WS/usr/src/ 26807c478bd9Sstevel@tonic-gate 26817c478bd9Sstevel@tonic-gate # 26827c478bd9Sstevel@tonic-gate # Produce a master list of unreferenced files -- ideally, we'd 26837c478bd9Sstevel@tonic-gate # generate the master just once after all of the nightlies 26847c478bd9Sstevel@tonic-gate # have finished, but there's no simple way to know when that 26857c478bd9Sstevel@tonic-gate # will be. Instead, we assume that we're the last nightly to 26867c478bd9Sstevel@tonic-gate # finish and merge all of the unref-${MACH}.out files in 26877c478bd9Sstevel@tonic-gate # $PARENT_WS/usr/src/. If we are in fact the final ${MACH} to 26887c478bd9Sstevel@tonic-gate # finish, then this file will be the authoritative master 26897c478bd9Sstevel@tonic-gate # list. Otherwise, another ${MACH}'s nightly will eventually 26907c478bd9Sstevel@tonic-gate # overwrite ours with its own master, but in the meantime our 26917c478bd9Sstevel@tonic-gate # temporary "master" will be no worse than any older master 26927c478bd9Sstevel@tonic-gate # which was already on the parent. 26937c478bd9Sstevel@tonic-gate # 26947c478bd9Sstevel@tonic-gate 26957c478bd9Sstevel@tonic-gate set -- $PARENT_WS/usr/src/unref-*.out 26967c478bd9Sstevel@tonic-gate cp "$1" ${TMPDIR}/unref.merge 26977c478bd9Sstevel@tonic-gate shift 26987c478bd9Sstevel@tonic-gate 26997c478bd9Sstevel@tonic-gate for unreffile; do 27007c478bd9Sstevel@tonic-gate comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$ 27017c478bd9Sstevel@tonic-gate mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge 27027c478bd9Sstevel@tonic-gate done 27037c478bd9Sstevel@tonic-gate 27047c478bd9Sstevel@tonic-gate staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out 27057c478bd9Sstevel@tonic-gatefi 27067c478bd9Sstevel@tonic-gate 27077c478bd9Sstevel@tonic-gate# 27087c478bd9Sstevel@tonic-gate# All done save for the sweeping up. 27097c478bd9Sstevel@tonic-gate# (whichever exit we hit here will trigger the "cleanup" trap which 27107c478bd9Sstevel@tonic-gate# optionally sends mail on completion). 27117c478bd9Sstevel@tonic-gate# 27127c478bd9Sstevel@tonic-gateif [ "$build_ok" = "y" ]; then 27137c478bd9Sstevel@tonic-gate exit 0 27147c478bd9Sstevel@tonic-gatefi 27157c478bd9Sstevel@tonic-gateexit 1 2716