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