17c478bd9Sstevel@tonic-gate#!/bin/ksh -p 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6fb23a357Skupfer# Common Development and Distribution License (the "License"). 7fb23a357Skupfer# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 227c478bd9Sstevel@tonic-gate# 231c79753fSdarrenm# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate# 287c478bd9Sstevel@tonic-gate# Based on the nightly script from the integration folks, 297c478bd9Sstevel@tonic-gate# Mostly modified and owned by mike_s. 307c478bd9Sstevel@tonic-gate# Changes also by kjc, dmk. 317c478bd9Sstevel@tonic-gate# 327c478bd9Sstevel@tonic-gate# BRINGOVER_WS may be specified in the env file. 337c478bd9Sstevel@tonic-gate# The default is the old behavior of CLONE_WS 347c478bd9Sstevel@tonic-gate# 357c478bd9Sstevel@tonic-gate# -i on the command line, means fast options, so when it's on the 367c478bd9Sstevel@tonic-gate# command line (only), lint, check, GPROF and TRACE builds are skipped 377c478bd9Sstevel@tonic-gate# no matter what the setting of their individual flags are in NIGHTLY_OPTIONS. 387c478bd9Sstevel@tonic-gate# 397c478bd9Sstevel@tonic-gate# LINTDIRS can be set in the env file, format is a list of: 407c478bd9Sstevel@tonic-gate# 417c478bd9Sstevel@tonic-gate# /dirname-to-run-lint-on flag 427c478bd9Sstevel@tonic-gate# 437c478bd9Sstevel@tonic-gate# Where flag is: y - enable lint noise diff output 447c478bd9Sstevel@tonic-gate# n - disable lint noise diff output 457c478bd9Sstevel@tonic-gate# 467c478bd9Sstevel@tonic-gate# For example: LINTDIRS="$SRC/uts n $SRC/stand y $SRC/psm y" 477c478bd9Sstevel@tonic-gate# 487c478bd9Sstevel@tonic-gate# -A flag in NIGHTLY_OPTIONS checks ABI diffs in .so files 497c478bd9Sstevel@tonic-gate# This option requires a couple of scripts. 507c478bd9Sstevel@tonic-gate# 517c478bd9Sstevel@tonic-gate# OPTHOME and TEAMWARE may be set in the environment to override /opt 527c478bd9Sstevel@tonic-gate# and /opt/teamware defaults. 537c478bd9Sstevel@tonic-gate# 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate# 567c478bd9Sstevel@tonic-gate# The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout 577c478bd9Sstevel@tonic-gate# under certain circumstances, which can really screw things up; unset it. 587c478bd9Sstevel@tonic-gate# 597c478bd9Sstevel@tonic-gateunset CDPATH 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate# function to do a DEBUG and non-DEBUG build. Needed because we might 627c478bd9Sstevel@tonic-gate# need to do another for the source build, and since we only deliver DEBUG or 637c478bd9Sstevel@tonic-gate# non-DEBUG packages. 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gatenormal_build() { 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate # timestamp the start of a nightly build; the findunref tool uses it. 687c478bd9Sstevel@tonic-gate touch $SRC/.build.tstamp 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate # non-DEBUG build begins 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate if [ "$F_FLAG" = "n" ]; then 737c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 747c478bd9Sstevel@tonic-gate export RELEASE_BUILD ; RELEASE_BUILD= 757c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 767c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate build non-DEBUG -nd 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a "$p_FLAG" = "y" ]; then 817c478bd9Sstevel@tonic-gate copy_ihv_pkgs non-DEBUG -nd 827c478bd9Sstevel@tonic-gate fi 837c478bd9Sstevel@tonic-gate else 847c478bd9Sstevel@tonic-gate echo "\n==== No non-DEBUG build ====\n" >> $LOGFILE 857c478bd9Sstevel@tonic-gate fi 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate # non-DEBUG build ends 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate # DEBUG build begins 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate if [ "$D_FLAG" = "y" ]; then 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 947c478bd9Sstevel@tonic-gate unset RELEASE_BUILD 957c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 967c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate build DEBUG "" 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a "$p_FLAG" = "y" ]; then 1017c478bd9Sstevel@tonic-gate copy_ihv_pkgs DEBUG "" 1027c478bd9Sstevel@tonic-gate fi 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate else 1057c478bd9Sstevel@tonic-gate echo "\n==== No DEBUG build ====\n" >> $LOGFILE 1067c478bd9Sstevel@tonic-gate fi 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate # DEBUG build ends 1097c478bd9Sstevel@tonic-gate} 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gatefilelist() { 1127c478bd9Sstevel@tonic-gate if [ $# -ne 2 ]; then 1137c478bd9Sstevel@tonic-gate echo "usage: filelist DESTDIR PATTERN" 1147c478bd9Sstevel@tonic-gate exit 1; 1157c478bd9Sstevel@tonic-gate fi 1167c478bd9Sstevel@tonic-gate DEST=$1 1177c478bd9Sstevel@tonic-gate PATTERN=$2 1187c478bd9Sstevel@tonic-gate cd ${DEST} 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate OBJFILES=${ORIG_SRC}/xmod/obj_files 1217c478bd9Sstevel@tonic-gate if [ ! -f ${OBJFILES} ]; then 1227c478bd9Sstevel@tonic-gate return; 1237c478bd9Sstevel@tonic-gate fi 1247c478bd9Sstevel@tonic-gate for i in `grep -v '^#' ${ORIG_SRC}/xmod/obj_files | \ 1257c478bd9Sstevel@tonic-gate grep ${PATTERN} | cut -d: -f2 | tr -d ' \t'` 1267c478bd9Sstevel@tonic-gate do 1277c478bd9Sstevel@tonic-gate # wildcard expansion 1287c478bd9Sstevel@tonic-gate for j in $i 1297c478bd9Sstevel@tonic-gate do 1307c478bd9Sstevel@tonic-gate if [ -f "$j" ]; then 1317c478bd9Sstevel@tonic-gate echo $j 1327c478bd9Sstevel@tonic-gate fi 1337c478bd9Sstevel@tonic-gate if [ -d "$j" ]; then 1347c478bd9Sstevel@tonic-gate echo $j 1357c478bd9Sstevel@tonic-gate fi 1367c478bd9Sstevel@tonic-gate done 1377c478bd9Sstevel@tonic-gate done | sort | uniq 1387c478bd9Sstevel@tonic-gate} 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate# function to save off binaries after a full build for later 1417c478bd9Sstevel@tonic-gate# restoration 1427c478bd9Sstevel@tonic-gatesave_binaries() { 1437c478bd9Sstevel@tonic-gate # save off list of binaries 1447c478bd9Sstevel@tonic-gate echo "\n==== Saving binaries from build at `date` ====\n" | \ 1457c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 1467c478bd9Sstevel@tonic-gate rm -f ${BINARCHIVE} 1477c478bd9Sstevel@tonic-gate cd ${CODEMGR_WS} 1487c478bd9Sstevel@tonic-gate filelist ${CODEMGR_WS} '^preserve:' >> $LOGFILE 1497c478bd9Sstevel@tonic-gate filelist ${CODEMGR_WS} '^preserve:' | \ 1507c478bd9Sstevel@tonic-gate cpio -ocB 2>/dev/null | compress \ 1517c478bd9Sstevel@tonic-gate > ${BINARCHIVE} 1527c478bd9Sstevel@tonic-gate} 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate# delete files 1557c478bd9Sstevel@tonic-gatehybridize_files() { 1567c478bd9Sstevel@tonic-gate if [ $# -ne 2 ]; then 1577c478bd9Sstevel@tonic-gate echo "usage: hybridize_files DESTDIR MAKE_TARGET" 1587c478bd9Sstevel@tonic-gate exit 1; 1597c478bd9Sstevel@tonic-gate fi 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate DEST=$1 1627c478bd9Sstevel@tonic-gate MAKETARG=$2 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate echo "\n==== Hybridizing files at `date` ====\n" | \ 1657c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 1667c478bd9Sstevel@tonic-gate for i in `filelist ${DEST} '^delete:'` 1677c478bd9Sstevel@tonic-gate do 1687c478bd9Sstevel@tonic-gate echo "removing ${i}." | tee -a $mail_msg_file >> $LOGFILE 1697c478bd9Sstevel@tonic-gate rm -rf "${i}" 1707c478bd9Sstevel@tonic-gate done 1717c478bd9Sstevel@tonic-gate for i in `filelist ${DEST} '^hybridize:' ` 1727c478bd9Sstevel@tonic-gate do 1737c478bd9Sstevel@tonic-gate echo "hybridizing ${i}." | tee -a $mail_msg_file >> $LOGFILE 1747c478bd9Sstevel@tonic-gate rm -f ${i}+ 1757c478bd9Sstevel@tonic-gate sed -e "/^# HYBRID DELETE START/,/^# HYBRID DELETE END/d" \ 1767c478bd9Sstevel@tonic-gate < ${i} > ${i}+ 1777c478bd9Sstevel@tonic-gate mv ${i}+ ${i} 1787c478bd9Sstevel@tonic-gate done 1797c478bd9Sstevel@tonic-gate} 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate# restore binaries into the proper source tree. 1827c478bd9Sstevel@tonic-gaterestore_binaries() { 1837c478bd9Sstevel@tonic-gate if [ $# -ne 2 ]; then 1847c478bd9Sstevel@tonic-gate echo "usage: restore_binaries DESTDIR MAKE_TARGET" 1857c478bd9Sstevel@tonic-gate exit 1; 1867c478bd9Sstevel@tonic-gate fi 1877c478bd9Sstevel@tonic-gate 1887c478bd9Sstevel@tonic-gate DEST=$1 1897c478bd9Sstevel@tonic-gate MAKETARG=$2 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate echo "\n==== Restoring binaries to ${MAKETARG} at `date` ====\n" | \ 1927c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 1937c478bd9Sstevel@tonic-gate cd ${DEST} 1947c478bd9Sstevel@tonic-gate zcat ${BINARCHIVE} | \ 1957c478bd9Sstevel@tonic-gate cpio -idmucvB 2>/dev/null | tee -a $mail_msg_file >> ${LOGFILE} 1967c478bd9Sstevel@tonic-gate} 1977c478bd9Sstevel@tonic-gate 1987c478bd9Sstevel@tonic-gate# rename files we save binaries of 1997c478bd9Sstevel@tonic-gaterename_files() { 2007c478bd9Sstevel@tonic-gate if [ $# -ne 2 ]; then 2017c478bd9Sstevel@tonic-gate echo "usage: rename_files DESTDIR MAKE_TARGET" 2027c478bd9Sstevel@tonic-gate exit 1; 2037c478bd9Sstevel@tonic-gate fi 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate DEST=$1 2067c478bd9Sstevel@tonic-gate MAKETARG=$2 2077c478bd9Sstevel@tonic-gate echo "\n==== Renaming source files in ${MAKETARG} at `date` ====\n" | \ 2087c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2097c478bd9Sstevel@tonic-gate for i in `filelist ${DEST} '^rename:'` 2107c478bd9Sstevel@tonic-gate do 2117c478bd9Sstevel@tonic-gate echo ${i} | tee -a $mail_msg_file >> ${LOGFILE} 2127c478bd9Sstevel@tonic-gate rm -f ${i}.export 2137c478bd9Sstevel@tonic-gate mv ${i} ${i}.export 2147c478bd9Sstevel@tonic-gate done 2157c478bd9Sstevel@tonic-gate} 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate# function to create the export/crypt source tree 2187c478bd9Sstevel@tonic-gate# usage: clone_source CODEMGR_WS DESTDIR MAKE_TARGET 2197c478bd9Sstevel@tonic-gate 2207c478bd9Sstevel@tonic-gateclone_source() { 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate if [ $# -ne 3 ]; then 2237c478bd9Sstevel@tonic-gate echo "usage: clone_source CODEMGR_WS DESTDIR MAKE_TARGET" 2247c478bd9Sstevel@tonic-gate exit 1; 2257c478bd9Sstevel@tonic-gate fi 2267c478bd9Sstevel@tonic-gate WS=$1 2277c478bd9Sstevel@tonic-gate DEST=$2 2287c478bd9Sstevel@tonic-gate MAKETARG=$3 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate echo "\n==== Creating ${DEST} source from ${WS} (${MAKETARG}) ====\n" | \ 2317c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2327c478bd9Sstevel@tonic-gate 2337c478bd9Sstevel@tonic-gate echo "cleaning out ${DEST}." >> $LOGFILE 2347c478bd9Sstevel@tonic-gate rm -rf "${DEST}" >> $LOGFILE 2>&1 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate mkdir -p ${DEST} 2377c478bd9Sstevel@tonic-gate cd ${WS} 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate echo "creating ${DEST}." >> $LOGFILE 240fb23a357Skupfer find usr -name 's\.*' -a -type f -print | \ 2417c478bd9Sstevel@tonic-gate sed -e 's,SCCS\/s.,,' | \ 2427c478bd9Sstevel@tonic-gate grep -v '/\.del-*' | \ 2437c478bd9Sstevel@tonic-gate cpio -pd ${DEST} >>$LOGFILE 2>&1 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate SRC=${DEST}/usr/src 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate cd $SRC 2487c478bd9Sstevel@tonic-gate rm -f ${MAKETARG}.out 2497c478bd9Sstevel@tonic-gate echo "making ${MAKETARG} in ${SRC}." >> $LOGFILE 2507c478bd9Sstevel@tonic-gate /bin/time $MAKE -e ${MAKETARG} 2>&1 | \ 2517c478bd9Sstevel@tonic-gate tee -a $SRC/${MAKETARG}.out >> $LOGFILE 2527c478bd9Sstevel@tonic-gate echo "\n==== ${MAKETARG} build errors ====\n" >> $mail_msg_file 2537c478bd9Sstevel@tonic-gate egrep ":" $SRC/${MAKETARG}.out | \ 2547c478bd9Sstevel@tonic-gate egrep -e "(^${MAKE}:|[ ]error[: \n])" | \ 2557c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 2567c478bd9Sstevel@tonic-gate egrep -v "warning" >> $mail_msg_file 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gate echo "clearing state files." >> $LOGFILE 2597c478bd9Sstevel@tonic-gate find . -name '.make*' -exec rm -f {} \; 2607c478bd9Sstevel@tonic-gate 2617c478bd9Sstevel@tonic-gate cd ${DEST} 2627c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "CRYPT_SRC" ]; then 2637c478bd9Sstevel@tonic-gate rm -f ${CODEMGR_WS}/crypt_files.cpio.Z 2647c478bd9Sstevel@tonic-gate echo "\n==== xmod/cry_files that don't exist ====\n" | \ 2657c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2667c478bd9Sstevel@tonic-gate CRYPT_FILES=${WS}/usr/src/xmod/cry_files 2677c478bd9Sstevel@tonic-gate for i in `cat ${CRYPT_FILES}` 2687c478bd9Sstevel@tonic-gate do 2697c478bd9Sstevel@tonic-gate # make sure the files exist 2707c478bd9Sstevel@tonic-gate if [ -f "$i" ]; then 2717c478bd9Sstevel@tonic-gate continue 2727c478bd9Sstevel@tonic-gate fi 2737c478bd9Sstevel@tonic-gate if [ -d "$i" ]; then 2747c478bd9Sstevel@tonic-gate continue 2757c478bd9Sstevel@tonic-gate fi 2767c478bd9Sstevel@tonic-gate echo "$i" | tee -a $mail_msg_file >> $LOGFILE 2777c478bd9Sstevel@tonic-gate done 2787c478bd9Sstevel@tonic-gate find `cat ${CRYPT_FILES}` -print 2>/dev/null | \ 2797c478bd9Sstevel@tonic-gate cpio -ocB 2>/dev/null | \ 2807c478bd9Sstevel@tonic-gate compress > ${CODEMGR_WS}/crypt_files.cpio.Z 2817c478bd9Sstevel@tonic-gate fi 2827c478bd9Sstevel@tonic-gate 2837c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "EXPORT_SRC" ]; then 2847c478bd9Sstevel@tonic-gate # rename first, since we might restore a file 2857c478bd9Sstevel@tonic-gate # of the same name (mapfiles) 2867c478bd9Sstevel@tonic-gate rename_files ${EXPORT_SRC} EXPORT_SRC 2877c478bd9Sstevel@tonic-gate if [ "$SH_FLAG" = "y" ]; then 2887c478bd9Sstevel@tonic-gate hybridize_files ${EXPORT_SRC} EXPORT_SRC 2897c478bd9Sstevel@tonic-gate fi 2907c478bd9Sstevel@tonic-gate fi 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate # save the cleartext 2937c478bd9Sstevel@tonic-gate echo "\n==== Creating ${MAKETARG}.cpio.Z ====\n" | \ 2947c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 2957c478bd9Sstevel@tonic-gate cd ${DEST} 2967c478bd9Sstevel@tonic-gate rm -f ${MAKETARG}.cpio.Z 297fb23a357Skupfer find usr -depth -print | \ 2987c478bd9Sstevel@tonic-gate grep -v usr/src/${MAKETARG}.out | \ 2997c478bd9Sstevel@tonic-gate cpio -ocB 2>/dev/null | \ 3007c478bd9Sstevel@tonic-gate compress > ${CODEMGR_WS}/${MAKETARG}.cpio.Z 3017c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "EXPORT_SRC" ]; then 3027c478bd9Sstevel@tonic-gate restore_binaries ${EXPORT_SRC} EXPORT_SRC 3037c478bd9Sstevel@tonic-gate fi 3047c478bd9Sstevel@tonic-gate 3057c478bd9Sstevel@tonic-gate if [ "${MAKETARG}" = "CRYPT_SRC" ]; then 3067c478bd9Sstevel@tonic-gate restore_binaries ${CRYPT_SRC} CRYPT_SRC 3077c478bd9Sstevel@tonic-gate fi 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate} 3107c478bd9Sstevel@tonic-gate 3117c478bd9Sstevel@tonic-gate# function to do the build. 3127c478bd9Sstevel@tonic-gate# usage: build LABEL SUFFIX 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gatebuild() { 3157c478bd9Sstevel@tonic-gate 3167c478bd9Sstevel@tonic-gate if [ $# -ne 2 ]; then 3177c478bd9Sstevel@tonic-gate echo "usage: build LABEL SUFFIX" 3187c478bd9Sstevel@tonic-gate exit 1; 3197c478bd9Sstevel@tonic-gate fi 3207c478bd9Sstevel@tonic-gate 3217c478bd9Sstevel@tonic-gate LABEL=$1 3227c478bd9Sstevel@tonic-gate SUFFIX=$2 3237c478bd9Sstevel@tonic-gate INSTALLOG=install${SUFFIX}-${MACH} 3247c478bd9Sstevel@tonic-gate NOISE=noise${SUFFIX}-${MACH} 3257c478bd9Sstevel@tonic-gate CPIODIR=${CPIODIR_ORIG}${SUFFIX} 3267c478bd9Sstevel@tonic-gate PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX} 327d8fd4470Sjg if [ "$SPARC_RM_PKGARCHIVE_ORIG" ]; then 328d8fd4470Sjg SPARC_RM_PKGARCHIVE=${SPARC_RM_PKGARCHIVE_ORIG}${SUFFIX} 329d8fd4470Sjg fi 3307c478bd9Sstevel@tonic-gate 3317c478bd9Sstevel@tonic-gate #remove old logs 3327c478bd9Sstevel@tonic-gate OLDINSTALLOG=install${SUFFIX} 3337c478bd9Sstevel@tonic-gate OLDNOISE=noise${SUFFIX} 3347c478bd9Sstevel@tonic-gate rm -f $SRC/${OLDINSTALLOG}.out 3357c478bd9Sstevel@tonic-gate rm -f $SRC/${OLDNOISE}.ref 3367c478bd9Sstevel@tonic-gate if [ -f $SRC/${OLDNOISE}.out ]; then 3377c478bd9Sstevel@tonic-gate mv $SRC/${OLDNOISE}.out $SRC/${NOISE}.ref 3387c478bd9Sstevel@tonic-gate fi 3397c478bd9Sstevel@tonic-gate 3407c478bd9Sstevel@tonic-gate this_build_ok=y 3417c478bd9Sstevel@tonic-gate # 3427c478bd9Sstevel@tonic-gate # Build OS-Networking source 3437c478bd9Sstevel@tonic-gate # 3447c478bd9Sstevel@tonic-gate echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \ 3457c478bd9Sstevel@tonic-gate >> $LOGFILE 3467c478bd9Sstevel@tonic-gate 3477c478bd9Sstevel@tonic-gate rm -f $SRC/${INSTALLOG}.out 3487c478bd9Sstevel@tonic-gate cd $SRC 3497c478bd9Sstevel@tonic-gate /bin/time $MAKE -e install 2>&1 | \ 3507c478bd9Sstevel@tonic-gate tee -a $SRC/${INSTALLOG}.out >> $LOGFILE 351*32f1e47bSsommerfe 352*32f1e47bSsommerfe echo "\n==== SCCS Noise ($LABEL) ====\n" >> $mail_msg_file 353*32f1e47bSsommerfe 354*32f1e47bSsommerfe egrep 'sccs(check| get)' $SRC/${INSTALLOG}.out >> $mail_msg_file 355*32f1e47bSsommerfe 3567c478bd9Sstevel@tonic-gate echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file 3577c478bd9Sstevel@tonic-gate egrep ":" $SRC/${INSTALLOG}.out | 3587c478bd9Sstevel@tonic-gate egrep -e "(^${MAKE}:|[ ]error[: \n])" | \ 3597c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 3607c478bd9Sstevel@tonic-gate egrep -v "cc .* -o error " | \ 3617c478bd9Sstevel@tonic-gate egrep -v "warning" >> $mail_msg_file 3627c478bd9Sstevel@tonic-gate if [ "$?" = "0" ]; then 3637c478bd9Sstevel@tonic-gate build_ok=n 3647c478bd9Sstevel@tonic-gate this_build_ok=n 3657c478bd9Sstevel@tonic-gate fi 3667c478bd9Sstevel@tonic-gate grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \ 3677c478bd9Sstevel@tonic-gate >> $mail_msg_file 3687c478bd9Sstevel@tonic-gate if [ "$?" = "0" ]; then 3697c478bd9Sstevel@tonic-gate build_ok=n 3707c478bd9Sstevel@tonic-gate this_build_ok=n 3717c478bd9Sstevel@tonic-gate fi 3727c478bd9Sstevel@tonic-gate 3737c478bd9Sstevel@tonic-gate if [ "$W_FLAG" = "n" ]; then 3747c478bd9Sstevel@tonic-gate echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file 3757c478bd9Sstevel@tonic-gate # should be none, but there are a few that are pmake 3767c478bd9Sstevel@tonic-gate # related, and a couple of silly ones. 3777c478bd9Sstevel@tonic-gate egrep -i warning: $SRC/${INSTALLOG}.out \ 3787c478bd9Sstevel@tonic-gate | egrep -v '^tic:' \ 3797c478bd9Sstevel@tonic-gate | egrep -v '^mcs:' \ 3807c478bd9Sstevel@tonic-gate | egrep -v '^LD_LIBRARY_PATH=' \ 3817c478bd9Sstevel@tonic-gate | egrep -v 'multiple use of -K option' \ 3827c478bd9Sstevel@tonic-gate | egrep -v 'option -I appears more than once' \ 3837c478bd9Sstevel@tonic-gate | egrep -v 'ar: creating' \ 3847c478bd9Sstevel@tonic-gate | egrep -v 'ar: writing' \ 3857c478bd9Sstevel@tonic-gate | egrep -v 'conflicts:' \ 3867c478bd9Sstevel@tonic-gate | egrep -v ':saved created' \ 3877c478bd9Sstevel@tonic-gate | egrep -v '^stty.*c:' \ 3887c478bd9Sstevel@tonic-gate | egrep -v '^mfgname.c:' \ 3897c478bd9Sstevel@tonic-gate | egrep -v '^uname-i.c:' \ 3907c478bd9Sstevel@tonic-gate | egrep -v '^volumes.c:' \ 3917c478bd9Sstevel@tonic-gate | egrep -v '^lint library construction:' \ 3927c478bd9Sstevel@tonic-gate | egrep -v 'tsort: INFORM:' \ 3937c478bd9Sstevel@tonic-gate | egrep -v 'stripalign:' \ 3947c478bd9Sstevel@tonic-gate | egrep -v 'chars, width' \ 3957c478bd9Sstevel@tonic-gate | egrep -v 'option -zdefs/nodefs appears more than' \ 3967c478bd9Sstevel@tonic-gate | egrep -v "symbol \`timezone' has differing types:" \ 3977c478bd9Sstevel@tonic-gate | egrep -v "parameter <PSTAMP> set to" \ 3987c478bd9Sstevel@tonic-gate | egrep -v "^Manifying" \ 3997c478bd9Sstevel@tonic-gate | egrep -v "Ignoring unknown host" \ 4007c478bd9Sstevel@tonic-gate | egrep -v "redefining segment flags attribute for" \ 4017c478bd9Sstevel@tonic-gate >> $mail_msg_file 4027c478bd9Sstevel@tonic-gate fi 4037c478bd9Sstevel@tonic-gate 4047c478bd9Sstevel@tonic-gate echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \ 4057c478bd9Sstevel@tonic-gate >> $LOGFILE 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gate echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file 4087c478bd9Sstevel@tonic-gate tail -3 $SRC/${INSTALLOG}.out >>$mail_msg_file 4097c478bd9Sstevel@tonic-gate 4107c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "n" -a "$W_FLAG" = "n" ]; then 4117c478bd9Sstevel@tonic-gate rm -f $SRC/${NOISE}.ref 4127c478bd9Sstevel@tonic-gate if [ -f $SRC/${NOISE}.out ]; then 4137c478bd9Sstevel@tonic-gate mv $SRC/${NOISE}.out $SRC/${NOISE}.ref 4147c478bd9Sstevel@tonic-gate fi 4157c478bd9Sstevel@tonic-gate grep : $SRC/${INSTALLOG}.out \ 4167c478bd9Sstevel@tonic-gate | egrep -v '^/' \ 4177c478bd9Sstevel@tonic-gate | egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \ 4187c478bd9Sstevel@tonic-gate | egrep -v '^tic:' \ 4197c478bd9Sstevel@tonic-gate | egrep -v '^mcs' \ 4207c478bd9Sstevel@tonic-gate | egrep -v '^LD_LIBRARY_PATH=' \ 4217c478bd9Sstevel@tonic-gate | egrep -v 'multiple use of -K option' \ 4227c478bd9Sstevel@tonic-gate | egrep -v 'option -I appears more than once' \ 4237c478bd9Sstevel@tonic-gate | egrep -v 'ar: creating' \ 4247c478bd9Sstevel@tonic-gate | egrep -v 'ar: writing' \ 4257c478bd9Sstevel@tonic-gate | egrep -v 'conflicts:' \ 4267c478bd9Sstevel@tonic-gate | egrep -v ':saved created' \ 4277c478bd9Sstevel@tonic-gate | egrep -v '^stty.*c:' \ 4287c478bd9Sstevel@tonic-gate | egrep -v '^mfgname.c:' \ 4297c478bd9Sstevel@tonic-gate | egrep -v '^uname-i.c:' \ 4307c478bd9Sstevel@tonic-gate | egrep -v '^volumes.c:' \ 4317c478bd9Sstevel@tonic-gate | egrep -v '^lint library construction:' \ 4327c478bd9Sstevel@tonic-gate | egrep -v 'tsort: INFORM:' \ 4337c478bd9Sstevel@tonic-gate | egrep -v 'stripalign:' \ 4347c478bd9Sstevel@tonic-gate | egrep -v 'chars, width' \ 4357c478bd9Sstevel@tonic-gate | egrep -v 'option -zdefs/nodefs appears more than' \ 4367c478bd9Sstevel@tonic-gate | egrep -v "symbol \`timezone' has differing types:" \ 4377c478bd9Sstevel@tonic-gate | egrep -v 'PSTAMP' \ 4387c478bd9Sstevel@tonic-gate | egrep -v '|%WHOANDWHERE%|' \ 4397c478bd9Sstevel@tonic-gate | egrep -v '^Manifying' \ 4407c478bd9Sstevel@tonic-gate | egrep -v 'Ignoring unknown host' \ 4417c478bd9Sstevel@tonic-gate | egrep -v 'Processing method:' \ 4427c478bd9Sstevel@tonic-gate | egrep -v '^Writing' \ 4437c478bd9Sstevel@tonic-gate | egrep -v 'spellin1:' \ 4447c478bd9Sstevel@tonic-gate | egrep -v '^adding:' \ 4457c478bd9Sstevel@tonic-gate | egrep -v "^echo 'msgid" \ 4467c478bd9Sstevel@tonic-gate | egrep -v '^echo ' \ 4477c478bd9Sstevel@tonic-gate | egrep -v '\.c:$' \ 4487c478bd9Sstevel@tonic-gate | egrep -v '^Adding file:' \ 4497c478bd9Sstevel@tonic-gate | egrep -v 'CLASSPATH=' \ 4507c478bd9Sstevel@tonic-gate | egrep -v '\/var\/mail\/:saved' \ 4517c478bd9Sstevel@tonic-gate | egrep -v -- '-DUTS_VERSION=' \ 4527c478bd9Sstevel@tonic-gate | egrep -v '^Running Mkbootstrap' \ 4537c478bd9Sstevel@tonic-gate | egrep -v '^Applet length read:' \ 4547c478bd9Sstevel@tonic-gate | egrep -v 'bytes written:' \ 4557c478bd9Sstevel@tonic-gate | egrep -v '^File:SolarisAuthApplet.bin' \ 4567c478bd9Sstevel@tonic-gate | egrep -v -i 'jibversion' \ 4577c478bd9Sstevel@tonic-gate | egrep -v '^Output size:' \ 4587c478bd9Sstevel@tonic-gate | egrep -v '^Solo size statistics:' \ 4597c478bd9Sstevel@tonic-gate | egrep -v '^Using ROM API Version' \ 4607c478bd9Sstevel@tonic-gate | egrep -v '^Zero Signature length:' \ 4617c478bd9Sstevel@tonic-gate | egrep -v '^Note \(probably harmless\):' \ 4627c478bd9Sstevel@tonic-gate | egrep -v '::' \ 4637c478bd9Sstevel@tonic-gate | egrep -v -- '-xcache' \ 464010b217aSwesolows | egrep -v '^\+' \ 46503eb5f54Swesolows | egrep -v '^cc1: note: -fwritable-strings' \ 4667c478bd9Sstevel@tonic-gate | sort | uniq >$SRC/${NOISE}.out 4677c478bd9Sstevel@tonic-gate if [ ! -f $SRC/${NOISE}.ref ]; then 4687c478bd9Sstevel@tonic-gate cp $SRC/${NOISE}.out $SRC/${NOISE}.ref 4697c478bd9Sstevel@tonic-gate fi 4707c478bd9Sstevel@tonic-gate echo "\n==== Build noise differences ($LABEL) ====\n" \ 4717c478bd9Sstevel@tonic-gate >>$mail_msg_file 4727c478bd9Sstevel@tonic-gate diff $SRC/${NOISE}.ref $SRC/${NOISE}.out >>$mail_msg_file 4737c478bd9Sstevel@tonic-gate fi 4747c478bd9Sstevel@tonic-gate 4757c478bd9Sstevel@tonic-gate # 4767c478bd9Sstevel@tonic-gate # Create cpio archives for preintegration testing (PIT) 4777c478bd9Sstevel@tonic-gate # 4787c478bd9Sstevel@tonic-gate if [ "$a_FLAG" = "y" -a "$this_build_ok" = "y" ]; then 4797c478bd9Sstevel@tonic-gate echo "\n==== Creating $LABEL cpio archives at `date` ====\n" \ 4807c478bd9Sstevel@tonic-gate >> $LOGFILE 4817c478bd9Sstevel@tonic-gate makebfu_file="${TMPDIR}/makebfu" 4827c478bd9Sstevel@tonic-gate rm -f ${makebfu_file} 4837c478bd9Sstevel@tonic-gate makebfu 2>&1 | \ 4847c478bd9Sstevel@tonic-gate tee -a ${makebfu_file} >> $LOGFILE 4857c478bd9Sstevel@tonic-gate echo "\n==== cpio archives build errors ($LABEL) ====\n" \ 4867c478bd9Sstevel@tonic-gate >> $mail_msg_file 4877c478bd9Sstevel@tonic-gate grep -v "^Creating .* archive:" ${makebfu_file} | \ 4887c478bd9Sstevel@tonic-gate grep -v "^Making" | \ 4897c478bd9Sstevel@tonic-gate grep -v "^$" | \ 4907c478bd9Sstevel@tonic-gate sort | uniq >> $mail_msg_file 4917c478bd9Sstevel@tonic-gate rm -f ${makebfu_file} 4927c478bd9Sstevel@tonic-gate # hack for test folks 4937c478bd9Sstevel@tonic-gate if [ -z "`echo $PARENT_WS|egrep '^\/ws\/'`" ]; then 4947c478bd9Sstevel@tonic-gate X=/net/`uname -n`${CPIODIR} 4957c478bd9Sstevel@tonic-gate else 4967c478bd9Sstevel@tonic-gate X=${CPIODIR} 4977c478bd9Sstevel@tonic-gate fi 4987c478bd9Sstevel@tonic-gate echo "Archive_directory: ${X}" >${TMPDIR}/f 4997c478bd9Sstevel@tonic-gate cp ${TMPDIR}/f ${CPIODIR}/../../.${MACH}_wgtrun 5007c478bd9Sstevel@tonic-gate rm -f ${TMPDIR}/f 5017c478bd9Sstevel@tonic-gate 5027c478bd9Sstevel@tonic-gate else 5037c478bd9Sstevel@tonic-gate echo "\n==== Not creating $LABEL cpio archives ====\n" \ 5047c478bd9Sstevel@tonic-gate >> $LOGFILE 5057c478bd9Sstevel@tonic-gate fi 5067c478bd9Sstevel@tonic-gate 5077c478bd9Sstevel@tonic-gate # 5087c478bd9Sstevel@tonic-gate # Building Packages 5097c478bd9Sstevel@tonic-gate # 5107c478bd9Sstevel@tonic-gate if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then 5117c478bd9Sstevel@tonic-gate echo "\n==== Creating $LABEL packages at `date` ====\n" \ 5127c478bd9Sstevel@tonic-gate >> $LOGFILE 5137c478bd9Sstevel@tonic-gate rm -f $SRC/pkgdefs/${INSTALLOG}.out 5147c478bd9Sstevel@tonic-gate echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE 5157c478bd9Sstevel@tonic-gate rm -rf $PKGARCHIVE 5167c478bd9Sstevel@tonic-gate mkdir -p $PKGARCHIVE 517d8fd4470Sjg 518d8fd4470Sjg # 519d8fd4470Sjg # Optional build of sparc realmode on i386 520d8fd4470Sjg # 521d8fd4470Sjg if [ "$MACH" = "i386" ] && [ "${SPARC_RM_PKGARCHIVE}" ]; then 522d8fd4470Sjg echo "Clearing out ${SPARC_RM_PKGARCHIVE} ..." \ 523d8fd4470Sjg >> $LOGFILE 524d8fd4470Sjg rm -rf ${SPARC_RM_PKGARCHIVE} 525d8fd4470Sjg mkdir -p ${SPARC_RM_PKGARCHIVE} 526d8fd4470Sjg fi 527d8fd4470Sjg 5287c478bd9Sstevel@tonic-gate cd $SRC/pkgdefs 5297c478bd9Sstevel@tonic-gate $MAKE -e install 2>&1 | \ 5307c478bd9Sstevel@tonic-gate tee -a $SRC/pkgdefs/${INSTALLOG}.out >> $LOGFILE 5317c478bd9Sstevel@tonic-gate echo "\n==== Package build errors ($LABEL) ====\n" \ 5327c478bd9Sstevel@tonic-gate >> $mail_msg_file 5337c478bd9Sstevel@tonic-gate egrep "${MAKE}|ERROR|WARNING" $SRC/pkgdefs/${INSTALLOG}.out | \ 5347c478bd9Sstevel@tonic-gate grep ':' | \ 5357c478bd9Sstevel@tonic-gate grep -v PSTAMP | \ 5367c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 5377c478bd9Sstevel@tonic-gate >> $mail_msg_file 5387c478bd9Sstevel@tonic-gate else 5397c478bd9Sstevel@tonic-gate echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE 5407c478bd9Sstevel@tonic-gate fi 5417c478bd9Sstevel@tonic-gate} 5427c478bd9Sstevel@tonic-gate 5437c478bd9Sstevel@tonic-gatedolint() { 5447c478bd9Sstevel@tonic-gate 5457c478bd9Sstevel@tonic-gate # 5467c478bd9Sstevel@tonic-gate # Arg. 2 is a flag to turn on/off the lint diff output 5477c478bd9Sstevel@tonic-gate # 5487c478bd9Sstevel@tonic-gate dl_usage="Usage: dolint /dir y|n" 5497c478bd9Sstevel@tonic-gate 5507c478bd9Sstevel@tonic-gate if [ $# -ne 2 ]; then 5517c478bd9Sstevel@tonic-gate echo $dl_usage 5527c478bd9Sstevel@tonic-gate exit 1 5537c478bd9Sstevel@tonic-gate fi 5547c478bd9Sstevel@tonic-gate 5557c478bd9Sstevel@tonic-gate if [ ! -d "$1" ]; then 5567c478bd9Sstevel@tonic-gate echo $dl_usage 5577c478bd9Sstevel@tonic-gate exit 1 5587c478bd9Sstevel@tonic-gate fi 5597c478bd9Sstevel@tonic-gate 5607c478bd9Sstevel@tonic-gate if [ "$2" != "y" -a "$2" != "n" ]; then 5617c478bd9Sstevel@tonic-gate echo $dl_usage 5627c478bd9Sstevel@tonic-gate exit 1 5637c478bd9Sstevel@tonic-gate fi 5647c478bd9Sstevel@tonic-gate 5657c478bd9Sstevel@tonic-gate lintdir=$1 5667c478bd9Sstevel@tonic-gate dodiff=$2 5677c478bd9Sstevel@tonic-gate base=`basename $lintdir` 5687c478bd9Sstevel@tonic-gate LINTOUT=$lintdir/lint-${MACH}.out 5697c478bd9Sstevel@tonic-gate LINTNOISE=$lintdir/lint-noise-${MACH} 5707c478bd9Sstevel@tonic-gate 5717c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 5727c478bd9Sstevel@tonic-gate unset RELEASE_BUILD 5737c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 5747c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 5757c478bd9Sstevel@tonic-gate 5767c478bd9Sstevel@tonic-gate # 5777c478bd9Sstevel@tonic-gate # '$MAKE lint' in $lintdir 5787c478bd9Sstevel@tonic-gate # 5797c478bd9Sstevel@tonic-gate echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE 5807c478bd9Sstevel@tonic-gate 5817c478bd9Sstevel@tonic-gate # remove old lint.out 5827c478bd9Sstevel@tonic-gate rm -f $lintdir/lint.out $lintdir/lint-noise.out 5837c478bd9Sstevel@tonic-gate if [ -f $lintdir/lint-noise.ref ]; then 5847c478bd9Sstevel@tonic-gate mv $lintdir/lint-noise.ref ${LINTNOISE}.ref 5857c478bd9Sstevel@tonic-gate fi 5867c478bd9Sstevel@tonic-gate 5877c478bd9Sstevel@tonic-gate rm -f $LINTOUT 5887c478bd9Sstevel@tonic-gate cd $lintdir 5897c478bd9Sstevel@tonic-gate # 5907c478bd9Sstevel@tonic-gate # Remove all .ln files to ensure a full reference file 5917c478bd9Sstevel@tonic-gate # 5927c478bd9Sstevel@tonic-gate rm -f Nothing_to_remove \ 5937c478bd9Sstevel@tonic-gate `find . -name SCCS -prune -o -type f -name '*.ln' -print ` 5947c478bd9Sstevel@tonic-gate 5957c478bd9Sstevel@tonic-gate /bin/time $MAKE -ek lint 2>&1 | \ 5967c478bd9Sstevel@tonic-gate tee -a $LINTOUT >> $LOGFILE 5977c478bd9Sstevel@tonic-gate echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file 5987c478bd9Sstevel@tonic-gate grep "$MAKE:" $LINTOUT | 5997c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 6007c478bd9Sstevel@tonic-gate >> $mail_msg_file 6017c478bd9Sstevel@tonic-gate 6027c478bd9Sstevel@tonic-gate echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE 6037c478bd9Sstevel@tonic-gate 6047c478bd9Sstevel@tonic-gate echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \ 6057c478bd9Sstevel@tonic-gate >>$mail_msg_file 6067c478bd9Sstevel@tonic-gate tail -3 $LINTOUT >>$mail_msg_file 6077c478bd9Sstevel@tonic-gate 6087c478bd9Sstevel@tonic-gate rm -f ${LINTNOISE}.ref 6097c478bd9Sstevel@tonic-gate if [ -f ${LINTNOISE}.out ]; then 6107c478bd9Sstevel@tonic-gate mv ${LINTNOISE}.out ${LINTNOISE}.ref 6117c478bd9Sstevel@tonic-gate fi 6127c478bd9Sstevel@tonic-gate #grep : $LINTOUT | 6137c478bd9Sstevel@tonic-gate #egrep -v '^(name|function|value|argument|real|user|sys)' | 6147c478bd9Sstevel@tonic-gate #egrep -v 'warning: (name|function|value|possibly)' | 6157c478bd9Sstevel@tonic-gate #egrep -v 'warning: argument used' | 6167c478bd9Sstevel@tonic-gate grep : $LINTOUT | \ 6177c478bd9Sstevel@tonic-gate egrep -v '^(real|user|sys)' | 6187c478bd9Sstevel@tonic-gate egrep -v '(library construction)' | \ 6197c478bd9Sstevel@tonic-gate egrep -v ': global crosschecks' | \ 6207c478bd9Sstevel@tonic-gate egrep -v 'Ignoring unknown host' | \ 6217c478bd9Sstevel@tonic-gate egrep -v '\.c:$' | \ 6227c478bd9Sstevel@tonic-gate sort | uniq > ${LINTNOISE}.out 6237c478bd9Sstevel@tonic-gate if [ ! -f ${LINTNOISE}.ref ]; then 6247c478bd9Sstevel@tonic-gate cp ${LINTNOISE}.out ${LINTNOISE}.ref 6257c478bd9Sstevel@tonic-gate fi 6267c478bd9Sstevel@tonic-gate if [ "$dodiff" != "n" ]; then 6277c478bd9Sstevel@tonic-gate echo "\n==== lint warnings $base ====\n" \ 6287c478bd9Sstevel@tonic-gate >>$mail_msg_file 6297c478bd9Sstevel@tonic-gate # should be none, though there are a few that were filtered out 6307c478bd9Sstevel@tonic-gate # above 6317c478bd9Sstevel@tonic-gate egrep -i '(warning|lint):' ${LINTNOISE}.out \ 6327c478bd9Sstevel@tonic-gate | sort | uniq >> $mail_msg_file 6337c478bd9Sstevel@tonic-gate echo "\n==== lint noise differences $base ====\n" \ 6347c478bd9Sstevel@tonic-gate >> $mail_msg_file 6357c478bd9Sstevel@tonic-gate diff ${LINTNOISE}.ref ${LINTNOISE}.out \ 6367c478bd9Sstevel@tonic-gate >> $mail_msg_file 6377c478bd9Sstevel@tonic-gate fi 6387c478bd9Sstevel@tonic-gate} 6397c478bd9Sstevel@tonic-gate 6407c478bd9Sstevel@tonic-gate# Install proto area from IHV build 6417c478bd9Sstevel@tonic-gate 6427c478bd9Sstevel@tonic-gatecopy_ihv_proto() { 6437c478bd9Sstevel@tonic-gate 6447c478bd9Sstevel@tonic-gate echo "\n==== Installing $IA32_IHV_ROOT ====\n" \ 6457c478bd9Sstevel@tonic-gate >> $LOGFILE 6467c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_ROOT" ]; then 6477c478bd9Sstevel@tonic-gate if [ ! -d "$ROOT" ]; then 6487c478bd9Sstevel@tonic-gate echo "mkdir -p $ROOT" >> $LOGFILE 6497c478bd9Sstevel@tonic-gate mkdir -p $ROOT 6507c478bd9Sstevel@tonic-gate fi 6517c478bd9Sstevel@tonic-gate echo "cd $IA32_IHV_ROOT\n" >> $LOGFILE 6527c478bd9Sstevel@tonic-gate cd $IA32_IHV_ROOT 6537c478bd9Sstevel@tonic-gate tar -cf - . | (cd $ROOT; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6547c478bd9Sstevel@tonic-gate else 6557c478bd9Sstevel@tonic-gate echo "$IA32_IHV_ROOT: not found" >> $LOGFILE 6567c478bd9Sstevel@tonic-gate fi 6577c478bd9Sstevel@tonic-gate} 6587c478bd9Sstevel@tonic-gate 6597c478bd9Sstevel@tonic-gate# Install IHV packages in PKGARCHIVE 6607c478bd9Sstevel@tonic-gate 6617c478bd9Sstevel@tonic-gatecopy_ihv_pkgs() { 6627c478bd9Sstevel@tonic-gate 6637c478bd9Sstevel@tonic-gate if [ $# -ne 2 ]; then 6647c478bd9Sstevel@tonic-gate echo "usage: copy_ihv_pkgs LABEL SUFFIX" 6657c478bd9Sstevel@tonic-gate exit 1; 6667c478bd9Sstevel@tonic-gate fi 6677c478bd9Sstevel@tonic-gate 6687c478bd9Sstevel@tonic-gate LABEL=$1 6697c478bd9Sstevel@tonic-gate SUFFIX=$2 6707c478bd9Sstevel@tonic-gate # always use non-DEBUG IHV packages 6717c478bd9Sstevel@tonic-gate IA32_IHV_PKGS=${IA32_IHV_PKGS_ORIG}-nd 6727c478bd9Sstevel@tonic-gate PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX} 6737c478bd9Sstevel@tonic-gate 6747c478bd9Sstevel@tonic-gate echo "\n==== Installing IHV packages from $IA32_IHV_PKGS ($LABEL) ====\n" \ 6757c478bd9Sstevel@tonic-gate >> $LOGFILE 6767c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_PKGS" ]; then 6777c478bd9Sstevel@tonic-gate cd $IA32_IHV_PKGS 6787c478bd9Sstevel@tonic-gate tar -cf - * | \ 6797c478bd9Sstevel@tonic-gate (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6807c478bd9Sstevel@tonic-gate else 6817c478bd9Sstevel@tonic-gate echo "$IA32_IHV_PKGS: not found" >> $LOGFILE 6827c478bd9Sstevel@tonic-gate fi 6837c478bd9Sstevel@tonic-gate 6847c478bd9Sstevel@tonic-gate echo "\n==== Installing IHV packages from $IA32_IHV_BINARY_PKGS ($LABEL) ====\n" \ 6857c478bd9Sstevel@tonic-gate >> $LOGFILE 6867c478bd9Sstevel@tonic-gate if [ -d "$IA32_IHV_BINARY_PKGS" ]; then 6877c478bd9Sstevel@tonic-gate cd $IA32_IHV_BINARY_PKGS 6887c478bd9Sstevel@tonic-gate tar -cf - * | \ 6897c478bd9Sstevel@tonic-gate (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE 6907c478bd9Sstevel@tonic-gate else 6917c478bd9Sstevel@tonic-gate echo "$IA32_IHV_BINARY_PKGS: not found" >> $LOGFILE 6927c478bd9Sstevel@tonic-gate fi 6937c478bd9Sstevel@tonic-gate} 6947c478bd9Sstevel@tonic-gate 6957c478bd9Sstevel@tonic-gatebuild_tools() { 6967c478bd9Sstevel@tonic-gate 6977c478bd9Sstevel@tonic-gate if [ $# -ne 1 ]; then 6987c478bd9Sstevel@tonic-gate echo "usage: build_tools DESTROOT" 6997c478bd9Sstevel@tonic-gate exit 1; 7007c478bd9Sstevel@tonic-gate fi 7017c478bd9Sstevel@tonic-gate 7027c478bd9Sstevel@tonic-gate DESTROOT=$1 7037c478bd9Sstevel@tonic-gate 7047c478bd9Sstevel@tonic-gate INSTALLOG=install-${MACH} 7057c478bd9Sstevel@tonic-gate 7067c478bd9Sstevel@tonic-gate echo "\n==== Building tools at `date` ====\n" \ 7077c478bd9Sstevel@tonic-gate >> $LOGFILE 7087c478bd9Sstevel@tonic-gate 7097c478bd9Sstevel@tonic-gate rm -f ${TOOLS}/${INSTALLOG}.out 7107c478bd9Sstevel@tonic-gate cd ${TOOLS} 7117c478bd9Sstevel@tonic-gate /bin/time $MAKE ROOT=${DESTROOT} -e install 2>&1 | \ 7127c478bd9Sstevel@tonic-gate tee -a ${TOOLS}/${INSTALLOG}.out >> $LOGFILE 7137c478bd9Sstevel@tonic-gate 7147c478bd9Sstevel@tonic-gate echo "\n==== Tools build errors ====\n" >> $mail_msg_file 7157c478bd9Sstevel@tonic-gate 7167c478bd9Sstevel@tonic-gate egrep ":" ${TOOLS}/${INSTALLOG}.out | 7177c478bd9Sstevel@tonic-gate egrep -e "(${MAKE}:|[ ]error[: \n])" | \ 7187c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 7197c478bd9Sstevel@tonic-gate egrep -v warning >> $mail_msg_file 7207c478bd9Sstevel@tonic-gate if [ "$?" != "0" ]; then 7217c478bd9Sstevel@tonic-gate STABS=${DESTROOT}/opt/onbld/bin/${MACH}/stabs 7227c478bd9Sstevel@tonic-gate export STABS 7237c478bd9Sstevel@tonic-gate CTFSTABS=${DESTROOT}/opt/onbld/bin/${MACH}/ctfstabs 7247c478bd9Sstevel@tonic-gate export CTFSTABS 7257c478bd9Sstevel@tonic-gate GENOFFSETS=${DESTROOT}/opt/onbld/bin/genoffsets 7267c478bd9Sstevel@tonic-gate export GENOFFSETS 7277c478bd9Sstevel@tonic-gate 7287c478bd9Sstevel@tonic-gate CTFCONVERT=${DESTROOT}/opt/onbld/bin/${MACH}/ctfconvert 7297c478bd9Sstevel@tonic-gate export CTFCONVERT 7307c478bd9Sstevel@tonic-gate CTFMERGE=${DESTROOT}/opt/onbld/bin/${MACH}/ctfmerge 7317c478bd9Sstevel@tonic-gate export CTFMERGE 7327c478bd9Sstevel@tonic-gate 7337c478bd9Sstevel@tonic-gate CTFCVTPTBL=${DESTROOT}/opt/onbld/bin/ctfcvtptbl 7347c478bd9Sstevel@tonic-gate export CTFCVTPTBL 7357c478bd9Sstevel@tonic-gate CTFFINDMOD=${DESTROOT}/opt/onbld/bin/ctffindmod 7367c478bd9Sstevel@tonic-gate export CTFFINDMOD 7377c478bd9Sstevel@tonic-gate 7387c478bd9Sstevel@tonic-gate if [ "$VERIFY_ELFSIGN" = "y" ]; then 7397c478bd9Sstevel@tonic-gate ELFSIGN=${DESTROOT}/opt/onbld/bin/elfsigncmp 7407c478bd9Sstevel@tonic-gate else 7417c478bd9Sstevel@tonic-gate ELFSIGN=${DESTROOT}/opt/onbld/bin/${MACH}/elfsign 7427c478bd9Sstevel@tonic-gate fi 7437c478bd9Sstevel@tonic-gate export ELFSIGN 7447c478bd9Sstevel@tonic-gate 7457c478bd9Sstevel@tonic-gate PATH="${DESTROOT}/opt/onbld/bin/${MACH}:${PATH}" 7467c478bd9Sstevel@tonic-gate PATH="${DESTROOT}/opt/onbld/bin:${PATH}" 7477c478bd9Sstevel@tonic-gate export PATH 7487c478bd9Sstevel@tonic-gate 7497c478bd9Sstevel@tonic-gate echo "\n==== New environment settings. ====\n" >> $LOGFILE 7507c478bd9Sstevel@tonic-gate echo "STABS=${STABS}" >> $LOGFILE 7517c478bd9Sstevel@tonic-gate echo "CTFSTABS=${CTFSTABS}" >> $LOGFILE 7527c478bd9Sstevel@tonic-gate echo "CTFCONVERT=${CTFCONVERT}" >> $LOGFILE 7537c478bd9Sstevel@tonic-gate echo "CTFMERGE=${CTFMERGE}" >> $LOGFILE 7547c478bd9Sstevel@tonic-gate echo "CTFCVTPTBL=${CTFCVTPTBL}" >> $LOGFILE 7557c478bd9Sstevel@tonic-gate echo "CTFFINDMOD=${CTFFINDMOD}" >> $LOGFILE 7567c478bd9Sstevel@tonic-gate echo "ELFSIGN=${ELFSIGN}" >> $LOGFILE 7577c478bd9Sstevel@tonic-gate echo "PATH=${PATH}" >> $LOGFILE 7587c478bd9Sstevel@tonic-gate fi 7597c478bd9Sstevel@tonic-gate} 7607c478bd9Sstevel@tonic-gate 7617c478bd9Sstevel@tonic-gatestaffer() { 7627c478bd9Sstevel@tonic-gate if [ $ISUSER -ne 0 ]; then 7637c478bd9Sstevel@tonic-gate "$@" 7647c478bd9Sstevel@tonic-gate else 7657c478bd9Sstevel@tonic-gate arg="\"$1\"" 7667c478bd9Sstevel@tonic-gate shift 7677c478bd9Sstevel@tonic-gate for i 7687c478bd9Sstevel@tonic-gate do 7697c478bd9Sstevel@tonic-gate arg="$arg \"$i\"" 7707c478bd9Sstevel@tonic-gate done 7717c478bd9Sstevel@tonic-gate eval su $STAFFER -c \'$arg\' 7727c478bd9Sstevel@tonic-gate fi 7737c478bd9Sstevel@tonic-gate} 7747c478bd9Sstevel@tonic-gate 775085d331dSkupfer# 776085d331dSkupfer# Verify that the closed tree is present if it needs to be. 777085d331dSkupfer# Sets CLOSED_IS_PRESENT for future use. 778085d331dSkupfer# 779085d331dSkupfercheck_closed_tree() { 780085d331dSkupfer if [ -z "$CLOSED_IS_PRESENT" ]; then 781085d331dSkupfer if [ -d $SRC/../closed ]; then 782085d331dSkupfer CLOSED_IS_PRESENT="yes" 783085d331dSkupfer else 784085d331dSkupfer CLOSED_IS_PRESENT="no" 785085d331dSkupfer fi 786085d331dSkupfer export CLOSED_IS_PRESENT 787085d331dSkupfer fi 788085d331dSkupfer if [[ "$CLOSED_IS_PRESENT" = no && ! -d "$ON_CLOSED_BINS" ]]; then 789085d331dSkupfer # 790085d331dSkupfer # If it's an old (pre-split) tree or an empty 791085d331dSkupfer # workspace, don't complain. 792085d331dSkupfer # 793085d331dSkupfer if grep -s CLOSED_BUILD $SRC/Makefile.master > /dev/null; then 794085d331dSkupfer echo "If the closed sources are not present," \ 795085d331dSkupfer "ON_CLOSED_BINS" 796085d331dSkupfer echo "must point to the closed binaries tree." 797085d331dSkupfer exit 1 798085d331dSkupfer fi 799085d331dSkupfer fi 800085d331dSkupfer} 8017c478bd9Sstevel@tonic-gate 8027c478bd9Sstevel@tonic-gateMACH=`uname -p` 8037c478bd9Sstevel@tonic-gate 8047c478bd9Sstevel@tonic-gateif [ "$OPTHOME" = "" ]; then 8057c478bd9Sstevel@tonic-gate OPTHOME=/opt 8067c478bd9Sstevel@tonic-gate export OPTHOME 8077c478bd9Sstevel@tonic-gatefi 8087c478bd9Sstevel@tonic-gateif [ "$TEAMWARE" = "" ]; then 8097c478bd9Sstevel@tonic-gate TEAMWARE=$OPTHOME/teamware 8107c478bd9Sstevel@tonic-gate export TEAMWARE 8117c478bd9Sstevel@tonic-gatefi 8127c478bd9Sstevel@tonic-gate 8137c478bd9Sstevel@tonic-gateUSAGE='Usage: nightly [-in] [-V VERS ] [ -S E|D|H ] <env_file> 8147c478bd9Sstevel@tonic-gate 8157c478bd9Sstevel@tonic-gateWhere: 8167c478bd9Sstevel@tonic-gate -i Fast incremental options (no clobber, lint, check, gprof, trace) 8177c478bd9Sstevel@tonic-gate -n Do not do a bringover 8187c478bd9Sstevel@tonic-gate -V VERS set the build version string to VERS 8197c478bd9Sstevel@tonic-gate -S Build a variant of the source product 8207c478bd9Sstevel@tonic-gate E - build exportable source 8217c478bd9Sstevel@tonic-gate D - build domestic source (exportable + crypt) 8227c478bd9Sstevel@tonic-gate H - build hybrid source (binaries + deleted source) 8237c478bd9Sstevel@tonic-gate 8247c478bd9Sstevel@tonic-gate <env_file> file in Bourne shell syntax that sets and exports 8257c478bd9Sstevel@tonic-gate variables that configure the operation of this script and many of 8267c478bd9Sstevel@tonic-gate the scripts this one calls. If <env_file> does not exist, 8277c478bd9Sstevel@tonic-gate it will be looked for in $OPTHOME/onbld/env. 8287c478bd9Sstevel@tonic-gate 8297c478bd9Sstevel@tonic-gatenon-DEBUG is the default build type. Build options can be set in the 8307c478bd9Sstevel@tonic-gateNIGHTLY_OPTIONS variable in the <env_file> as follows: 8317c478bd9Sstevel@tonic-gate 8327c478bd9Sstevel@tonic-gate -A check for ABI differences in .so files 8337c478bd9Sstevel@tonic-gate -C check for cstyle/hdrchk errors 8347c478bd9Sstevel@tonic-gate -D do a build with DEBUG on 8357c478bd9Sstevel@tonic-gate -F do _not_ do a non-DEBUG build 8367c478bd9Sstevel@tonic-gate -G gate keeper default group of options (-au) 8377c478bd9Sstevel@tonic-gate -I integration engineer default group of options (-ampu) 8387c478bd9Sstevel@tonic-gate -M do not run pmodes (safe file permission checker) 8397c478bd9Sstevel@tonic-gate -N do not run protocmp 8407c478bd9Sstevel@tonic-gate -P do a build with GPROF on 8417c478bd9Sstevel@tonic-gate -R default group of options for building a release (-mp) 8427c478bd9Sstevel@tonic-gate -T do a build with TRACE on 8437c478bd9Sstevel@tonic-gate -U update proto area in the parent 8447c478bd9Sstevel@tonic-gate -V VERS set the build version string to VERS 84504a42e3eSszhou -X copy x86 IHV proto area 8467c478bd9Sstevel@tonic-gate -a create cpio archives 8477c478bd9Sstevel@tonic-gate -d use Distributed Make (default uses Parallel Make) 8487c478bd9Sstevel@tonic-gate -f find unreferenced files 8497c478bd9Sstevel@tonic-gate -i do an incremental build (no "make clobber") 8507c478bd9Sstevel@tonic-gate -l do "make lint" in $LINTDIRS (default: $SRC y) 8517c478bd9Sstevel@tonic-gate -m send mail to $MAILTO at end of build 8527c478bd9Sstevel@tonic-gate -n do not do a bringover 8537c478bd9Sstevel@tonic-gate -o build using root privileges to set OWNER/GROUP (old style) 8547c478bd9Sstevel@tonic-gate -p create packages 8557c478bd9Sstevel@tonic-gate -r check ELF runtime attributes in the proto area 8567c478bd9Sstevel@tonic-gate -t build and use the tools in $SRC/tools 8577c478bd9Sstevel@tonic-gate -u update proto_list_$MACH and friends in the parent workspace; 8587c478bd9Sstevel@tonic-gate when used with -f, also build an unrefmaster.out in the parent 8597c478bd9Sstevel@tonic-gate -z compress cpio archives with gzip 8607c478bd9Sstevel@tonic-gate -W Do not report warnings (freeware gate ONLY) 8617c478bd9Sstevel@tonic-gate -S Build a variant of the source product 8627c478bd9Sstevel@tonic-gate E - build exportable source 8637c478bd9Sstevel@tonic-gate D - build domestic source (exportable + crypt) 8647c478bd9Sstevel@tonic-gate H - build hybrid source (binaries + deleted source) 8657c478bd9Sstevel@tonic-gate' 8667c478bd9Sstevel@tonic-gate# 8677c478bd9Sstevel@tonic-gate# -x less public handling of xmod source for the source product 8687c478bd9Sstevel@tonic-gate# 8697c478bd9Sstevel@tonic-gate# A log file will be generated under the name $LOGFILE 8701c79753fSdarrenm# for partially completed build and log.`date '+%F'` 8717c478bd9Sstevel@tonic-gate# in the same directory for fully completed builds. 8727c478bd9Sstevel@tonic-gate# 8737c478bd9Sstevel@tonic-gate 8747c478bd9Sstevel@tonic-gate# default values for low-level FLAGS; G I R are group FLAGS 8757c478bd9Sstevel@tonic-gateA_FLAG=n 8767c478bd9Sstevel@tonic-gatea_FLAG=n 8777c478bd9Sstevel@tonic-gated_FLAG=n 8787c478bd9Sstevel@tonic-gateC_FLAG=n 8797c478bd9Sstevel@tonic-gateF_FLAG=n 8807c478bd9Sstevel@tonic-gatef_FLAG=n 8817c478bd9Sstevel@tonic-gateD_FLAG=n 8827c478bd9Sstevel@tonic-gateP_FLAG=n 8837c478bd9Sstevel@tonic-gateT_FLAG=n 8847c478bd9Sstevel@tonic-gaten_FLAG=n 8857c478bd9Sstevel@tonic-gateo_FLAG=n 8867c478bd9Sstevel@tonic-gatei_FLAG=n; i_CMD_LINE_FLAG=n 8877c478bd9Sstevel@tonic-gatel_FLAG=n 8887c478bd9Sstevel@tonic-gatem_FLAG=n 8897c478bd9Sstevel@tonic-gatep_FLAG=n 8907c478bd9Sstevel@tonic-gater_FLAG=n 8917c478bd9Sstevel@tonic-gatet_FLAG=n 8927c478bd9Sstevel@tonic-gateu_FLAG=n 8937c478bd9Sstevel@tonic-gateU_FLAG=n 8947c478bd9Sstevel@tonic-gateV_FLAG=n 8957c478bd9Sstevel@tonic-gateM_FLAG=n 8967c478bd9Sstevel@tonic-gateN_FLAG=n 8977c478bd9Sstevel@tonic-gatez_FLAG=n 8987c478bd9Sstevel@tonic-gateW_FLAG=n 8997c478bd9Sstevel@tonic-gateSE_FLAG=n 9007c478bd9Sstevel@tonic-gateSD_FLAG=n 9017c478bd9Sstevel@tonic-gateSH_FLAG=n 9027c478bd9Sstevel@tonic-gateX_FLAG=n 9037c478bd9Sstevel@tonic-gate# 9047c478bd9Sstevel@tonic-gateXMOD_OPT= 9057c478bd9Sstevel@tonic-gate# 9067c478bd9Sstevel@tonic-gatebuild_ok=y 9077c478bd9Sstevel@tonic-gate# 9087c478bd9Sstevel@tonic-gate# examine arguments 9097c478bd9Sstevel@tonic-gate# 9107c478bd9Sstevel@tonic-gate 9117c478bd9Sstevel@tonic-gateOPTIND=1 9127c478bd9Sstevel@tonic-gatewhile getopts inV:S:t FLAG 9137c478bd9Sstevel@tonic-gatedo 9147c478bd9Sstevel@tonic-gate case $FLAG in 9157c478bd9Sstevel@tonic-gate i ) i_FLAG=y; i_CMD_LINE_FLAG=y 9167c478bd9Sstevel@tonic-gate ;; 9177c478bd9Sstevel@tonic-gate n ) n_FLAG=y 9187c478bd9Sstevel@tonic-gate ;; 9197c478bd9Sstevel@tonic-gate V ) V_FLAG=y 9207c478bd9Sstevel@tonic-gate V_ARG="$OPTARG" 9217c478bd9Sstevel@tonic-gate ;; 9227c478bd9Sstevel@tonic-gate S ) 9237c478bd9Sstevel@tonic-gate if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 9247c478bd9Sstevel@tonic-gate echo "Can only build one source variant at a time." 9257c478bd9Sstevel@tonic-gate exit 1 9267c478bd9Sstevel@tonic-gate fi 9277c478bd9Sstevel@tonic-gate if [ "${OPTARG}" = "E" ]; then 9287c478bd9Sstevel@tonic-gate SE_FLAG=y 9297c478bd9Sstevel@tonic-gate elif [ "${OPTARG}" = "D" ]; then 9307c478bd9Sstevel@tonic-gate SD_FLAG=y 9317c478bd9Sstevel@tonic-gate elif [ "${OPTARG}" = "H" ]; then 9327c478bd9Sstevel@tonic-gate SH_FLAG=y 9337c478bd9Sstevel@tonic-gate else 9347c478bd9Sstevel@tonic-gate echo "$USAGE" 9357c478bd9Sstevel@tonic-gate exit 1 9367c478bd9Sstevel@tonic-gate fi 9377c478bd9Sstevel@tonic-gate ;; 9387c478bd9Sstevel@tonic-gate t ) t_FLAG=y 9397c478bd9Sstevel@tonic-gate ;; 9407c478bd9Sstevel@tonic-gate \? ) echo "$USAGE" 9417c478bd9Sstevel@tonic-gate exit 1 9427c478bd9Sstevel@tonic-gate ;; 9437c478bd9Sstevel@tonic-gate esac 9447c478bd9Sstevel@tonic-gatedone 9457c478bd9Sstevel@tonic-gate 9467c478bd9Sstevel@tonic-gate# correct argument count after options 9477c478bd9Sstevel@tonic-gateshift `expr $OPTIND - 1` 9487c478bd9Sstevel@tonic-gate 9497c478bd9Sstevel@tonic-gate# test that the path to the environment-setting file was given 9507c478bd9Sstevel@tonic-gateif [ $# -ne 1 ]; then 9517c478bd9Sstevel@tonic-gate echo "$USAGE" 9527c478bd9Sstevel@tonic-gate exit 1 9537c478bd9Sstevel@tonic-gatefi 9547c478bd9Sstevel@tonic-gate 9557c478bd9Sstevel@tonic-gate# check if user is running nightly as root 9567c478bd9Sstevel@tonic-gate# ISUSER is set non-zero if an ordinary user runs nightly, or is zero 9577c478bd9Sstevel@tonic-gate# when root invokes nightly. 9587c478bd9Sstevel@tonic-gate/usr/bin/id | grep '^uid=0(' >/dev/null 2>&1 9597c478bd9Sstevel@tonic-gateISUSER=$?; export ISUSER 9607c478bd9Sstevel@tonic-gate 9617c478bd9Sstevel@tonic-gate# 9627c478bd9Sstevel@tonic-gate# force locale to C 9637c478bd9Sstevel@tonic-gateLC_COLLATE=C; export LC_COLLATE 9647c478bd9Sstevel@tonic-gateLC_CTYPE=C; export LC_CTYPE 9657c478bd9Sstevel@tonic-gateLC_MESSAGES=C; export LC_MESSAGES 9667c478bd9Sstevel@tonic-gateLC_MONETARY=C; export LC_MONETARY 9677c478bd9Sstevel@tonic-gateLC_NUMERIC=C; export LC_NUMERIC 9687c478bd9Sstevel@tonic-gateLC_TIME=C; export LC_TIME 9697c478bd9Sstevel@tonic-gate 9707c478bd9Sstevel@tonic-gate# clear environment variables we know to be bad for the build 9717c478bd9Sstevel@tonic-gateunset LD_OPTIONS 9727c478bd9Sstevel@tonic-gateunset LD_AUDIT LD_AUDIT_32 LD_AUDIT_64 9737c478bd9Sstevel@tonic-gateunset LD_BIND_NOW LD_BIND_NOW_32 LD_BIND_NOW_64 9747c478bd9Sstevel@tonic-gateunset LD_BREADTH LD_BREADTH_32 LD_BREADTH_64 9757c478bd9Sstevel@tonic-gateunset LD_CONFIG LD_CONFIG_32 LD_CONFIG_64 9767c478bd9Sstevel@tonic-gateunset LD_DEBUG LD_DEBUG_32 LD_DEBUG_64 9777c478bd9Sstevel@tonic-gateunset LD_DEMANGLE LD_DEMANGLE_32 LD_DEMANGLE_64 9787c478bd9Sstevel@tonic-gateunset LD_FLAGS LD_FLAGS_32 LD_FLAGS_64 9797c478bd9Sstevel@tonic-gateunset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 9807c478bd9Sstevel@tonic-gateunset LD_LOADFLTR LD_LOADFLTR_32 LD_LOADFLTR_64 9817c478bd9Sstevel@tonic-gateunset LD_NOAUDIT LD_NOAUDIT_32 LD_NOAUDIT_64 9827c478bd9Sstevel@tonic-gateunset LD_NOAUXFLTR LD_NOAUXFLTR_32 LD_NOAUXFLTR_64 9837c478bd9Sstevel@tonic-gateunset LD_NOCONFIG LD_NOCONFIG_32 LD_NOCONFIG_64 9847c478bd9Sstevel@tonic-gateunset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64 9857c478bd9Sstevel@tonic-gateunset LD_NODIRECT LD_NODIRECT_32 LD_NODIRECT_64 9867c478bd9Sstevel@tonic-gateunset LD_NOLAZYLOAD LD_NOLAZYLOAD_32 LD_NOLAZYLOAD_64 9877c478bd9Sstevel@tonic-gateunset LD_NOOBJALTER LD_NOOBJALTER_32 LD_NOOBJALTER_64 9887c478bd9Sstevel@tonic-gateunset LD_NOVERSION LD_NOVERSION_32 LD_NOVERSION_64 9897c478bd9Sstevel@tonic-gateunset LD_ORIGIN LD_ORIGIN_32 LD_ORIGIN_64 9907c478bd9Sstevel@tonic-gateunset LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64 9917c478bd9Sstevel@tonic-gateunset LD_PROFILE LD_PROFILE_32 LD_PROFILE_64 9927c478bd9Sstevel@tonic-gate 9937c478bd9Sstevel@tonic-gateunset CONFIG 9947c478bd9Sstevel@tonic-gateunset GROUP 9957c478bd9Sstevel@tonic-gateunset OWNER 9967c478bd9Sstevel@tonic-gateunset REMOTE 9977c478bd9Sstevel@tonic-gateunset ENV 9987c478bd9Sstevel@tonic-gateunset ARCH 9997c478bd9Sstevel@tonic-gateunset CLASSPATH 10007c478bd9Sstevel@tonic-gateunset NAME 10017c478bd9Sstevel@tonic-gate 10027c478bd9Sstevel@tonic-gate# 10037c478bd9Sstevel@tonic-gate# Setup environmental variables 10047c478bd9Sstevel@tonic-gate# 10057c478bd9Sstevel@tonic-gateif [ -f $1 ]; then 10067c478bd9Sstevel@tonic-gate if [[ $1 = */* ]]; then 10077c478bd9Sstevel@tonic-gate . $1 10087c478bd9Sstevel@tonic-gate else 10097c478bd9Sstevel@tonic-gate . ./$1 10107c478bd9Sstevel@tonic-gate fi 10117c478bd9Sstevel@tonic-gateelse 10127c478bd9Sstevel@tonic-gate if [ -f $OPTHOME/onbld/env/$1 ]; then 10137c478bd9Sstevel@tonic-gate . $OPTHOME/onbld/env/$1 10147c478bd9Sstevel@tonic-gate else 10157c478bd9Sstevel@tonic-gate echo "Cannot find env file as either $1 or $OPTHOME/onbld/env/$1" 10167c478bd9Sstevel@tonic-gate exit 1 10177c478bd9Sstevel@tonic-gate fi 10187c478bd9Sstevel@tonic-gatefi 10197c478bd9Sstevel@tonic-gate 10207c478bd9Sstevel@tonic-gate# 10217c478bd9Sstevel@tonic-gate# place ourselves in a new task, respecting BUILD_PROJECT if set. 10227c478bd9Sstevel@tonic-gate# 10237c478bd9Sstevel@tonic-gateif [ -z "$BUILD_PROJECT" ]; then 10247c478bd9Sstevel@tonic-gate /usr/bin/newtask -c $$ 10257c478bd9Sstevel@tonic-gateelse 10267c478bd9Sstevel@tonic-gate /usr/bin/newtask -c $$ -p $BUILD_PROJECT 10277c478bd9Sstevel@tonic-gatefi 10287c478bd9Sstevel@tonic-gate 10297c478bd9Sstevel@tonic-gateps -o taskid= -p $$ | read build_taskid 10307c478bd9Sstevel@tonic-gateps -o project= -p $$ | read build_project 10317c478bd9Sstevel@tonic-gate 10327c478bd9Sstevel@tonic-gate# 10337c478bd9Sstevel@tonic-gate# See if NIGHTLY_OPTIONS is set 10347c478bd9Sstevel@tonic-gate# 10357c478bd9Sstevel@tonic-gateif [ "$NIGHTLY_OPTIONS" = "" ]; then 10367c478bd9Sstevel@tonic-gate NIGHTLY_OPTIONS="-aBm" 10377c478bd9Sstevel@tonic-gatefi 10387c478bd9Sstevel@tonic-gate 10397c478bd9Sstevel@tonic-gate# 10407c478bd9Sstevel@tonic-gate# If BRINGOVER_WS was not specified, let it default to CLONE_WS 10417c478bd9Sstevel@tonic-gate# 10427c478bd9Sstevel@tonic-gateif [ "$BRINGOVER_WS" = "" ]; then 10437c478bd9Sstevel@tonic-gate BRINGOVER_WS=$CLONE_WS 10447c478bd9Sstevel@tonic-gatefi 10457c478bd9Sstevel@tonic-gate 10467c478bd9Sstevel@tonic-gate# 1047fb23a357Skupfer# If BRINGOVER_FILES was not specified, default to usr 1048a5c06a9eSmike_s# 1049a5c06a9eSmike_sif [ "$BRINGOVER_FILES" = "" ]; then 1050fb23a357Skupfer BRINGOVER_FILES="usr" 1051a5c06a9eSmike_sfi 1052a5c06a9eSmike_s 1053fb9f9b97Skupfer# 1054fb9f9b97Skupfer# If the closed sources are not present, the closed binaries must be 1055fb9f9b97Skupfer# present for the build to succeed. If there's no pointer to the 1056fb9f9b97Skupfer# closed binaries, flag that now, rather than forcing the user to wait 1057fb9f9b97Skupfer# a couple hours (or more) to find out. 1058fb9f9b97Skupfer# 1059085d331dSkupferorig_closed_is_present="$CLOSED_IS_PRESENT" 1060085d331dSkupfercheck_closed_tree 1061fb9f9b97Skupfer 1062a5c06a9eSmike_s# 10637c478bd9Sstevel@tonic-gate# Note: changes to the option letters here should also be applied to the 10647c478bd9Sstevel@tonic-gate# bldenv script. 10657c478bd9Sstevel@tonic-gate# 10667c478bd9Sstevel@tonic-gateOPTIND=1 10677c478bd9Sstevel@tonic-gatewhile getopts ABDFNMPTCGIRafinlmoptuUxdrtzWS:X FLAG $NIGHTLY_OPTIONS 10687c478bd9Sstevel@tonic-gatedo 10697c478bd9Sstevel@tonic-gate case $FLAG in 10707c478bd9Sstevel@tonic-gate A ) A_FLAG=y 10717c478bd9Sstevel@tonic-gate ;; 10727c478bd9Sstevel@tonic-gate B ) D_FLAG=y 10737c478bd9Sstevel@tonic-gate ;; # old version of D 10747c478bd9Sstevel@tonic-gate F ) F_FLAG=y 10757c478bd9Sstevel@tonic-gate ;; 10767c478bd9Sstevel@tonic-gate D ) D_FLAG=y 10777c478bd9Sstevel@tonic-gate ;; 10787c478bd9Sstevel@tonic-gate P ) P_FLAG=y 10797c478bd9Sstevel@tonic-gate ;; 10807c478bd9Sstevel@tonic-gate T ) T_FLAG=y 10817c478bd9Sstevel@tonic-gate ;; 10827c478bd9Sstevel@tonic-gate C ) C_FLAG=y 10837c478bd9Sstevel@tonic-gate ;; 10847c478bd9Sstevel@tonic-gate M ) M_FLAG=y 10857c478bd9Sstevel@tonic-gate ;; 10867c478bd9Sstevel@tonic-gate N ) N_FLAG=y 10877c478bd9Sstevel@tonic-gate ;; 10887c478bd9Sstevel@tonic-gate G ) a_FLAG=y 10897c478bd9Sstevel@tonic-gate u_FLAG=y 10907c478bd9Sstevel@tonic-gate ;; 10917c478bd9Sstevel@tonic-gate I ) a_FLAG=y 10927c478bd9Sstevel@tonic-gate m_FLAG=y 10937c478bd9Sstevel@tonic-gate p_FLAG=y 10947c478bd9Sstevel@tonic-gate u_FLAG=y 10957c478bd9Sstevel@tonic-gate ;; 10967c478bd9Sstevel@tonic-gate R ) m_FLAG=y 10977c478bd9Sstevel@tonic-gate p_FLAG=y 10987c478bd9Sstevel@tonic-gate ;; 10997c478bd9Sstevel@tonic-gate a ) a_FLAG=y 11007c478bd9Sstevel@tonic-gate ;; 11017c478bd9Sstevel@tonic-gate d ) d_FLAG=y 11027c478bd9Sstevel@tonic-gate ;; 11037c478bd9Sstevel@tonic-gate f ) f_FLAG=y 11047c478bd9Sstevel@tonic-gate ;; 11057c478bd9Sstevel@tonic-gate i ) i_FLAG=y 11067c478bd9Sstevel@tonic-gate ;; 11077c478bd9Sstevel@tonic-gate n ) n_FLAG=y 11087c478bd9Sstevel@tonic-gate ;; 11097c478bd9Sstevel@tonic-gate o ) o_FLAG=y 11107c478bd9Sstevel@tonic-gate ;; 11117c478bd9Sstevel@tonic-gate l ) l_FLAG=y 11127c478bd9Sstevel@tonic-gate ;; 11137c478bd9Sstevel@tonic-gate m ) m_FLAG=y 11147c478bd9Sstevel@tonic-gate ;; 11157c478bd9Sstevel@tonic-gate p ) p_FLAG=y 11167c478bd9Sstevel@tonic-gate ;; 11177c478bd9Sstevel@tonic-gate r ) r_FLAG=y 11187c478bd9Sstevel@tonic-gate ;; 11197c478bd9Sstevel@tonic-gate t ) t_FLAG=y 11207c478bd9Sstevel@tonic-gate ;; 11217c478bd9Sstevel@tonic-gate u ) u_FLAG=y 11227c478bd9Sstevel@tonic-gate ;; 11237c478bd9Sstevel@tonic-gate z ) z_FLAG=y 11247c478bd9Sstevel@tonic-gate ;; 11257c478bd9Sstevel@tonic-gate U ) 11267c478bd9Sstevel@tonic-gate if [ -z "${PARENT_ROOT}" ]; then 11277c478bd9Sstevel@tonic-gate echo "PARENT_ROOT must be set if the U flag is" \ 11287c478bd9Sstevel@tonic-gate "present in NIGHTLY_OPTIONS." 11297c478bd9Sstevel@tonic-gate exit 1 11307c478bd9Sstevel@tonic-gate fi 11317c478bd9Sstevel@tonic-gate U_FLAG=y 11327c478bd9Sstevel@tonic-gate NIGHTLY_PARENT_ROOT=$PARENT_ROOT 11337c478bd9Sstevel@tonic-gate ;; 11347c478bd9Sstevel@tonic-gate x ) XMOD_OPT="-x" 11357c478bd9Sstevel@tonic-gate ;; 11367c478bd9Sstevel@tonic-gate W ) W_FLAG=y 11377c478bd9Sstevel@tonic-gate ;; 11387c478bd9Sstevel@tonic-gate S ) 11397c478bd9Sstevel@tonic-gate if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 11407c478bd9Sstevel@tonic-gate echo "Can only build one source variant at a time." 11417c478bd9Sstevel@tonic-gate exit 1 11427c478bd9Sstevel@tonic-gate fi 11437c478bd9Sstevel@tonic-gate if [ "${OPTARG}" = "E" ]; then 11447c478bd9Sstevel@tonic-gate SE_FLAG=y 11457c478bd9Sstevel@tonic-gate elif [ "${OPTARG}" = "D" ]; then 11467c478bd9Sstevel@tonic-gate SD_FLAG=y 11477c478bd9Sstevel@tonic-gate elif [ "${OPTARG}" = "H" ]; then 11487c478bd9Sstevel@tonic-gate SH_FLAG=y 11497c478bd9Sstevel@tonic-gate else 11507c478bd9Sstevel@tonic-gate echo "$USAGE" 11517c478bd9Sstevel@tonic-gate exit 1 11527c478bd9Sstevel@tonic-gate fi 11537c478bd9Sstevel@tonic-gate ;; 11547c478bd9Sstevel@tonic-gate X ) # now that we no longer need realmode builds, just 11557c478bd9Sstevel@tonic-gate # copy IHV packages. only meaningful on x86. 11567c478bd9Sstevel@tonic-gate if [ "$MACH" = "i386" ]; then 11577c478bd9Sstevel@tonic-gate X_FLAG=y 11587c478bd9Sstevel@tonic-gate fi 11597c478bd9Sstevel@tonic-gate ;; 11607c478bd9Sstevel@tonic-gate \? ) echo "$USAGE" 11617c478bd9Sstevel@tonic-gate exit 1 11627c478bd9Sstevel@tonic-gate ;; 11637c478bd9Sstevel@tonic-gate esac 11647c478bd9Sstevel@tonic-gatedone 11657c478bd9Sstevel@tonic-gate 11667c478bd9Sstevel@tonic-gateif [ $ISUSER -ne 0 ]; then 11677c478bd9Sstevel@tonic-gate if [ "$o_FLAG" = "y" ]; then 11687c478bd9Sstevel@tonic-gate echo "Old-style build requires root permission." 11697c478bd9Sstevel@tonic-gate exit 1 11707c478bd9Sstevel@tonic-gate fi 11717c478bd9Sstevel@tonic-gate 11727c478bd9Sstevel@tonic-gate # Set default value for STAFFER, if needed. 11737c478bd9Sstevel@tonic-gate if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then 11747c478bd9Sstevel@tonic-gate STAFFER=`/usr/xpg4/bin/id -un` 11757c478bd9Sstevel@tonic-gate export STAFFER 11767c478bd9Sstevel@tonic-gate fi 11777c478bd9Sstevel@tonic-gatefi 11787c478bd9Sstevel@tonic-gate 11797c478bd9Sstevel@tonic-gateif [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then 11807c478bd9Sstevel@tonic-gate MAILTO=$STAFFER 11817c478bd9Sstevel@tonic-gate export MAILTO 11827c478bd9Sstevel@tonic-gatefi 11837c478bd9Sstevel@tonic-gate 11847c478bd9Sstevel@tonic-gatePATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin" 11857c478bd9Sstevel@tonic-gatePATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb" 11867c478bd9Sstevel@tonic-gatePATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:." 11877c478bd9Sstevel@tonic-gateexport PATH 11887c478bd9Sstevel@tonic-gate 1189fb23a357Skupfer# roots of source trees, both relative to $SRC and absolute. 1190fb23a357Skupferrelsrcdirs="." 1191fb9f9b97Skupferif [[ -d $SRC/../closed && "$CLOSED_IS_PRESENT" != no ]]; then 1192fb9f9b97Skupfer relsrcdirs="$relsrcdirs ../closed" 1193fb9f9b97Skupferfi 1194fb23a357Skupferabssrcdirs="" 1195fb23a357Skupferfor d in $relsrcdirs; do 1196fb23a357Skupfer abssrcdirs="$abssrcdirs $SRC/$d" 1197fb23a357Skupferdone 1198fb23a357Skupfer 11997c478bd9Sstevel@tonic-gateunset CH 12007c478bd9Sstevel@tonic-gateif [ "$o_FLAG" = "y" ]; then 12017c478bd9Sstevel@tonic-gate# root invoked old-style build -- make sure it works as it always has 12027c478bd9Sstevel@tonic-gate# by exporting 'CH'. The current Makefile.master doesn't use this, but 12037c478bd9Sstevel@tonic-gate# the old ones still do. 12047c478bd9Sstevel@tonic-gate PROTOCMPTERSE="protocmp.terse" 12057c478bd9Sstevel@tonic-gate CH= 12067c478bd9Sstevel@tonic-gate export CH 12077c478bd9Sstevel@tonic-gateelse 12087c478bd9Sstevel@tonic-gate PROTOCMPTERSE="protocmp.terse -gu" 12097c478bd9Sstevel@tonic-gatefi 12107c478bd9Sstevel@tonic-gatePOUND_SIGN="#" 12117c478bd9Sstevel@tonic-gate 12127c478bd9Sstevel@tonic-gate# we export POUND_SIGN to speed up the build process -- prevents evaluation of 12137c478bd9Sstevel@tonic-gate# the Makefile.master definitions. 12148ad60789Srieexport o_FLAG POUND_SIGN 12157c478bd9Sstevel@tonic-gate 12167c478bd9Sstevel@tonic-gateif [ "$d_FLAG" = "y" ]; then 12177c478bd9Sstevel@tonic-gate maketype="distributed" 12187c478bd9Sstevel@tonic-gate MAKE=dmake 12197c478bd9Sstevel@tonic-gate # get the dmake version string alone 12207c478bd9Sstevel@tonic-gate DMAKE_VERSION=$( $MAKE -v ) 12217c478bd9Sstevel@tonic-gate DMAKE_VERSION=${DMAKE_VERSION#*: } 12227c478bd9Sstevel@tonic-gate # focus in on just the dotted version number alone 12237c478bd9Sstevel@tonic-gate DMAKE_MAJOR=$( echo $DMAKE_VERSION | \ 12247c478bd9Sstevel@tonic-gate sed -e 's/.*\<\([^.]*\.[^ ]*\).*$/\1/' ) 12257c478bd9Sstevel@tonic-gate # extract the second (or final) integer 12267c478bd9Sstevel@tonic-gate DMAKE_MINOR=${DMAKE_MAJOR#*.} 12277c478bd9Sstevel@tonic-gate DMAKE_MINOR=${DMAKE_MINOR%%.*} 12287c478bd9Sstevel@tonic-gate # extract the first integer 12297c478bd9Sstevel@tonic-gate DMAKE_MAJOR=${DMAKE_MAJOR%%.*} 12307c478bd9Sstevel@tonic-gate CHECK_DMAKE=${CHECK_DMAKE:-y} 12317c478bd9Sstevel@tonic-gate # x86 was built on the 12th, sparc on the 13th. 12327c478bd9Sstevel@tonic-gate if [ "$CHECK_DMAKE" = "y" -a \ 12337c478bd9Sstevel@tonic-gate "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \ 12347c478bd9Sstevel@tonic-gate "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \( \ 12357c478bd9Sstevel@tonic-gate "$DMAKE_MAJOR" -lt 7 -o \ 12367c478bd9Sstevel@tonic-gate "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \) ]; then 12377c478bd9Sstevel@tonic-gate if [ -z "$DMAKE_VERSION" ]; then 12387c478bd9Sstevel@tonic-gate echo "$MAKE is missing." 12397c478bd9Sstevel@tonic-gate exit 1 12407c478bd9Sstevel@tonic-gate fi 12417c478bd9Sstevel@tonic-gate echo `whence $MAKE`" version is:" 12427c478bd9Sstevel@tonic-gate echo " ${DMAKE_VERSION}" 12437c478bd9Sstevel@tonic-gate cat <<EOF 12447c478bd9Sstevel@tonic-gate 12457c478bd9Sstevel@tonic-gateThis version may not be safe for use. Either set TEAMWARE to a better 12467c478bd9Sstevel@tonic-gatepath or (if you really want to use this version of dmake anyway), add 12477c478bd9Sstevel@tonic-gatethe following to your environment to disable this check: 12487c478bd9Sstevel@tonic-gate 12497c478bd9Sstevel@tonic-gate CHECK_DMAKE=n 12507c478bd9Sstevel@tonic-gateEOF 12517c478bd9Sstevel@tonic-gate exit 1 12527c478bd9Sstevel@tonic-gate fi 12537c478bd9Sstevel@tonic-gateelse 12547c478bd9Sstevel@tonic-gate PATH="$TEAMWARE/ParallelMake/bin:$PATH" 12557c478bd9Sstevel@tonic-gate maketype="parallel" 12567c478bd9Sstevel@tonic-gate MAKE=make 12577c478bd9Sstevel@tonic-gatefi 12587c478bd9Sstevel@tonic-gateexport PATH 12597c478bd9Sstevel@tonic-gateexport MAKE 12607c478bd9Sstevel@tonic-gate 12617c478bd9Sstevel@tonic-gateif [ "${SUNWSPRO}" != "" ]; then 12627c478bd9Sstevel@tonic-gate PATH="${SUNWSPRO}/bin:$PATH" 12637c478bd9Sstevel@tonic-gate export PATH 12647c478bd9Sstevel@tonic-gatefi 12657c478bd9Sstevel@tonic-gate 12667c478bd9Sstevel@tonic-gatehostname=`uname -n` 12677c478bd9Sstevel@tonic-gateif [ ! -f $HOME/.make.machines ]; then 12687c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS=4 12697c478bd9Sstevel@tonic-gateelse 12707c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS="`grep $hostname $HOME/.make.machines | \ 12717c478bd9Sstevel@tonic-gate tail -1 | awk -F= '{print $ 2;}'`" 12727c478bd9Sstevel@tonic-gate if [ "$DMAKE_MAX_JOBS" = "" ]; then 12737c478bd9Sstevel@tonic-gate DMAKE_MAX_JOBS=4 12747c478bd9Sstevel@tonic-gate fi 12757c478bd9Sstevel@tonic-gatefi 12767c478bd9Sstevel@tonic-gateDMAKE_MODE=parallel; 12777c478bd9Sstevel@tonic-gateexport DMAKE_MODE 12787c478bd9Sstevel@tonic-gateexport DMAKE_MAX_JOBS 12797c478bd9Sstevel@tonic-gate 12807c478bd9Sstevel@tonic-gateif [ -z "${ROOT}" ]; then 12817c478bd9Sstevel@tonic-gate echo "ROOT must be set." 12827c478bd9Sstevel@tonic-gate exit 1 12837c478bd9Sstevel@tonic-gatefi 12847c478bd9Sstevel@tonic-gate 12857c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" ]; then 12867c478bd9Sstevel@tonic-gate if [ -z "${EXPORT_SRC}" ]; then 12877c478bd9Sstevel@tonic-gate echo "EXPORT_SRC must be set for a source build." 12887c478bd9Sstevel@tonic-gate exit 1 12897c478bd9Sstevel@tonic-gate fi 12907c478bd9Sstevel@tonic-gate if [ -z "${CRYPT_SRC}" ]; then 12917c478bd9Sstevel@tonic-gate echo "CRYPT_SRC must be set for a source build." 12927c478bd9Sstevel@tonic-gate exit 1 12937c478bd9Sstevel@tonic-gate fi 12947c478bd9Sstevel@tonic-gatefi 12957c478bd9Sstevel@tonic-gate 12967c478bd9Sstevel@tonic-gateif [ "$SH_FLAG" = "y" ]; then 12977c478bd9Sstevel@tonic-gate if [ -z "${EXPORT_SRC}" ]; then 12987c478bd9Sstevel@tonic-gate echo "EXPORT_SRC must be set for a source build." 12997c478bd9Sstevel@tonic-gate exit 1 13007c478bd9Sstevel@tonic-gate fi 13017c478bd9Sstevel@tonic-gatefi 13027c478bd9Sstevel@tonic-gate 13037c478bd9Sstevel@tonic-gate# 13047c478bd9Sstevel@tonic-gate# if -V flag was given, reset VERSION to V_ARG 13057c478bd9Sstevel@tonic-gate# 13067c478bd9Sstevel@tonic-gateif [ "$V_FLAG" = "y" ]; then 13077c478bd9Sstevel@tonic-gate VERSION=$V_ARG 13087c478bd9Sstevel@tonic-gatefi 13097c478bd9Sstevel@tonic-gate 131004a42e3eSszhou# 131104a42e3eSszhou# Check for IHV root for copying ihv proto area 131204a42e3eSszhou# 131304a42e3eSszhouif [ "$X_FLAG" = "y" ]; then 131404a42e3eSszhou if [ "$IA32_IHV_ROOT" = "" ]; then 131504a42e3eSszhou echo "IA32_IHV_ROOT: must be set for copying ihv proto" 131604a42e3eSszhou args_ok=n 131704a42e3eSszhou fi 131804a42e3eSszhou if [ ! -d "$IA32_IHV_ROOT" ]; then 131904a42e3eSszhou echo "$IA32_IHV_ROOT: not found" 132004a42e3eSszhou args_ok=n 132104a42e3eSszhou fi 132204a42e3eSszhoufi 132304a42e3eSszhou 13247c478bd9Sstevel@tonic-gate# Append source version 13257c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" ]; then 13267c478bd9Sstevel@tonic-gate VERSION="${VERSION}:EXPORT" 13277c478bd9Sstevel@tonic-gatefi 13287c478bd9Sstevel@tonic-gate 13297c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 13307c478bd9Sstevel@tonic-gate VERSION="${VERSION}:DOMESTIC" 13317c478bd9Sstevel@tonic-gatefi 13327c478bd9Sstevel@tonic-gate 13337c478bd9Sstevel@tonic-gateif [ "$SH_FLAG" = "y" ]; then 13347c478bd9Sstevel@tonic-gate VERSION="${VERSION}:MODIFIED_SOURCE_PRODUCT" 13357c478bd9Sstevel@tonic-gatefi 13367c478bd9Sstevel@tonic-gate 13377c478bd9Sstevel@tonic-gateTMPDIR="/tmp/nightly.tmpdir.$$" 13387c478bd9Sstevel@tonic-gateexport TMPDIR 13397c478bd9Sstevel@tonic-gaterm -rf ${TMPDIR} 13407c478bd9Sstevel@tonic-gatemkdir -p $TMPDIR || exit 1 13417c478bd9Sstevel@tonic-gate 13427c478bd9Sstevel@tonic-gate# 13437c478bd9Sstevel@tonic-gate# Keep elfsign's use of pkcs11_softtoken from looking in the user home 13447c478bd9Sstevel@tonic-gate# directory, which doesn't always work. Needed until all build machines 13457c478bd9Sstevel@tonic-gate# have the fix for 6271754 13467c478bd9Sstevel@tonic-gate# 13477c478bd9Sstevel@tonic-gateSOFTTOKEN_DIR=$TMPDIR 13487c478bd9Sstevel@tonic-gateexport SOFTTOKEN_DIR 13497c478bd9Sstevel@tonic-gate 13507c478bd9Sstevel@tonic-gateTOOLS=${SRC}/tools 13517c478bd9Sstevel@tonic-gateTOOLS_PROTO=${TOOLS}/proto 13527c478bd9Sstevel@tonic-gate 13537c478bd9Sstevel@tonic-gateunset CFLAGS LD_LIBRARY_PATH LDFLAGS 13547c478bd9Sstevel@tonic-gate 13557c478bd9Sstevel@tonic-gate# create directories that are automatically removed if the nightly script 13567c478bd9Sstevel@tonic-gate# fails to start correctly 13577c478bd9Sstevel@tonic-gatenewdir() { 13587c478bd9Sstevel@tonic-gate dir=$1 13597c478bd9Sstevel@tonic-gate toadd= 13607c478bd9Sstevel@tonic-gate while [ ! -d $dir ]; do 13617c478bd9Sstevel@tonic-gate toadd="$dir $toadd" 13627c478bd9Sstevel@tonic-gate dir=`dirname $dir` 13637c478bd9Sstevel@tonic-gate done 13647c478bd9Sstevel@tonic-gate torm= 13657c478bd9Sstevel@tonic-gate newlist= 13667c478bd9Sstevel@tonic-gate for dir in $toadd; do 13677c478bd9Sstevel@tonic-gate if staffer mkdir $dir; then 13687c478bd9Sstevel@tonic-gate newlist="$ISUSER $dir $newlist" 13697c478bd9Sstevel@tonic-gate torm="$dir $torm" 13707c478bd9Sstevel@tonic-gate else 13717c478bd9Sstevel@tonic-gate [ -z "$torm" ] || staffer rmdir $torm 13727c478bd9Sstevel@tonic-gate return 1 13737c478bd9Sstevel@tonic-gate fi 13747c478bd9Sstevel@tonic-gate done 13757c478bd9Sstevel@tonic-gate newdirlist="$newlist $newdirlist" 13767c478bd9Sstevel@tonic-gate return 0 13777c478bd9Sstevel@tonic-gate} 13787c478bd9Sstevel@tonic-gatenewdirlist= 13797c478bd9Sstevel@tonic-gate 13807c478bd9Sstevel@tonic-gate[ -d $CODEMGR_WS ] || newdir $CODEMGR_WS || exit 1 13817c478bd9Sstevel@tonic-gate 13827c478bd9Sstevel@tonic-gate# since this script assumes the build is from full source, it nullifies 13837c478bd9Sstevel@tonic-gate# variables likely to have been set by a "ws" script; nullification 13847c478bd9Sstevel@tonic-gate# confines the search space for headers and libraries to the proto area 13857c478bd9Sstevel@tonic-gate# built from this immediate source. 13867c478bd9Sstevel@tonic-gateENVLDLIBS1= 13877c478bd9Sstevel@tonic-gateENVLDLIBS2= 13887c478bd9Sstevel@tonic-gateENVLDLIBS3= 13897c478bd9Sstevel@tonic-gateENVCPPFLAGS1= 13907c478bd9Sstevel@tonic-gateENVCPPFLAGS2= 13917c478bd9Sstevel@tonic-gateENVCPPFLAGS3= 13927c478bd9Sstevel@tonic-gateENVCPPFLAGS4= 13937c478bd9Sstevel@tonic-gatePARENT_ROOT= 13947c478bd9Sstevel@tonic-gate 13957c478bd9Sstevel@tonic-gateexport ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \ 13967c478bd9Sstevel@tonic-gate PARENT_ROOT 13977c478bd9Sstevel@tonic-gate 13987c478bd9Sstevel@tonic-gateENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib" 13997c478bd9Sstevel@tonic-gateENVCPPFLAGS1="-I$ROOT/usr/include" 14007c478bd9Sstevel@tonic-gate 14017c478bd9Sstevel@tonic-gateexport ENVLDLIBS1 ENVLDLIBS2 14027c478bd9Sstevel@tonic-gate 14037c478bd9Sstevel@tonic-gateCPIODIR_ORIG=$CPIODIR 14047c478bd9Sstevel@tonic-gatePKGARCHIVE_ORIG=$PKGARCHIVE 14057c478bd9Sstevel@tonic-gateIA32_IHV_PKGS_ORIG=$IA32_IHV_PKGS 1406d8fd4470Sjgif [ "$SPARC_RM_PKGARCHIVE" ]; then 14077c478bd9Sstevel@tonic-gate SPARC_RM_PKGARCHIVE_ORIG=$SPARC_RM_PKGARCHIVE 1408d8fd4470Sjgfi 14097c478bd9Sstevel@tonic-gate 14107c478bd9Sstevel@tonic-gate# 14117c478bd9Sstevel@tonic-gate# Juggle the logs and optionally send mail on completion. 14127c478bd9Sstevel@tonic-gate# 14137c478bd9Sstevel@tonic-gate 14147c478bd9Sstevel@tonic-gatelogshuffle() { 14151c79753fSdarrenm LLOG="$ATLOG/log.`date '+%F'`" 14167c478bd9Sstevel@tonic-gate rm -rf $ATLOG/log.??`date '+%d'` 14171c79753fSdarrenm rm -rf $ATLOG/log.????-??-`date '+%d'` 14187c478bd9Sstevel@tonic-gate if [ -f $LLOG -o -d $LLOG ]; then 14197c478bd9Sstevel@tonic-gate LLOG=$LLOG.$$ 14207c478bd9Sstevel@tonic-gate fi 14217c478bd9Sstevel@tonic-gate mkdir $LLOG 14227c478bd9Sstevel@tonic-gate 14237c478bd9Sstevel@tonic-gate if [ "$build_ok" = "y" ]; then 14247c478bd9Sstevel@tonic-gate mv $ATLOG/proto_list_${MACH} $LLOG 14257c478bd9Sstevel@tonic-gate fi 14267c478bd9Sstevel@tonic-gate 14277c478bd9Sstevel@tonic-gate # 14287c478bd9Sstevel@tonic-gate # Now that we're about to send mail, it's time to check the noise 14297c478bd9Sstevel@tonic-gate # file. In the event that an error occurs beyond this point, it will 14307c478bd9Sstevel@tonic-gate # be recorded in the nightly.log file, but nowhere else. This would 14317c478bd9Sstevel@tonic-gate # include only errors that cause the copying of the noise log to fail 14327c478bd9Sstevel@tonic-gate # or the mail itself not to be sent. 14337c478bd9Sstevel@tonic-gate # 14347c478bd9Sstevel@tonic-gate 14357c478bd9Sstevel@tonic-gate exec >>$LOGFILE 2>&1 14367c478bd9Sstevel@tonic-gate if [ -s $build_noise_file ]; then 14377c478bd9Sstevel@tonic-gate echo "\n==== Nightly build noise ====\n" | 14387c478bd9Sstevel@tonic-gate tee -a $LOGFILE >>$mail_msg_file 14397c478bd9Sstevel@tonic-gate cat $build_noise_file >>$LOGFILE 14407c478bd9Sstevel@tonic-gate cat $build_noise_file >>$mail_msg_file 14417c478bd9Sstevel@tonic-gate echo | tee -a $LOGFILE >>$mail_msg_file 14427c478bd9Sstevel@tonic-gate fi 14437c478bd9Sstevel@tonic-gate rm -f $build_noise_file 14447c478bd9Sstevel@tonic-gate 14457c478bd9Sstevel@tonic-gate case "$build_ok" in 14467c478bd9Sstevel@tonic-gate y) 14477c478bd9Sstevel@tonic-gate state=Completed 14487c478bd9Sstevel@tonic-gate ;; 14497c478bd9Sstevel@tonic-gate i) 14507c478bd9Sstevel@tonic-gate state=Interrupted 14517c478bd9Sstevel@tonic-gate ;; 14527c478bd9Sstevel@tonic-gate *) 14537c478bd9Sstevel@tonic-gate state=Failed 14547c478bd9Sstevel@tonic-gate ;; 14557c478bd9Sstevel@tonic-gate esac 14567c478bd9Sstevel@tonic-gate 14577c478bd9Sstevel@tonic-gate cat $build_time_file $mail_msg_file > ${LLOG}/mail_msg 14587c478bd9Sstevel@tonic-gate if [ "$m_FLAG" = "y" ]; then 14597c478bd9Sstevel@tonic-gate cat $build_time_file $mail_msg_file | 14607c478bd9Sstevel@tonic-gate /usr/bin/mailx -s \ 14617c478bd9Sstevel@tonic-gate "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \ 14627c478bd9Sstevel@tonic-gate ${MAILTO} 14637c478bd9Sstevel@tonic-gate fi 14647c478bd9Sstevel@tonic-gate 14657c478bd9Sstevel@tonic-gate if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 14667c478bd9Sstevel@tonic-gate staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH} 14677c478bd9Sstevel@tonic-gate staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log 14687c478bd9Sstevel@tonic-gate fi 14697c478bd9Sstevel@tonic-gate 14707c478bd9Sstevel@tonic-gate mv $LOGFILE $LLOG 14717c478bd9Sstevel@tonic-gate} 14727c478bd9Sstevel@tonic-gate 14737c478bd9Sstevel@tonic-gate# 14747c478bd9Sstevel@tonic-gate# Remove the locks and temporary files on any exit 14757c478bd9Sstevel@tonic-gate# 14767c478bd9Sstevel@tonic-gatecleanup() { 14777c478bd9Sstevel@tonic-gate logshuffle 14787c478bd9Sstevel@tonic-gate 14797c478bd9Sstevel@tonic-gate [ -z "$lockfile" ] || staffer rm -f $lockfile 14807c478bd9Sstevel@tonic-gate [ -z "$atloglockfile" ] || rm -f $atloglockfile 14817c478bd9Sstevel@tonic-gate [ -z "$ulockfile" ] || staffer rm -f $ulockfile 14827c478bd9Sstevel@tonic-gate [ -z "$Ulockfile" ] || rm -f $Ulockfile 14837c478bd9Sstevel@tonic-gate 14847c478bd9Sstevel@tonic-gate set -- $newdirlist 14857c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 14867c478bd9Sstevel@tonic-gate ISUSER=$1 staffer rmdir $2 14877c478bd9Sstevel@tonic-gate shift; shift 14887c478bd9Sstevel@tonic-gate done 14897c478bd9Sstevel@tonic-gate rm -rf $TMPDIR 14907c478bd9Sstevel@tonic-gate} 14917c478bd9Sstevel@tonic-gate 14927c478bd9Sstevel@tonic-gatecleanup_signal() { 14937c478bd9Sstevel@tonic-gate build_ok=i 14947c478bd9Sstevel@tonic-gate # this will trigger cleanup(), above. 14957c478bd9Sstevel@tonic-gate exit 1 14967c478bd9Sstevel@tonic-gate} 14977c478bd9Sstevel@tonic-gate 14987c478bd9Sstevel@tonic-gatetrap cleanup 0 14997c478bd9Sstevel@tonic-gatetrap cleanup_signal 1 2 3 15 15007c478bd9Sstevel@tonic-gate 15017c478bd9Sstevel@tonic-gate# 15027c478bd9Sstevel@tonic-gate# Generic lock file processing -- make sure that the lock file doesn't 15037c478bd9Sstevel@tonic-gate# exist. If it does, it should name the build host and PID. If it 15047c478bd9Sstevel@tonic-gate# doesn't, then make sure we can create it. Clean up locks that are 15057c478bd9Sstevel@tonic-gate# known to be stale (assumes host name is unique among build systems 15067c478bd9Sstevel@tonic-gate# for the workspace). 15077c478bd9Sstevel@tonic-gatecreate_lock() { 15087c478bd9Sstevel@tonic-gate lockf=$1 15097c478bd9Sstevel@tonic-gate lockvar=$2 15107c478bd9Sstevel@tonic-gate if [ -f $lockf ]; then 15117c478bd9Sstevel@tonic-gate basews=`basename $CODEMGR_WS` 15127c478bd9Sstevel@tonic-gate if read host user pid < $lockf; then 15137c478bd9Sstevel@tonic-gate if [ "$host" != "$hostname" ]; then 15147c478bd9Sstevel@tonic-gate echo "$MACH build of $basews apparently" \ 15157c478bd9Sstevel@tonic-gate "already started by $user on $host as $pid." 15167c478bd9Sstevel@tonic-gate elif kill -s 0 $pid 2>/dev/null; then 15177c478bd9Sstevel@tonic-gate echo "$MACH build of $basews already started" \ 15187c478bd9Sstevel@tonic-gate "by $user as $pid." 15197c478bd9Sstevel@tonic-gate else 15207c478bd9Sstevel@tonic-gate # stale lock; clear it out and continue 15217c478bd9Sstevel@tonic-gate rm -f $lockf 15227c478bd9Sstevel@tonic-gate fi 15237c478bd9Sstevel@tonic-gate else 15247c478bd9Sstevel@tonic-gate echo "$MACH build of $basews already running." 15257c478bd9Sstevel@tonic-gate fi 15267c478bd9Sstevel@tonic-gate fi 15277c478bd9Sstevel@tonic-gate if [ -f $lockf ]; then 15287c478bd9Sstevel@tonic-gate echo "Lock file is $lockf." 15297c478bd9Sstevel@tonic-gate exit 1 15307c478bd9Sstevel@tonic-gate fi 15317c478bd9Sstevel@tonic-gate ldir=`dirname $lockf` 15327c478bd9Sstevel@tonic-gate [ -d $ldir ] || newdir $ldir || exit 1 15337c478bd9Sstevel@tonic-gate eval $lockvar=$lockf 15347c478bd9Sstevel@tonic-gate staffer sh -c "echo $hostname $STAFFER $$ > $lockf" || exit 1 15357c478bd9Sstevel@tonic-gate} 15367c478bd9Sstevel@tonic-gate 15377c478bd9Sstevel@tonic-gate# Ensure no other instance of this script is running on this host. 15387c478bd9Sstevel@tonic-gate# LOCKNAME can be set in <env_file>, and is by default, but is not 15397c478bd9Sstevel@tonic-gate# required due to the use of $ATLOG below. 15407c478bd9Sstevel@tonic-gateif [ -n "$LOCKNAME" ]; then 15417c478bd9Sstevel@tonic-gate create_lock /tmp/$LOCKNAME "lockfile" 15427c478bd9Sstevel@tonic-gatefi 15437c478bd9Sstevel@tonic-gate# 15447c478bd9Sstevel@tonic-gate# Create from one, two, or three other locks: 15457c478bd9Sstevel@tonic-gate# $ATLOG/nightly.lock 15467c478bd9Sstevel@tonic-gate# - protects against multiple builds in same workspace 15477c478bd9Sstevel@tonic-gate# $PARENT_WS/usr/src/nightly.$MACH.lock 15487c478bd9Sstevel@tonic-gate# - protects against multiple 'u' copy-backs 15497c478bd9Sstevel@tonic-gate# $NIGHTLY_PARENT_ROOT/nightly.lock 15507c478bd9Sstevel@tonic-gate# - protects against multiple 'U' copy-backs 15517c478bd9Sstevel@tonic-gate# 15527c478bd9Sstevel@tonic-gate# Overriding ISUSER to 1 causes the lock to be created as root if the 15537c478bd9Sstevel@tonic-gate# script is run as root. The default is to create it as $STAFFER. 15547c478bd9Sstevel@tonic-gateISUSER=1 create_lock $ATLOG/nightly.lock "atloglockfile" 15557c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" ]; then 15567c478bd9Sstevel@tonic-gate create_lock $PARENT_WS/usr/src/nightly.$MACH.lock "ulockfile" 15577c478bd9Sstevel@tonic-gatefi 15587c478bd9Sstevel@tonic-gateif [ "$U_FLAG" = "y" ]; then 15597c478bd9Sstevel@tonic-gate # NIGHTLY_PARENT_ROOT is written as root if script invoked as root. 15607c478bd9Sstevel@tonic-gate ISUSER=1 create_lock $NIGHTLY_PARENT_ROOT/nightly.lock "Ulockfile" 15617c478bd9Sstevel@tonic-gatefi 15627c478bd9Sstevel@tonic-gate 15637c478bd9Sstevel@tonic-gate# Locks have been taken, so we're doing a build and we're committed to 15647c478bd9Sstevel@tonic-gate# the directories we may have created so far. 15657c478bd9Sstevel@tonic-gatenewdirlist= 15667c478bd9Sstevel@tonic-gate 15677c478bd9Sstevel@tonic-gate# 15687c478bd9Sstevel@tonic-gate# Create mail_msg_file 15697c478bd9Sstevel@tonic-gate# 15707c478bd9Sstevel@tonic-gatemail_msg_file="${TMPDIR}/mail_msg" 15717c478bd9Sstevel@tonic-gatetouch $mail_msg_file 15727c478bd9Sstevel@tonic-gatebuild_time_file="${TMPDIR}/build_time" 15737c478bd9Sstevel@tonic-gate# 15747c478bd9Sstevel@tonic-gate# Move old LOGFILE aside 15757c478bd9Sstevel@tonic-gate# ATLOG directory already made by 'create_lock' above 15767c478bd9Sstevel@tonic-gate# 15777c478bd9Sstevel@tonic-gateif [ -f $LOGFILE ]; then 15787c478bd9Sstevel@tonic-gate mv -f $LOGFILE ${LOGFILE}- 15797c478bd9Sstevel@tonic-gatefi 15807c478bd9Sstevel@tonic-gate# 15817c478bd9Sstevel@tonic-gate# Build OsNet source 15827c478bd9Sstevel@tonic-gate# 15837c478bd9Sstevel@tonic-gateSTART_DATE=`date` 15847c478bd9Sstevel@tonic-gateSECONDS=0 15857c478bd9Sstevel@tonic-gateecho "\n==== Nightly $maketype build started: $START_DATE ====" \ 15867c478bd9Sstevel@tonic-gate | tee -a $LOGFILE > $build_time_file 15877c478bd9Sstevel@tonic-gate 15887c478bd9Sstevel@tonic-gate# make sure we log only to the nightly build file 15897c478bd9Sstevel@tonic-gatebuild_noise_file="${TMPDIR}/build_noise" 15907c478bd9Sstevel@tonic-gateexec </dev/null >$build_noise_file 2>&1 15917c478bd9Sstevel@tonic-gate 15927c478bd9Sstevel@tonic-gateecho "\n==== list of environment variables ====\n" >> $LOGFILE 15937c478bd9Sstevel@tonic-gateenv >> $LOGFILE 15947c478bd9Sstevel@tonic-gate 15957c478bd9Sstevel@tonic-gateecho "\n==== Nightly argument issues ====\n" | tee -a $mail_msg_file >> $LOGFILE 15967c478bd9Sstevel@tonic-gate 15977c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 15987c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "y" -o "$i_CMD_LINE_FLAG" = "y" ]; then 15997c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support incremental" \ 16007c478bd9Sstevel@tonic-gate "builds; forcing clobber\n" | tee -a $mail_msg_file >> $LOGFILE 16017c478bd9Sstevel@tonic-gate i_FLAG=n 16027c478bd9Sstevel@tonic-gate i_CMD_LINE_FLAG=n 16037c478bd9Sstevel@tonic-gate fi 16047c478bd9Sstevel@tonic-gate if [ "$N_FLAG" = "n" ]; then 16057c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support protocmp;" \ 16067c478bd9Sstevel@tonic-gate "protocmp disabled\n" | \ 16077c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16087c478bd9Sstevel@tonic-gate N_FLAG=y 16097c478bd9Sstevel@tonic-gate fi 16107c478bd9Sstevel@tonic-gate if [ "$l_FLAG" = "y" ]; then 16117c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support lint;" \ 16127c478bd9Sstevel@tonic-gate "lint disabled\n" | tee -a $mail_msg_file >> $LOGFILE 16137c478bd9Sstevel@tonic-gate l_FLAG=n 16147c478bd9Sstevel@tonic-gate fi 16157c478bd9Sstevel@tonic-gate if [ "$C_FLAG" = "y" ]; then 16167c478bd9Sstevel@tonic-gate echo "WARNING: the -S flags do not support cstyle;" \ 16177c478bd9Sstevel@tonic-gate "cstyle check disabled\n" | tee -a $mail_msg_file >> $LOGFILE 16187c478bd9Sstevel@tonic-gate C_FLAG=n 16197c478bd9Sstevel@tonic-gate fi 16207c478bd9Sstevel@tonic-gateelse 16217c478bd9Sstevel@tonic-gate if [ "$N_FLAG" = "y" ]; then 16227c478bd9Sstevel@tonic-gate if [ "$p_FLAG" = "y" ]; then 16237c478bd9Sstevel@tonic-gate cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 16247c478bd9Sstevel@tonic-gateWARNING: the p option (create packages) is set, but so is the N option (do 16257c478bd9Sstevel@tonic-gate not run protocmp); this is dangerous; you should unset the N option 16267c478bd9Sstevel@tonic-gateEOF 16277c478bd9Sstevel@tonic-gate else 16287c478bd9Sstevel@tonic-gate cat <<EOF | tee -a $mail_msg_file >> $LOGFILE 16297c478bd9Sstevel@tonic-gateWarning: the N option (do not run protocmp) is set; it probably shouldn't be 16307c478bd9Sstevel@tonic-gateEOF 16317c478bd9Sstevel@tonic-gate fi 16327c478bd9Sstevel@tonic-gate echo "" | tee -a $mail_msg_file >> $LOGFILE 16337c478bd9Sstevel@tonic-gate fi 16347c478bd9Sstevel@tonic-gatefi 16357c478bd9Sstevel@tonic-gate 16367c478bd9Sstevel@tonic-gateif [ "$a_FLAG" = "y" -a "$D_FLAG" = "n" -a "$F_FLAG" = "y" ]; then 16377c478bd9Sstevel@tonic-gate echo "WARNING: Neither DEBUG nor non-DEBUG build requested, but the" \ 16387c478bd9Sstevel@tonic-gate "'a' option was set." | tee -a $mail_msg_file >> $LOGFILE 16397c478bd9Sstevel@tonic-gatefi 16407c478bd9Sstevel@tonic-gate 16417c478bd9Sstevel@tonic-gateif [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 16427c478bd9Sstevel@tonic-gate echo "WARNING: DEBUG build not requested, but lint will be with" \ 16437c478bd9Sstevel@tonic-gate "DEBUG enabled.\n" \ 16447c478bd9Sstevel@tonic-gate | tee -a $mail_msg_file >> $LOGFILE 16457c478bd9Sstevel@tonic-gatefi 16467c478bd9Sstevel@tonic-gate 16477c478bd9Sstevel@tonic-gateif [ "$f_FLAG" = "y" ]; then 16487c478bd9Sstevel@tonic-gate if [ "$i_FLAG" = "y" ]; then 16497c478bd9Sstevel@tonic-gate echo "WARNING: the -f flag cannot be used during incremental" \ 16507c478bd9Sstevel@tonic-gate "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE 16517c478bd9Sstevel@tonic-gate f_FLAG=n 16527c478bd9Sstevel@tonic-gate fi 16537c478bd9Sstevel@tonic-gate if [ "$p_FLAG" != "y" -o "$l_FLAG" != "y" ]; then 16547c478bd9Sstevel@tonic-gate echo "WARNING: the -f flag requires -l and -p; ignoring -f\n" | \ 16557c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16567c478bd9Sstevel@tonic-gate f_FLAG=n 16577c478bd9Sstevel@tonic-gate fi 16587c478bd9Sstevel@tonic-gatefi 16597c478bd9Sstevel@tonic-gate 16607c478bd9Sstevel@tonic-gateif [ "$T_FLAG" = "y" -a -d $SRC/uts/common/dtrace ]; then 16617c478bd9Sstevel@tonic-gate echo "WARNING: TRACE build requested but workspace contains DTrace;" \ 16627c478bd9Sstevel@tonic-gate "-T will have no effect\n" | tee -a $mail_msg_file >> $LOGFILE 16637c478bd9Sstevel@tonic-gatefi 16647c478bd9Sstevel@tonic-gate 16657c478bd9Sstevel@tonic-gateif [ "$t_FLAG" = "n" ]; then 16667c478bd9Sstevel@tonic-gate # 16677c478bd9Sstevel@tonic-gate # We're not doing a tools build, so make sure elfsign(1) is 16687c478bd9Sstevel@tonic-gate # new enough to safely sign non-crypto binaries. We test 16697c478bd9Sstevel@tonic-gate # debugging output from elfsign to detect the old version. 16707c478bd9Sstevel@tonic-gate # 16717c478bd9Sstevel@tonic-gate newelfsigntest=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \ 16727c478bd9Sstevel@tonic-gate -e /usr/lib/security/pkcs11_softtoken.so.1 2>&1 \ 16737c478bd9Sstevel@tonic-gate | egrep algorithmOID` 16747c478bd9Sstevel@tonic-gate if [ -z "$newelfsigntest" ]; then 16757c478bd9Sstevel@tonic-gate echo "WARNING: /usr/bin/elfsign out of date;" \ 16767c478bd9Sstevel@tonic-gate "will only sign crypto modules\n" | \ 16777c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16787c478bd9Sstevel@tonic-gate export ELFSIGN_OBJECT=true 16797c478bd9Sstevel@tonic-gate elif [ "$VERIFY_ELFSIGN" = "y" ]; then 16807c478bd9Sstevel@tonic-gate echo "WARNING: VERIFY_ELFSIGN=y requires" \ 16817c478bd9Sstevel@tonic-gate "the -t flag; ignoring VERIFY_ELFSIGN\n" | \ 16827c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 16837c478bd9Sstevel@tonic-gate fi 16847c478bd9Sstevel@tonic-gatefi 16857c478bd9Sstevel@tonic-gate 168604a42e3eSszhou# copy ihv proto area in addition to the build itself 168704a42e3eSszhou 168804a42e3eSszhouif [ "$X_FLAG" = "y" ]; then 168904a42e3eSszhou 169004a42e3eSszhou # Install IA32 IHV proto area 169104a42e3eSszhou copy_ihv_proto 169204a42e3eSszhoufi 169304a42e3eSszhou 16947c478bd9Sstevel@tonic-gateecho "==== Build environment ====\n" | tee -a $mail_msg_file >> $LOGFILE 16957c478bd9Sstevel@tonic-gate 16967c478bd9Sstevel@tonic-gate# System 16977c478bd9Sstevel@tonic-gatewhence uname | tee -a $mail_msg_file >> $LOGFILE 16987c478bd9Sstevel@tonic-gateuname -a 2>&1 | tee -a $mail_msg_file >> $LOGFILE 16997c478bd9Sstevel@tonic-gateecho | tee -a $mail_msg_file >> $LOGFILE 17007c478bd9Sstevel@tonic-gate 17017c478bd9Sstevel@tonic-gate# nightly (will fail in year 2100 due to SCCS flaw) 17027c478bd9Sstevel@tonic-gateecho "$0 $@" | tee -a $mail_msg_file >> $LOGFILE 17037c478bd9Sstevel@tonic-gateecho "%M% version %I% 20%E%\n" | tee -a $mail_msg_file >> $LOGFILE 17047c478bd9Sstevel@tonic-gate 17057c478bd9Sstevel@tonic-gate# make 17067c478bd9Sstevel@tonic-gatewhence $MAKE | tee -a $mail_msg_file >> $LOGFILE 17077c478bd9Sstevel@tonic-gateif [ "$d_FLAG" = "y" ]; then 17087c478bd9Sstevel@tonic-gate $MAKE -v | tee -a $mail_msg_file >> $LOGFILE 17097c478bd9Sstevel@tonic-gatefi 17107c478bd9Sstevel@tonic-gateecho "number of concurrent jobs = $DMAKE_MAX_JOBS" | 17117c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17127c478bd9Sstevel@tonic-gate 17137c478bd9Sstevel@tonic-gate# 17147c478bd9Sstevel@tonic-gate# Report the compiler versions. 17157c478bd9Sstevel@tonic-gate# 17167c478bd9Sstevel@tonic-gateif [ -f $SRC/Makefile ]; then 17177c478bd9Sstevel@tonic-gate srcroot=$SRC 17187c478bd9Sstevel@tonic-gateelif [ -f $BRINGOVER_WS/usr/src/Makefile ]; then 17197c478bd9Sstevel@tonic-gate srcroot=$BRINGOVER_WS/usr/src 17207c478bd9Sstevel@tonic-gateelse 17217c478bd9Sstevel@tonic-gate echo "\nUnable to find \"Makefile\" in $BRINGOVER_WS/usr/src or $SRC." | 17227c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17237c478bd9Sstevel@tonic-gate exit 1 17247c478bd9Sstevel@tonic-gatefi 17257c478bd9Sstevel@tonic-gate 17267c478bd9Sstevel@tonic-gate( cd $srcroot 17277c478bd9Sstevel@tonic-gate for target in cc-version cc64-version java-version; do 17287c478bd9Sstevel@tonic-gate echo 17297c478bd9Sstevel@tonic-gate # 17307c478bd9Sstevel@tonic-gate # Put statefile somewhere we know we can write to rather than trip 17317c478bd9Sstevel@tonic-gate # over a read-only $srcroot. Use /usr/ccs/bin/make here because 17327c478bd9Sstevel@tonic-gate # it supports -K and ParallelMake doesn't. 17337c478bd9Sstevel@tonic-gate # 17347c478bd9Sstevel@tonic-gate rm -f $TMPDIR/make-state 1735*32f1e47bSsommerfe export SRC=$srcroot 17367c478bd9Sstevel@tonic-gate if /usr/ccs/bin/make -K $TMPDIR/make-state -e $target 2>/dev/null; then 17377c478bd9Sstevel@tonic-gate continue 17387c478bd9Sstevel@tonic-gate fi 17397c478bd9Sstevel@tonic-gate touch $TMPDIR/nocompiler 17407c478bd9Sstevel@tonic-gate done 17417c478bd9Sstevel@tonic-gate echo 17427c478bd9Sstevel@tonic-gate) | tee -a $mail_msg_file >> $LOGFILE 17437c478bd9Sstevel@tonic-gate 17447c478bd9Sstevel@tonic-gateif [ -f $TMPDIR/nocompiler ]; then 17457c478bd9Sstevel@tonic-gate rm -f $TMPDIR/nocompiler 17467c478bd9Sstevel@tonic-gate build_ok=n 17477c478bd9Sstevel@tonic-gate echo "Aborting due to missing compiler." | 17487c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17497c478bd9Sstevel@tonic-gate exit 1 17507c478bd9Sstevel@tonic-gatefi 17517c478bd9Sstevel@tonic-gate 17527c478bd9Sstevel@tonic-gate# as 17537c478bd9Sstevel@tonic-gatewhence as | tee -a $mail_msg_file >> $LOGFILE 17547c478bd9Sstevel@tonic-gateas -V 2>&1 | head -1 | tee -a $mail_msg_file >> $LOGFILE 17557c478bd9Sstevel@tonic-gateecho | tee -a $mail_msg_file >> $LOGFILE 17567c478bd9Sstevel@tonic-gate 17577c478bd9Sstevel@tonic-gate# Check that we're running a capable link-editor 17587c478bd9Sstevel@tonic-gatewhence ld | tee -a $mail_msg_file >> $LOGFILE 17597c478bd9Sstevel@tonic-gateLDVER=`ld -V 2>&1` 17607c478bd9Sstevel@tonic-gateecho $LDVER | tee -a $mail_msg_file >> $LOGFILE 17617c478bd9Sstevel@tonic-gateLDVER=`echo $LDVER | sed -e "s/.*-1\.//" -e "s/:.*//"` 17627c478bd9Sstevel@tonic-gateif [ `expr $LDVER \< 422` -eq 1 ]; then 17637c478bd9Sstevel@tonic-gate echo "The link-editor needs to be at version 422 or higher to build" | \ 17647c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17657c478bd9Sstevel@tonic-gate echo "the latest stuff, hope your build works." | \ 17667c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17677c478bd9Sstevel@tonic-gatefi 17687c478bd9Sstevel@tonic-gate 17697c478bd9Sstevel@tonic-gateecho "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \ 17707c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 17717c478bd9Sstevel@tonic-gate 17727c478bd9Sstevel@tonic-gateecho "\n==== Build version ====\n" | tee -a $mail_msg_file >> $LOGFILE 17737c478bd9Sstevel@tonic-gateecho $VERSION | tee -a $mail_msg_file >> $LOGFILE 17747c478bd9Sstevel@tonic-gate 17757c478bd9Sstevel@tonic-gate# 17767c478bd9Sstevel@tonic-gate# Decide whether to clobber 17777c478bd9Sstevel@tonic-gate# 17787c478bd9Sstevel@tonic-gateif [ "$i_FLAG" = "n" -a -d "$SRC" ]; then 17797c478bd9Sstevel@tonic-gate echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE 17807c478bd9Sstevel@tonic-gate 17817c478bd9Sstevel@tonic-gate cd $SRC 17827c478bd9Sstevel@tonic-gate # remove old clobber file 17837c478bd9Sstevel@tonic-gate rm -f $SRC/clobber.out 17847c478bd9Sstevel@tonic-gate rm -f $SRC/clobber-${MACH}.out 17857c478bd9Sstevel@tonic-gate 17867c478bd9Sstevel@tonic-gate # Remove all .make.state* files, just in case we are restarting 17877c478bd9Sstevel@tonic-gate # the build after having interrupted a previous 'make clobber'. 17887c478bd9Sstevel@tonic-gate find . \( -name SCCS -o -name 'interfaces.*' \) -prune \ 17897c478bd9Sstevel@tonic-gate -o -name '.make.*' -print | xargs rm -f 17907c478bd9Sstevel@tonic-gate 17917c478bd9Sstevel@tonic-gate $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE 17927c478bd9Sstevel@tonic-gate echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file 17937c478bd9Sstevel@tonic-gate grep "$MAKE:" $SRC/clobber-${MACH}.out | 17947c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" \ 17957c478bd9Sstevel@tonic-gate >> $mail_msg_file 17967c478bd9Sstevel@tonic-gate 17977c478bd9Sstevel@tonic-gate if [ "$t_FLAG" = "y" ]; then 17987c478bd9Sstevel@tonic-gate echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE 17997c478bd9Sstevel@tonic-gate cd ${TOOLS} 18007c478bd9Sstevel@tonic-gate rm -f ${TOOLS}/clobber-${MACH}.out 18017c478bd9Sstevel@tonic-gate $MAKE -ek clobber 2>&1 | \ 18027c478bd9Sstevel@tonic-gate tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE 18037c478bd9Sstevel@tonic-gate echo "\n==== Make tools clobber ERRORS ====\n" \ 18047c478bd9Sstevel@tonic-gate >> $mail_msg_file 18057c478bd9Sstevel@tonic-gate grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \ 18067c478bd9Sstevel@tonic-gate >> $mail_msg_file 18077c478bd9Sstevel@tonic-gate rm -rf ${TOOLS_PROTO} 18087c478bd9Sstevel@tonic-gate mkdir -p ${TOOLS_PROTO} 18097c478bd9Sstevel@tonic-gate fi 18107c478bd9Sstevel@tonic-gate rm -rf $ROOT 18117c478bd9Sstevel@tonic-gate 18127c478bd9Sstevel@tonic-gate # Get back to a clean workspace as much as possible to catch 18137c478bd9Sstevel@tonic-gate # problems that only occur on fresh workspaces. 18147c478bd9Sstevel@tonic-gate # Remove all .make.state* files, libraries, and .o's that may 1815fb23a357Skupfer # have been omitted from clobber. A couple of libraries are 1816fb23a357Skupfer # under SCCS, so leave them alone. 18177c478bd9Sstevel@tonic-gate # We should probably blow away temporary directories too. 18187c478bd9Sstevel@tonic-gate cd $SRC 1819fb23a357Skupfer find $relsrcdirs \( -name SCCS -o -name 'interfaces.*' \) -prune -o \ 18207c478bd9Sstevel@tonic-gate \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \ 1821fb23a357Skupfer -name '*.o' \) -print | \ 1822fb23a357Skupfer grep -v 'tools/ctf/dwarf/.*/libdwarf' | xargs rm -f 18237c478bd9Sstevel@tonic-gateelse 18247c478bd9Sstevel@tonic-gate echo "\n==== No clobber at `date` ====\n" >> $LOGFILE 18257c478bd9Sstevel@tonic-gatefi 18267c478bd9Sstevel@tonic-gate 18277c478bd9Sstevel@tonic-gate# 18287c478bd9Sstevel@tonic-gate# Decide whether to bringover to the codemgr workspace 18297c478bd9Sstevel@tonic-gate# 18307c478bd9Sstevel@tonic-gateif [ "$n_FLAG" = "n" ]; then 18317c478bd9Sstevel@tonic-gate echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE 18327c478bd9Sstevel@tonic-gate # sleep on the parent workspace's lock 18337c478bd9Sstevel@tonic-gate while egrep -s write $BRINGOVER_WS/Codemgr_wsdata/locks 18347c478bd9Sstevel@tonic-gate do 18357c478bd9Sstevel@tonic-gate sleep 120 18367c478bd9Sstevel@tonic-gate done 18377c478bd9Sstevel@tonic-gate 18387c478bd9Sstevel@tonic-gate echo "\n==== BRINGOVER LOG ====\n" >> $mail_msg_file 1839*32f1e47bSsommerfe 1840*32f1e47bSsommerfe (staffer $TEAMWARE/bin/bringover -c "nightly update" -p $BRINGOVER_WS \ 1841*32f1e47bSsommerfe -w $CODEMGR_WS $BRINGOVER_FILES < /dev/null 2>&1 || 1842*32f1e47bSsommerfe touch $TMPDIR/bringover_failed 1843*32f1e47bSsommerfe 1844*32f1e47bSsommerfe staffer bringovercheck $CODEMGR_WS 1845*32f1e47bSsommerfe 1846*32f1e47bSsommerfe ) | tee -a $mail_msg_file >> $LOGFILE 1847*32f1e47bSsommerfe 1848*32f1e47bSsommerfe if [ -f $TMPDIR/bringover_failed ]; then 1849*32f1e47bSsommerfe rm -f $TMPDIR/bringover_failed 1850*32f1e47bSsommerfe build_ok=n 1851*32f1e47bSsommerfe echo "trouble with bringover, quitting at `date`." | 18527c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 18537c478bd9Sstevel@tonic-gate exit 1 18547c478bd9Sstevel@tonic-gate fi 1855085d331dSkupfer 1856085d331dSkupfer # 1857085d331dSkupfer # Possible transition from pre-split workspace to split 1858085d331dSkupfer # workspace. See if the bringover changed anything. 1859085d331dSkupfer # 1860085d331dSkupfer CLOSED_IS_PRESENT="$orig_closed_is_present" 1861085d331dSkupfer check_closed_tree 18627c478bd9Sstevel@tonic-gateelse 18637c478bd9Sstevel@tonic-gate echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE 18647c478bd9Sstevel@tonic-gatefi 18657c478bd9Sstevel@tonic-gate 18667c478bd9Sstevel@tonic-gate# 18677c478bd9Sstevel@tonic-gate# Build tools if requested 18687c478bd9Sstevel@tonic-gate# 18697c478bd9Sstevel@tonic-gateif [ "$t_FLAG" = "y" ]; then 18707c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 18717c478bd9Sstevel@tonic-gate export RELEASE_BUILD ; RELEASE_BUILD= 18727c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 18737c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 18747c478bd9Sstevel@tonic-gate 18757c478bd9Sstevel@tonic-gate export ONBLD_TOOLS=${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld} 18767c478bd9Sstevel@tonic-gate build_tools ${TOOLS_PROTO} 18777c478bd9Sstevel@tonic-gatefi 18787c478bd9Sstevel@tonic-gate 18797c478bd9Sstevel@tonic-gateif [ "$i_FLAG" = "y" -a "$SH_FLAG" = "y" ]; then 18807c478bd9Sstevel@tonic-gate echo "\n==== NOT Building base OS-Net source ====\n" | \ 18817c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 18827c478bd9Sstevel@tonic-gateelse 18837c478bd9Sstevel@tonic-gate normal_build 18847c478bd9Sstevel@tonic-gatefi 18857c478bd9Sstevel@tonic-gate 18867c478bd9Sstevel@tonic-gateORIG_SRC=$SRC 18877c478bd9Sstevel@tonic-gateBINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z 18887c478bd9Sstevel@tonic-gate 18897c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 18907c478bd9Sstevel@tonic-gate save_binaries 18917c478bd9Sstevel@tonic-gate 18927c478bd9Sstevel@tonic-gate echo "\n==== Retrieving SCCS files at `date` ====\n" >> $LOGFILE 18937c478bd9Sstevel@tonic-gate SCCSHELPER=${TMPDIR}/sccs-helper 18947c478bd9Sstevel@tonic-gate rm -f ${SCCSHELPER} 18957c478bd9Sstevel@tonic-gatecat >${SCCSHELPER} <<EOF 18967c478bd9Sstevel@tonic-gate#!/bin/ksh 18977c478bd9Sstevel@tonic-gatecd \$1 18987c478bd9Sstevel@tonic-gatecd .. 18997c478bd9Sstevel@tonic-gatesccs get SCCS >/dev/null 2>&1 19007c478bd9Sstevel@tonic-gateEOF 19017c478bd9Sstevel@tonic-gate cd $SRC 19027c478bd9Sstevel@tonic-gate chmod +x ${SCCSHELPER} 1903fb23a357Skupfer find $relsrcdirs -name SCCS | xargs -L 1 ${SCCSHELPER} 19047c478bd9Sstevel@tonic-gate rm -f ${SCCSHELPER} 19057c478bd9Sstevel@tonic-gatefi 19067c478bd9Sstevel@tonic-gate 19077c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 19087c478bd9Sstevel@tonic-gate clone_source ${CODEMGR_WS} ${CRYPT_SRC} CRYPT_SRC 19097c478bd9Sstevel@tonic-gatefi 19107c478bd9Sstevel@tonic-gate 19117c478bd9Sstevel@tonic-gate# EXPORT_SRC comes after CRYPT_SRC since a domestic build will need 19127c478bd9Sstevel@tonic-gate# $SRC pointing to the export_source usr/src. 19137c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 19147c478bd9Sstevel@tonic-gate clone_source ${CODEMGR_WS} ${EXPORT_SRC} EXPORT_SRC 19157c478bd9Sstevel@tonic-gatefi 19167c478bd9Sstevel@tonic-gate 19177c478bd9Sstevel@tonic-gateif [ "$SD_FLAG" = "y" ]; then 19187c478bd9Sstevel@tonic-gate # drop the crypt files in place. 19197c478bd9Sstevel@tonic-gate cd ${EXPORT_SRC} 19207c478bd9Sstevel@tonic-gate echo "\nextracting crypt_files.cpio.Z onto export_source.\n" \ 19217c478bd9Sstevel@tonic-gate >> ${LOGFILE} 19227c478bd9Sstevel@tonic-gate zcat ${CODEMGR_WS}/crypt_files.cpio.Z | \ 19237c478bd9Sstevel@tonic-gate cpio -idmucvB 2>/dev/null >> ${LOGFILE} 19247c478bd9Sstevel@tonic-gate if [ "$?" = "0" ]; then 19257c478bd9Sstevel@tonic-gate echo "\n==== DOMESTIC extraction succeeded ====\n" \ 19267c478bd9Sstevel@tonic-gate >> $mail_msg_file 19277c478bd9Sstevel@tonic-gate else 19287c478bd9Sstevel@tonic-gate echo "\n==== DOMESTIC extraction failed ====\n" \ 19297c478bd9Sstevel@tonic-gate >> $mail_msg_file 19307c478bd9Sstevel@tonic-gate fi 19317c478bd9Sstevel@tonic-gate 19327c478bd9Sstevel@tonic-gatefi 19337c478bd9Sstevel@tonic-gate 19347c478bd9Sstevel@tonic-gateif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then 19357c478bd9Sstevel@tonic-gate # remove proto area here, since we don't clobber 19367c478bd9Sstevel@tonic-gate rm -rf "$ROOT" 19377c478bd9Sstevel@tonic-gate if [ "$t_FLAG" = "y" ]; then 19387c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 19397c478bd9Sstevel@tonic-gate export RELEASE_BUILD ; RELEASE_BUILD= 19407c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 19417c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 19427c478bd9Sstevel@tonic-gate 19437c478bd9Sstevel@tonic-gate build_tools ${EXPORT_SRC}/usr/src/tools/proto 19447c478bd9Sstevel@tonic-gate fi 19457c478bd9Sstevel@tonic-gate 19467c478bd9Sstevel@tonic-gate export EXPORT_RELEASE_BUILD ; EXPORT_RELEASE_BUILD=# 19477c478bd9Sstevel@tonic-gate normal_build 19487c478bd9Sstevel@tonic-gatefi 19497c478bd9Sstevel@tonic-gate 19507c478bd9Sstevel@tonic-gateif [ "$build_ok" = "y" ]; then 19517c478bd9Sstevel@tonic-gate echo "\n==== Creating protolist system file at `date` ====" \ 19527c478bd9Sstevel@tonic-gate >> $LOGFILE 19537c478bd9Sstevel@tonic-gate protolist $ROOT > $ATLOG/proto_list_${MACH} 19547c478bd9Sstevel@tonic-gate echo "==== protolist system file created at `date` ====\n" \ 19557c478bd9Sstevel@tonic-gate >> $LOGFILE 19567c478bd9Sstevel@tonic-gate 19577c478bd9Sstevel@tonic-gate if [ "$N_FLAG" != "y" ]; then 19587c478bd9Sstevel@tonic-gate echo "\n==== Impact on packages ====\n" >> $mail_msg_file 19597c478bd9Sstevel@tonic-gate 19607c478bd9Sstevel@tonic-gate # If there is a reference proto list, compare the build's proto 19617c478bd9Sstevel@tonic-gate # list with the reference to see changes in proto areas. 19627c478bd9Sstevel@tonic-gate # Use the current exception list. 19637c478bd9Sstevel@tonic-gate exc=etc/exception_list_$MACH 19647c478bd9Sstevel@tonic-gate if [ -f $SRC/pkgdefs/$exc ]; then 19657c478bd9Sstevel@tonic-gate ELIST="-e $SRC/pkgdefs/$exc" 19667c478bd9Sstevel@tonic-gate fi 19677c478bd9Sstevel@tonic-gate 19687c478bd9Sstevel@tonic-gate if [ -f "$REF_PROTO_LIST" ]; then 19697c478bd9Sstevel@tonic-gate $PROTOCMPTERSE \ 19707c478bd9Sstevel@tonic-gate "Files in yesterday's proto area, but not today's:" \ 19717c478bd9Sstevel@tonic-gate "Files in today's proto area, but not yesterday's:" \ 19727c478bd9Sstevel@tonic-gate "Files that changed between yesterday and today:" \ 19737c478bd9Sstevel@tonic-gate ${ELIST} \ 19747c478bd9Sstevel@tonic-gate -d $REF_PROTO_LIST \ 19757c478bd9Sstevel@tonic-gate $ATLOG/proto_list_${MACH} \ 19767c478bd9Sstevel@tonic-gate >> $mail_msg_file 19777c478bd9Sstevel@tonic-gate fi 19787c478bd9Sstevel@tonic-gate # Compare the build's proto list with current package 19797c478bd9Sstevel@tonic-gate # definitions to audit the quality of package definitions 19807c478bd9Sstevel@tonic-gate # and makefile install targets. Use the current exception list. 1981fb23a357Skupfer PKGDEFS_LIST="" 1982fb23a357Skupfer for d in $abssrcdirs; do 1983fb23a357Skupfer if [ -d $d/pkgdefs ]; then 1984fb23a357Skupfer PKGDEFS_LIST="$PKGDEFS_LIST -d $d/pkgdefs" 1985fb23a357Skupfer fi 1986fb23a357Skupfer done 19877c478bd9Sstevel@tonic-gate 19887c478bd9Sstevel@tonic-gate $PROTOCMPTERSE \ 19897c478bd9Sstevel@tonic-gate "Files missing from the proto area:" \ 19907c478bd9Sstevel@tonic-gate "Files missing from packages:" \ 19917c478bd9Sstevel@tonic-gate "Inconsistencies between pkgdefs and proto area:" \ 19927c478bd9Sstevel@tonic-gate ${ELIST} \ 19937c478bd9Sstevel@tonic-gate ${PKGDEFS_LIST} \ 19947c478bd9Sstevel@tonic-gate $ATLOG/proto_list_${MACH} \ 19957c478bd9Sstevel@tonic-gate >> $mail_msg_file 19967c478bd9Sstevel@tonic-gate fi 19977c478bd9Sstevel@tonic-gatefi 19987c478bd9Sstevel@tonic-gate 19997c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then 20007c478bd9Sstevel@tonic-gate staffer cp $ATLOG/proto_list_${MACH} \ 20017c478bd9Sstevel@tonic-gate $PARENT_WS/usr/src/proto_list_${MACH} 20027c478bd9Sstevel@tonic-gatefi 20037c478bd9Sstevel@tonic-gate 20047c478bd9Sstevel@tonic-gate# Update parent proto area if necessary. This is done now 20057c478bd9Sstevel@tonic-gate# so that the proto area has either DEBUG or non-DEBUG kernels. 20067c478bd9Sstevel@tonic-gate# Note that this clears out the lock file, so we can dispense with 20077c478bd9Sstevel@tonic-gate# the variable now. 20087c478bd9Sstevel@tonic-gateif [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then 20097c478bd9Sstevel@tonic-gate echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \ 20107c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 20117c478bd9Sstevel@tonic-gate # The rm -rf command below produces predictable errors if 20127c478bd9Sstevel@tonic-gate # nightly is invoked from the parent's $ROOT/opt/onbld/bin, 20137c478bd9Sstevel@tonic-gate # and that directory is accessed via NFS. This is because 20147c478bd9Sstevel@tonic-gate # deleted-but-still-open files don't actually disappear as 20157c478bd9Sstevel@tonic-gate # expected, but rather turn into .nfsXXXX junk files, leaving 20167c478bd9Sstevel@tonic-gate # the directory non-empty. Since this is a not-unusual usage 20177c478bd9Sstevel@tonic-gate # pattern, and we still want to catch other errors here, we 20187c478bd9Sstevel@tonic-gate # take the unusal step of moving aside 'nightly' from that 20197c478bd9Sstevel@tonic-gate # directory (if we're using it). 20207c478bd9Sstevel@tonic-gate mypath=${0##*/root_$MACH/} 20217c478bd9Sstevel@tonic-gate if [ "$mypath" = $0 ]; then 20227c478bd9Sstevel@tonic-gate mypath=opt/onbld/bin/${0##*/} 20237c478bd9Sstevel@tonic-gate fi 20247c478bd9Sstevel@tonic-gate if [ $0 -ef $PARENT_WS/proto/root_$MACH/$mypath ]; then 20257c478bd9Sstevel@tonic-gate mv -f $0 $PARENT_WS/proto/root_$MACH 20267c478bd9Sstevel@tonic-gate fi 20277c478bd9Sstevel@tonic-gate rm -rf $PARENT_WS/proto/root_$MACH/* 20287c478bd9Sstevel@tonic-gate unset Ulockfile 20297c478bd9Sstevel@tonic-gate mkdir -p $NIGHTLY_PARENT_ROOT 20307c478bd9Sstevel@tonic-gate cd $ROOT 20317c478bd9Sstevel@tonic-gate ( tar cf - . | ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf - ) ) 2>&1 | 20327c478bd9Sstevel@tonic-gate tee -a $mail_msg_file >> $LOGFILE 20337c478bd9Sstevel@tonic-gatefi 20347c478bd9Sstevel@tonic-gate 20357c478bd9Sstevel@tonic-gate# 20367c478bd9Sstevel@tonic-gate# do shared library interface verification 20377c478bd9Sstevel@tonic-gate# 20387c478bd9Sstevel@tonic-gate 20397c478bd9Sstevel@tonic-gateif [ "$A_FLAG" = "y" -a "$build_ok" = "y" ]; then 20407c478bd9Sstevel@tonic-gate echo "\n==== Check versioning and ABI information ====\n" | \ 20417c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 20427c478bd9Sstevel@tonic-gate 20437c478bd9Sstevel@tonic-gate rm -rf $SRC/interfaces.ref 20447c478bd9Sstevel@tonic-gate if [ -d $SRC/interfaces.out ]; then 20457c478bd9Sstevel@tonic-gate mv $SRC/interfaces.out $SRC/interfaces.ref 20467c478bd9Sstevel@tonic-gate fi 20477c478bd9Sstevel@tonic-gate rm -rf $SRC/interfaces.out 20487c478bd9Sstevel@tonic-gate mkdir -p $SRC/interfaces.out 20497c478bd9Sstevel@tonic-gate 20507c478bd9Sstevel@tonic-gate intf_check -V -m -o -b $SRC/tools/abi/etc \ 20517c478bd9Sstevel@tonic-gate -d $SRC/interfaces.out $ROOT 2>&1 | sort \ 20527c478bd9Sstevel@tonic-gate > $SRC/interfaces.out/log 20537c478bd9Sstevel@tonic-gate 20547c478bd9Sstevel@tonic-gate # report any ERROR found in log file 20557c478bd9Sstevel@tonic-gate fgrep 'ERROR' $SRC/interfaces.out/log | sed 's/^ERROR: //' | \ 20567c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 20577c478bd9Sstevel@tonic-gate 20587c478bd9Sstevel@tonic-gate if [ ! -d $SRC/interfaces.ref ] ; then 20597c478bd9Sstevel@tonic-gate mkdir -p $SRC/interfaces.ref 20607c478bd9Sstevel@tonic-gate if [ -d $SRC/interfaces.out ]; then 20617c478bd9Sstevel@tonic-gate cp -r $SRC/interfaces.out/* $SRC/interfaces.ref 20627c478bd9Sstevel@tonic-gate fi 20637c478bd9Sstevel@tonic-gate fi 20647c478bd9Sstevel@tonic-gate 20657c478bd9Sstevel@tonic-gate echo "\n==== Diff versioning warnings (since last build) ====\n" | \ 20667c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 20677c478bd9Sstevel@tonic-gate 20687c478bd9Sstevel@tonic-gate out_vers=`grep ^VERSION $SRC/interfaces.out/log`; 20697c478bd9Sstevel@tonic-gate ref_vers=`grep ^VERSION $SRC/interfaces.ref/log`; 20707c478bd9Sstevel@tonic-gate 20717c478bd9Sstevel@tonic-gate # Report any differences in WARNING messages between last 20727c478bd9Sstevel@tonic-gate # and current build. 20737c478bd9Sstevel@tonic-gate if [ "$out_vers" = "$ref_vers" ]; then 20747c478bd9Sstevel@tonic-gate diff $SRC/interfaces.ref/log $SRC/interfaces.out/log | \ 20757c478bd9Sstevel@tonic-gate fgrep 'WARNING' | sed 's/WARNING: //' | \ 20767c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 20777c478bd9Sstevel@tonic-gate fi 20787c478bd9Sstevel@tonic-gatefi 20797c478bd9Sstevel@tonic-gate 20807c478bd9Sstevel@tonic-gateif [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then 20817c478bd9Sstevel@tonic-gate echo "\n==== Check ELF runtime attributes ====\n" | \ 20827c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 20837c478bd9Sstevel@tonic-gate 20847c478bd9Sstevel@tonic-gate LDDUSAGE="^ldd: does not support -e" 20857c478bd9Sstevel@tonic-gate LDDWRONG="wrong class" 20867c478bd9Sstevel@tonic-gate CRLERROR="^crle:" 20877c478bd9Sstevel@tonic-gate CRLECONF="^crle: configuration file:" 20887c478bd9Sstevel@tonic-gate 20897c478bd9Sstevel@tonic-gate rm -f $SRC/runtime.ref 20907c478bd9Sstevel@tonic-gate if [ -f $SRC/runtime.out ]; then 20917c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 20927c478bd9Sstevel@tonic-gate $SRC/runtime.out > $SRC/runtime.ref 20937c478bd9Sstevel@tonic-gate fi 20947c478bd9Sstevel@tonic-gate 20957c478bd9Sstevel@tonic-gate # If we're doing a debug build the proto area will be left with 20967c478bd9Sstevel@tonic-gate # debuggable objects, thus don't assert -s. 20977c478bd9Sstevel@tonic-gate if [ "$D_FLAG" = "y" ]; then 20987c478bd9Sstevel@tonic-gate rtime_sflag="" 20997c478bd9Sstevel@tonic-gate else 21007c478bd9Sstevel@tonic-gate rtime_sflag="-s" 21017c478bd9Sstevel@tonic-gate fi 21027c478bd9Sstevel@tonic-gate check_rtime -d $ROOT -i -m -o $rtime_sflag $ROOT 2>&1 | \ 21037c478bd9Sstevel@tonic-gate egrep -v ": unreferenced object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \ 21047c478bd9Sstevel@tonic-gate egrep -v ": unused object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \ 21057c478bd9Sstevel@tonic-gate sort >$SRC/runtime.out 21067c478bd9Sstevel@tonic-gate 21077c478bd9Sstevel@tonic-gate # Determine any processing errors that will affect the final output 21087c478bd9Sstevel@tonic-gate # and display these first. 21097c478bd9Sstevel@tonic-gate grep -l "$LDDUSAGE" $SRC/runtime.out > /dev/null 21107c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 21117c478bd9Sstevel@tonic-gate echo "WARNING: ldd(1) does not support -e. The version of ldd(1)" | \ 21127c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21137c478bd9Sstevel@tonic-gate echo "on your system is old - 4390308 (s81_30) is required.\n" | \ 21147c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21157c478bd9Sstevel@tonic-gate fi 21167c478bd9Sstevel@tonic-gate grep -l "$LDDWRONG" $SRC/runtime.out > /dev/null 21177c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 21187c478bd9Sstevel@tonic-gate echo "WARNING: wrong class message detected. ldd(1) was unable" | \ 21197c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21207c478bd9Sstevel@tonic-gate echo "to execute an object, thus it could not be checked fully." | \ 21217c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21227c478bd9Sstevel@tonic-gate echo "Perhaps a 64-bit object was encountered on a 32-bit system," | \ 21237c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21247c478bd9Sstevel@tonic-gate echo "or an i386 object was encountered on a sparc system?\n" | \ 21257c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21267c478bd9Sstevel@tonic-gate fi 21277c478bd9Sstevel@tonic-gate grep -l "$CRLECONF" $SRC/runtime.out > /dev/null 21287c478bd9Sstevel@tonic-gate if [ $? -eq 0 ]; then 21297c478bd9Sstevel@tonic-gate echo "WARNING: creation of an alternative dependency cache failed." | \ 21307c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21317c478bd9Sstevel@tonic-gate echo "Dependencies will bind to the base system libraries.\n" | \ 21327c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21337c478bd9Sstevel@tonic-gate grep "$CRLECONF" $SRC/runtime.out | \ 21347c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21357c478bd9Sstevel@tonic-gate grep "$CRLERROR" $SRC/runtime.out | grep -v "$CRLECONF" | \ 21367c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21377c478bd9Sstevel@tonic-gate echo "\n" | tee -a $LOGFILE >> $mail_msg_file 21387c478bd9Sstevel@tonic-gate fi 21397c478bd9Sstevel@tonic-gate 21407c478bd9Sstevel@tonic-gate egrep '<dependency no longer necessary>' $SRC/runtime.out | \ 21417c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 21427c478bd9Sstevel@tonic-gate 21437c478bd9Sstevel@tonic-gate # NEEDED= and RPATH= are informational; report anything else that we 21447c478bd9Sstevel@tonic-gate # haven't already. 21457c478bd9Sstevel@tonic-gate egrep -v "NEEDED=|RPATH=|$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 21467c478bd9Sstevel@tonic-gate $SRC/runtime.out | tee -a $LOGFILE >> $mail_msg_file 21477c478bd9Sstevel@tonic-gate 21487c478bd9Sstevel@tonic-gate # probably should compare against a 'known ok runpaths' list 21497c478bd9Sstevel@tonic-gate if [ ! -f $SRC/runtime.ref ]; then 21507c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \ 21517c478bd9Sstevel@tonic-gate $SRC/runtime.out > $SRC/runtime.ref 21527c478bd9Sstevel@tonic-gate fi 21537c478bd9Sstevel@tonic-gate 21547c478bd9Sstevel@tonic-gate echo "\n==== Diff ELF runtime attributes (since last build) ====\n" \ 21557c478bd9Sstevel@tonic-gate >> $mail_msg_file 21567c478bd9Sstevel@tonic-gate 21577c478bd9Sstevel@tonic-gate egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" $SRC/runtime.out | \ 21587c478bd9Sstevel@tonic-gate diff $SRC/runtime.ref - >> $mail_msg_file 21597c478bd9Sstevel@tonic-gatefi 21607c478bd9Sstevel@tonic-gate 21617c478bd9Sstevel@tonic-gate# For now, don't make archives or packages for GPROF/TRACE builds 21627c478bd9Sstevel@tonic-gatea_FLAG=n 21637c478bd9Sstevel@tonic-gatep_FLAG=n 21647c478bd9Sstevel@tonic-gate 21657c478bd9Sstevel@tonic-gate# GPROF build begins 21667c478bd9Sstevel@tonic-gate 21677c478bd9Sstevel@tonic-gateif [ "$i_CMD_LINE_FLAG" = "n" -a "$P_FLAG" = "y" ]; then 21687c478bd9Sstevel@tonic-gate 21697c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 21707c478bd9Sstevel@tonic-gate export RELEASE_BUILD ; RELEASE_BUILD= 21717c478bd9Sstevel@tonic-gate export EXTRA_OPTIONS ; EXTRA_OPTIONS="-DGPROF" 21727c478bd9Sstevel@tonic-gate export EXTRA_CFLAGS ; EXTRA_CFLAGS="-xpg" 21737c478bd9Sstevel@tonic-gate 21747c478bd9Sstevel@tonic-gate build GPROF -prof 21757c478bd9Sstevel@tonic-gate 21767c478bd9Sstevel@tonic-gateelse 21777c478bd9Sstevel@tonic-gate echo "\n==== No GPROF build ====\n" >> $LOGFILE 21787c478bd9Sstevel@tonic-gatefi 21797c478bd9Sstevel@tonic-gate 21807c478bd9Sstevel@tonic-gate# GPROF build ends 21817c478bd9Sstevel@tonic-gate 21827c478bd9Sstevel@tonic-gate# TRACE build begins 21837c478bd9Sstevel@tonic-gate 21847c478bd9Sstevel@tonic-gateif [ "$i_CMD_LINE_FLAG" = "n" -a "$T_FLAG" = "y" ]; then 21857c478bd9Sstevel@tonic-gate 21867c478bd9Sstevel@tonic-gate export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD= 21877c478bd9Sstevel@tonic-gate export RELEASE_BUILD ; RELEASE_BUILD= 21887c478bd9Sstevel@tonic-gate export EXTRA_OPTIONS ; EXTRA_OPTIONS="-DTRACE" 21897c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 21907c478bd9Sstevel@tonic-gate 21917c478bd9Sstevel@tonic-gate build TRACE -trace 21927c478bd9Sstevel@tonic-gate 21937c478bd9Sstevel@tonic-gateelse 21947c478bd9Sstevel@tonic-gate echo "\n==== No TRACE build ====\n" >> $LOGFILE 21957c478bd9Sstevel@tonic-gatefi 21967c478bd9Sstevel@tonic-gate 21977c478bd9Sstevel@tonic-gate# TRACE build ends 21987c478bd9Sstevel@tonic-gate 21997c478bd9Sstevel@tonic-gate# DEBUG lint of kernel begins 22007c478bd9Sstevel@tonic-gate 22017c478bd9Sstevel@tonic-gateif [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then 22027c478bd9Sstevel@tonic-gate if [ "$LINTDIRS" = "" ]; then 22037c478bd9Sstevel@tonic-gate # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y" 22047c478bd9Sstevel@tonic-gate LINTDIRS="$SRC y" 22057c478bd9Sstevel@tonic-gate fi 22067c478bd9Sstevel@tonic-gate set $LINTDIRS 22077c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 22087c478bd9Sstevel@tonic-gate dolint $1 $2; shift; shift 22097c478bd9Sstevel@tonic-gate done 22107c478bd9Sstevel@tonic-gateelse 22117c478bd9Sstevel@tonic-gate echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE 22127c478bd9Sstevel@tonic-gatefi 22137c478bd9Sstevel@tonic-gate 22147c478bd9Sstevel@tonic-gate# "make check" begins 22157c478bd9Sstevel@tonic-gate 22167c478bd9Sstevel@tonic-gateif [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then 22177c478bd9Sstevel@tonic-gate # remove old check.out 22187c478bd9Sstevel@tonic-gate rm -f $SRC/check.out 22197c478bd9Sstevel@tonic-gate 22207c478bd9Sstevel@tonic-gate rm -f $SRC/check-${MACH}.out 22217c478bd9Sstevel@tonic-gate cd $SRC 22227c478bd9Sstevel@tonic-gate $MAKE -ek check 2>&1 | tee -a $SRC/check-${MACH}.out >> $LOGFILE 22237c478bd9Sstevel@tonic-gate echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file 22247c478bd9Sstevel@tonic-gate 22257c478bd9Sstevel@tonic-gate grep ":" $SRC/check-${MACH}.out | 22267c478bd9Sstevel@tonic-gate egrep -v "Ignoring unknown host" | \ 22277c478bd9Sstevel@tonic-gate sort | uniq >> $mail_msg_file 22287c478bd9Sstevel@tonic-gateelse 22297c478bd9Sstevel@tonic-gate echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE 22307c478bd9Sstevel@tonic-gatefi 22317c478bd9Sstevel@tonic-gate 22327c478bd9Sstevel@tonic-gateecho "\n==== Find core files ====\n" | \ 22337c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 22347c478bd9Sstevel@tonic-gate 2235fb23a357Skupferfind $abssrcdirs -name core -a -type f -exec file {} \; | \ 22367c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $mail_msg_file 22377c478bd9Sstevel@tonic-gate 22387c478bd9Sstevel@tonic-gateif [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 22397c478bd9Sstevel@tonic-gate echo "\n==== Diff unreferenced files (since last build) ====\n" \ 22407c478bd9Sstevel@tonic-gate | tee -a $LOGFILE >>$mail_msg_file 22417c478bd9Sstevel@tonic-gate rm -f $SRC/unref-${MACH}.ref 22427c478bd9Sstevel@tonic-gate if [ -f $SRC/unref-${MACH}.out ]; then 22437c478bd9Sstevel@tonic-gate mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 22447c478bd9Sstevel@tonic-gate fi 22457c478bd9Sstevel@tonic-gate 2246fb23a357Skupfer findunref -t $SRC/.build.tstamp $SRC/.. \ 2247fb23a357Skupfer ${TOOLS}/findunref/exception_list \ 2248fb23a357Skupfer 2>> $mail_msg_file | sort | \ 2249fb23a357Skupfer sed -e s=^./src/=./= -e s=^./closed/=../closed/= \ 2250fb23a357Skupfer > $SRC/unref-${MACH}.out 22517c478bd9Sstevel@tonic-gate 22527c478bd9Sstevel@tonic-gate if [ ! -f $SRC/unref-${MACH}.ref ]; then 22537c478bd9Sstevel@tonic-gate cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref 22547c478bd9Sstevel@tonic-gate fi 22557c478bd9Sstevel@tonic-gate 22567c478bd9Sstevel@tonic-gate diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file 22577c478bd9Sstevel@tonic-gatefi 22587c478bd9Sstevel@tonic-gate 22597c478bd9Sstevel@tonic-gate# Verify that the usual lists of files, such as exception lists, 22607c478bd9Sstevel@tonic-gate# contain only valid references to files. If the build has failed, 22617c478bd9Sstevel@tonic-gate# then don't check the proto area. 22627c478bd9Sstevel@tonic-gateCHECK_PATHS=${CHECK_PATHS:-y} 22637c478bd9Sstevel@tonic-gateif [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then 22647c478bd9Sstevel@tonic-gate echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \ 22657c478bd9Sstevel@tonic-gate >>$mail_msg_file 22667c478bd9Sstevel@tonic-gate arg=-b 22677c478bd9Sstevel@tonic-gate [ "$build_ok" = y ] && arg= 22687c478bd9Sstevel@tonic-gate checkpaths $arg $ROOT 2>&1 | tee -a $LOGFILE >>$mail_msg_file 22697c478bd9Sstevel@tonic-gatefi 22707c478bd9Sstevel@tonic-gate 22717c478bd9Sstevel@tonic-gateif [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then 22727c478bd9Sstevel@tonic-gate echo "\n==== Impact on file permissions ====\n" \ 22737c478bd9Sstevel@tonic-gate >> $mail_msg_file 22747c478bd9Sstevel@tonic-gate # 22757c478bd9Sstevel@tonic-gate # Get pkginfo files from usr/src/pkgdefs 22767c478bd9Sstevel@tonic-gate # 22777c478bd9Sstevel@tonic-gate pmodes -qvdP \ 2278fb9f9b97Skupfer `for d in $abssrcdirs; do 2279fb9f9b97Skupfer if [ -d "$d/pkgdefs" ] 22807c478bd9Sstevel@tonic-gate then 2281fb9f9b97Skupfer find $d/pkgdefs -name pkginfo.tmpl -print -o -name .del\* -prune 22827c478bd9Sstevel@tonic-gate fi 22837c478bd9Sstevel@tonic-gate done | sed -e 's:/pkginfo.tmpl$::' | sort -u ` >> $mail_msg_file 22847c478bd9Sstevel@tonic-gatefi 22857c478bd9Sstevel@tonic-gate 22867c478bd9Sstevel@tonic-gateEND_DATE=`date` 22877c478bd9Sstevel@tonic-gateecho "==== Nightly $maketype build completed: $END_DATE ====" | \ 22887c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 22897c478bd9Sstevel@tonic-gate 22907c478bd9Sstevel@tonic-gatetypeset -Z2 minutes 22917c478bd9Sstevel@tonic-gatetypeset -Z2 seconds 22927c478bd9Sstevel@tonic-gate 22937c478bd9Sstevel@tonic-gateelapsed_time=$SECONDS 22947c478bd9Sstevel@tonic-gate((hours = elapsed_time / 3600 )) 22957c478bd9Sstevel@tonic-gate((minutes = elapsed_time / 60 % 60)) 22967c478bd9Sstevel@tonic-gate((seconds = elapsed_time % 60)) 22977c478bd9Sstevel@tonic-gate 22987c478bd9Sstevel@tonic-gateecho "\n==== Total build time ====" | \ 22997c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 23007c478bd9Sstevel@tonic-gateecho "\nreal ${hours}:${minutes}:${seconds}" | \ 23017c478bd9Sstevel@tonic-gate tee -a $LOGFILE >> $build_time_file 23027c478bd9Sstevel@tonic-gate 23037c478bd9Sstevel@tonic-gateif [ "$u_FLAG" = "y" -a "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then 23047c478bd9Sstevel@tonic-gate staffer cp ${SRC}/unref-${MACH}.out $PARENT_WS/usr/src/ 23057c478bd9Sstevel@tonic-gate 23067c478bd9Sstevel@tonic-gate # 23077c478bd9Sstevel@tonic-gate # Produce a master list of unreferenced files -- ideally, we'd 23087c478bd9Sstevel@tonic-gate # generate the master just once after all of the nightlies 23097c478bd9Sstevel@tonic-gate # have finished, but there's no simple way to know when that 23107c478bd9Sstevel@tonic-gate # will be. Instead, we assume that we're the last nightly to 23117c478bd9Sstevel@tonic-gate # finish and merge all of the unref-${MACH}.out files in 23127c478bd9Sstevel@tonic-gate # $PARENT_WS/usr/src/. If we are in fact the final ${MACH} to 23137c478bd9Sstevel@tonic-gate # finish, then this file will be the authoritative master 23147c478bd9Sstevel@tonic-gate # list. Otherwise, another ${MACH}'s nightly will eventually 23157c478bd9Sstevel@tonic-gate # overwrite ours with its own master, but in the meantime our 23167c478bd9Sstevel@tonic-gate # temporary "master" will be no worse than any older master 23177c478bd9Sstevel@tonic-gate # which was already on the parent. 23187c478bd9Sstevel@tonic-gate # 23197c478bd9Sstevel@tonic-gate 23207c478bd9Sstevel@tonic-gate set -- $PARENT_WS/usr/src/unref-*.out 23217c478bd9Sstevel@tonic-gate cp "$1" ${TMPDIR}/unref.merge 23227c478bd9Sstevel@tonic-gate shift 23237c478bd9Sstevel@tonic-gate 23247c478bd9Sstevel@tonic-gate for unreffile; do 23257c478bd9Sstevel@tonic-gate comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$ 23267c478bd9Sstevel@tonic-gate mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge 23277c478bd9Sstevel@tonic-gate done 23287c478bd9Sstevel@tonic-gate 23297c478bd9Sstevel@tonic-gate staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out 23307c478bd9Sstevel@tonic-gatefi 23317c478bd9Sstevel@tonic-gate 23327c478bd9Sstevel@tonic-gate# 23337c478bd9Sstevel@tonic-gate# All done save for the sweeping up. 23347c478bd9Sstevel@tonic-gate# (whichever exit we hit here will trigger the "cleanup" trap which 23357c478bd9Sstevel@tonic-gate# optionally sends mail on completion). 23367c478bd9Sstevel@tonic-gate# 23377c478bd9Sstevel@tonic-gateif [ "$build_ok" = "y" ]; then 23387c478bd9Sstevel@tonic-gate exit 0 23397c478bd9Sstevel@tonic-gatefi 23407c478bd9Sstevel@tonic-gateexit 1 2341