nightly.sh revision a5c06a9ed1833574df8f8a348316df41d3f7cad4
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# CDDL HEADER START
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# The contents of this file are subject to the terms of the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Common Development and Distribution License, Version 1.0 only
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# (the "License"). You may not use this file except in compliance
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# with the License.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# See the License for the specific language governing permissions
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# and limitations under the License.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# When distributing Covered Code, include this CDDL HEADER in each
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# If applicable, add the following below this CDDL HEADER, with the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# fields enclosed by brackets "[]" replaced with your own identifying
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# information: Portions Copyright [yyyy] [name of copyright owner]
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# CDDL HEADER END
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Use is subject to license terms.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# ident "%Z%%M% %I% %E% SMI"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Based on the nightly script from the integration folks,
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Mostly modified and owned by mike_s.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Changes also by kjc, dmk.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# BRINGOVER_WS may be specified in the env file.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# The default is the old behavior of CLONE_WS
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# -i on the command line, means fast options, so when it's on the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# command line (only), lint, check, GPROF and TRACE builds are skipped
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# no matter what the setting of their individual flags are in NIGHTLY_OPTIONS.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# LINTDIRS can be set in the env file, format is a list of:
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# /dirname-to-run-lint-on flag
34f1a571c0d0c682a4a70b97b1e62430aa630559Michael Bergknoff# Where flag is: y - enable lint noise diff output
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# n - disable lint noise diff output
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# For example: LINTDIRS="$SRC/uts n $SRC/stand y $SRC/psm y"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# -A flag in NIGHTLY_OPTIONS checks ABI diffs in .so files
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# This option requires a couple of scripts.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# OPTHOME and TEAMWARE may be set in the environment to override /opt
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# and /opt/teamware defaults.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# under certain circumstances, which can really screw things up; unset it.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# function to do a DEBUG and non-DEBUG build. Needed because we might
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# need to do another for the source build, and since we only deliver DEBUG or
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# non-DEBUG packages.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # timestamp the start of a nightly build; the findunref tool uses it.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD=
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a "$p_FLAG" = "y" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD=
d2b9c6763c7b3aad7a4c2609ca71e0b02114bca9fw if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a "$p_FLAG" = "y" ]; then
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer if [ $# -ne 2 ]; then
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer if [ ! -f ${OBJFILES} ]; then
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer for i in `grep -v '^#' ${ORIG_SRC}/xmod/obj_files | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# function to save off binaries after a full build for later
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# restoration
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Saving binaries from build at `date` ====\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# delete files
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ $# -ne 2 ]; then
c8268b2c32246a4fd927df00921c772baab114e0Kelly Moyer echo "removing ${i}." | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "hybridizing ${i}." | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki sed -e "/^# HYBRID DELETE START/,/^# HYBRID DELETE END/d" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki < ${i} > ${i}+
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki mv ${i}+ ${i}
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# restore binaries into the proper source tree.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ $# -ne 2 ]; then
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw echo "\n==== Restoring binaries to ${MAKETARG} at `date` ====\n" | \
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw cpio -idmucvB 2>/dev/null | tee -a $mail_msg_file >> ${LOGFILE}
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw# rename files we save binaries of
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw if [ $# -ne 2 ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Renaming source files in ${MAKETARG} at `date` ====\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo ${i} | tee -a $mail_msg_file >> ${LOGFILE}
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki rm -f ${i}.export
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki mv ${i} ${i}.export
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# function to create the export/crypt source tree
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# usage: clone_source CODEMGR_WS DESTDIR MAKE_TARGET
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ $# -ne 3 ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "usage: clone_source CODEMGR_WS DESTDIR MAKE_TARGET"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Creating ${DEST} source from ${WS} (${MAKETARG}) ====\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== ${MAKETARG} build errors ====\n" >> $mail_msg_file
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== xmod/cry_files that don't exist ====\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# function to do the build.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# usage: build LABEL SUFFIX
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ $# -ne 2 ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki SPARC_RM_PKGARCHIVE=${SPARC_RM_PKGARCHIVE_ORIG}${SUFFIX}
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -f $SRC/${OLDNOISE}.out ]; then
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer | egrep -v 'option -zdefs/nodefs appears more than' \
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer | egrep -v "symbol \`timezone' has differing types:" \
34f1a571c0d0c682a4a70b97b1e62430aa630559Michael Bergknoff echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \
d2b9c6763c7b3aad7a4c2609ca71e0b02114bca9fw echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file
d2b9c6763c7b3aad7a4c2609ca71e0b02114bca9fw if [ -f $SRC/${NOISE}.out ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki | egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \
34f1a571c0d0c682a4a70b97b1e62430aa630559Michael Bergknoff | egrep -v 'option -I appears more than once' \
34f1a571c0d0c682a4a70b97b1e62430aa630559Michael Bergknoff | egrep -v '^lint library construction:' \
34f1a571c0d0c682a4a70b97b1e62430aa630559Michael Bergknoff | egrep -v 'option -zdefs/nodefs appears more than' \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki | egrep -v "symbol \`timezone' has differing types:" \
34f1a571c0d0c682a4a70b97b1e62430aa630559Michael Bergknoff | egrep -v '^File:SolarisAuthApplet.bin' \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ ! -f $SRC/${NOISE}.ref ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Build noise differences ($LABEL) ====\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki diff $SRC/${NOISE}.ref $SRC/${NOISE}.out >>$mail_msg_file
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Create cpio archives for preintegration testing (PIT)
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw echo "\n==== Creating $LABEL cpio archives at `date` ====\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== cpio archives build errors ($LABEL) ====\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Not creating $LABEL cpio archives ====\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Creating $LABEL packages at `date` ====\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ "$MACH" = "i386" ] && [ "${SPARC_RM_PKGARCHIVE}" ]; then
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer egrep "${MAKE}|ERROR|WARNING" $SRC/pkgdefs/${INSTALLOG}.out | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Arg. 2 is a flag to turn on/off the lint diff output
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ $# -ne 2 ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD=
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -f $lintdir/lint-noise.ref ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Remove all .ln files to ensure a full reference file
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki `find . -name SCCS -prune -o -type f -name '*.ln' -print `
a1c5472562e714fe175eb2fbfcde0ccba7385a6cfw echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \
a1c5472562e714fe175eb2fbfcde0ccba7385a6cfw if [ -f ${LINTNOISE}.out ]; then
a1c5472562e714fe175eb2fbfcde0ccba7385a6cfw #egrep -v '^(name|function|value|argument|real|user|sys)' |
a1c5472562e714fe175eb2fbfcde0ccba7385a6cfw if [ ! -f ${LINTNOISE}.ref ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # should be none, though there are a few that were filtered out
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Install proto area from IHV build
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki tar -cf - . | (cd $ROOT; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Install IHV packages in PKGARCHIVE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ $# -ne 2 ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Installing IHV packages from $IA32_IHV_PKGS ($LABEL) ====\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Installing IHV packages from $IA32_IHV_BINARY_PKGS ($LABEL) ====\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
5413ab1b25eb8f7cbf9070adc2e222772aa054daMichael Bergknoff echo "$IA32_IHV_BINARY_PKGS: not found" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ $# -ne 1 ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Tools build errors ====\n" >> $mail_msg_file
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki CTFCONVERT=${DESTROOT}/opt/onbld/bin/${MACH}/ctfconvert
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== New environment settings. ====\n" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ $ISUSER -ne 0 ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki eval su $STAFFER -c \'$arg\'
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiUSAGE='Usage: nightly [-in] [-V VERS ] [ -S E|D|H ] <env_file>
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -i Fast incremental options (no clobber, lint, check, gprof, trace)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -n Do not do a bringover
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -V VERS set the build version string to VERS
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -S Build a variant of the source product
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki E - build exportable source
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki D - build domestic source (exportable + crypt)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki H - build hybrid source (binaries + deleted source)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki <env_file> file in Bourne shell syntax that sets and exports
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki variables that configure the operation of this script and many of
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki the scripts this one calls. If <env_file> does not exist,
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki it will be looked for in $OPTHOME/onbld/env.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkinon-DEBUG is the default build type. Build options can be set in the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiNIGHTLY_OPTIONS variable in the <env_file> as follows:
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -A check for ABI differences in .so files
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -C check for cstyle/hdrchk errors
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -D do a build with DEBUG on
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -F do _not_ do a non-DEBUG build
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -G gate keeper default group of options (-au)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -I integration engineer default group of options (-ampu)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -M do not run pmodes (safe file permission checker)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -N do not run protocmp
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -P do a build with GPROF on
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -R default group of options for building a release (-mp)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -T do a build with TRACE on
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -U update proto area in the parent
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -V VERS set the build version string to VERS
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -X copy x86 IHV packages
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -a create cpio archives
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -d use Distributed Make (default uses Parallel Make)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -f find unreferenced files
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -i do an incremental build (no "make clobber")
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -l do "make lint" in $LINTDIRS (default: $SRC y)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -m send mail to $MAILTO at end of build
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -n do not do a bringover
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -o build using root privileges to set OWNER/GROUP (old style)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -p create packages
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -r check ELF runtime attributes in the proto area
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -t build and use the tools in $SRC/tools
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -u update proto_list_$MACH and friends in the parent workspace;
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki when used with -f, also build an unrefmaster.out in the parent
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -z compress cpio archives with gzip
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -W Do not report warnings (freeware gate ONLY)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki -S Build a variant of the source product
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki E - build exportable source
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki D - build domestic source (exportable + crypt)
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw H - build hybrid source (binaries + deleted source)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# -x less public handling of xmod source for the source product
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# A log file will be generated under the name $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# for partially completed build and log.`date '+%m%d%y'`
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# in the same directory for fully completed builds.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# default values for low-level FLAGS; G I R are group FLAGS
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw# examine arguments
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "Can only build one source variant at a time."
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki \? ) echo "$USAGE"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# correct argument count after options
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# test that the path to the environment-setting file was given
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# check if user is running nightly as root
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# ISUSER is set non-zero if an ordinary user runs nightly, or is zero
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# when root invokes nightly.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# force locale to C
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# clear environment variables we know to be bad for the build
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiunset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiunset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Setup environmental variables
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiif [ -f $1 ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [[ $1 = */* ]]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "Cannot find env file as either $1 or $OPTHOME/onbld/env/$1"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# place ourselves in a new task, respecting BUILD_PROJECT if set.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiif [ -z "$BUILD_PROJECT" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# See if NIGHTLY_OPTIONS is set
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# If BRINGOVER_WS was not specified, let it default to CLONE_WS
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# If BRINGOVER_FILES was not specified, default to usr/src
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Note: changes to the option letters here should also be applied to the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# bldenv script.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiwhile getopts ABDFNMPTCGIRafinlmoptuUxdrtzWS:X FLAG $NIGHTLY_OPTIONS
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ;; # old version of D
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -z "${PARENT_ROOT}" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "PARENT_ROOT must be set if the U flag is" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "present in NIGHTLY_OPTIONS."
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "Can only build one source variant at a time."
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki X ) # now that we no longer need realmode builds, just
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # copy IHV packages. only meaningful on x86.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki \? ) echo "$USAGE"
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw echo "Old-style build requires root permission."
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw # Set default value for STAFFER, if needed.
af71cc4ed6be914d26e9de3a90a2bb56e4bbe78dMichael Bergknoffif [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then
af71cc4ed6be914d26e9de3a90a2bb56e4bbe78dMichael BergknoffPATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin"
af71cc4ed6be914d26e9de3a90a2bb56e4bbe78dMichael BergknoffPATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb"
af71cc4ed6be914d26e9de3a90a2bb56e4bbe78dMichael BergknoffPATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# root invoked old-style build -- make sure it works as it always has
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# by exporting 'CH'. The current Makefile.master doesn't use this, but
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# the old ones still do.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# we export POUND_SIGN to speed up the build process -- prevents evaluation of
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# the Makefile.master definitions.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# we export DEF_STRIPFLAG to strip debug data from nightly builds; the default
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# behavior is to include all debug data.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # get the dmake version string alone
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # focus in on just the dotted version number alone
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # extract the second (or final) integer
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # extract the first integer
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # x86 was built on the 12th, sparc on the 13th.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \( \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \) ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -z "$DMAKE_VERSION" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "$MAKE is missing."
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo " ${DMAKE_VERSION}"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiThis version may not be safe for use. Either set TEAMWARE to a better
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkipath or (if you really want to use this version of dmake anyway), add
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkithe following to your environment to disable this check:
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki CHECK_DMAKE=n
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki DMAKE_MAX_JOBS="`grep $hostname $HOME/.make.machines | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiif [ -z "${ROOT}" ]; then
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw echo "ROOT must be set."
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw if [ -z "${EXPORT_SRC}" ]; then
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw echo "EXPORT_SRC must be set for a source build."
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -z "${CRYPT_SRC}" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "CRYPT_SRC must be set for a source build."
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -z "${EXPORT_SRC}" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "EXPORT_SRC must be set for a source build."
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# if -V flag was given, reset VERSION to V_ARG
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Append source version
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Keep elfsign's use of pkcs11_softtoken from looking in the user home
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# directory, which doesn't always work. Needed until all build machines
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw# have the fix for 6271754
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# create directories that are automatically removed if the nightly script
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw# fails to start correctly
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw while [ ! -d $dir ]; do
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# since this script assumes the build is from full source, it nullifies
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# variables likely to have been set by a "ws" script; nullification
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# confines the search space for headers and libraries to the proto area
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# built from this immediate source.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiexport ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Juggle the logs and optionally send mail on completion.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -f $LLOG -o -d $LLOG ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Now that we're about to send mail, it's time to check the noise
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # file. In the event that an error occurs beyond this point, it will
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # be recorded in the nightly.log file, but nowhere else. This would
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # include only errors that cause the copying of the noise log to fail
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -s $build_noise_file ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH}
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Remove the locks and temporary files on any exit
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw while [ $# -gt 0 ]; do
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki shift; shift
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Generic lock file processing -- make sure that the lock file doesn't
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# exist. If it does, it should name the build host and PID. If it
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# doesn't, then make sure we can create it. Clean up locks that are
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# known to be stale (assumes host name is unique among build systems
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# for the workspace).
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -f $lockf ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki elif kill -s 0 $pid 2>/dev/null; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -f $lockf ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki [ -d $ldir ] || newdir $ldir || exit 1
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki staffer sh -c "echo $hostname $STAFFER $$ > $lockf" || exit 1
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Ensure no other instance of this script is running on this host.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# LOCKNAME can be set in <env_file>, and is by default, but is not
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# required due to the use of $ATLOG below.
aaba19e23c48a32e927f4e39464be188bfcbef37fwif [ -n "$LOCKNAME" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Create from one, two, or three other locks:
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# - protects against multiple builds in same workspace
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# - protects against multiple 'u' copy-backs
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# - protects against multiple 'U' copy-backs
aaba19e23c48a32e927f4e39464be188bfcbef37fw# Overriding ISUSER to 1 causes the lock to be created as root if the
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# script is run as root. The default is to create it as $STAFFER.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiISUSER=1 create_lock $ATLOG/nightly.lock "atloglockfile"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki create_lock $PARENT_WS/usr/src/nightly.$MACH.lock "ulockfile"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # NIGHTLY_PARENT_ROOT is written as root if script invoked as root.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki ISUSER=1 create_lock $NIGHTLY_PARENT_ROOT/nightly.lock "Ulockfile"
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Locks have been taken, so we're doing a build and we're committed to
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# the directories we may have created so far.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Create mail_msg_file
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Move old LOGFILE aside
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# ATLOG directory already made by 'create_lock' above
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiif [ -f $LOGFILE ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Build OsNet source
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiecho "\n==== Nightly $maketype build started: $START_DATE ====" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# make sure we log only to the nightly build file
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiecho "\n==== list of environment variables ====\n" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiecho "\n==== Nightly argument issues ====\n" | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ "$i_FLAG" = "y" -o "$i_CMD_LINE_FLAG" = "y" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: the -S flags do not support incremental" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "builds; forcing clobber\n" | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: the -S flags do not support protocmp;" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "protocmp disabled\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: the -S flags do not support lint;" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: the -S flags do not support cstyle;" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "cstyle check disabled\n" | tee -a $mail_msg_file >> $LOGFILE
2ea390f3bec3fff24e17f2bb5bf7457e44834af2Michael Bergknoff cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
2ea390f3bec3fff24e17f2bb5bf7457e44834af2Michael BergknoffWARNING: the p option (create packages) is set, but so is the N option (do
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki not run protocmp); this is dangerous; you should unset the N option
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiWarning: the N option (do not run protocmp) is set; it probably shouldn't be
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiif [ "$a_FLAG" = "y" -a "$D_FLAG" = "n" -a "$F_FLAG" = "y" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: Neither DEBUG nor non-DEBUG build requested, but the" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "'a' option was set." | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: DEBUG build not requested, but lint will be with" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "DEBUG enabled.\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: the -f flag cannot be used during incremental" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: the -f flag requires -l and -p; ignoring -f\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiif [ "$T_FLAG" = "y" -a -d $SRC/uts/common/dtrace ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: TRACE build requested but workspace contains DTrace;" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "-T will have no effect\n" | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # We're not doing a tools build, so make sure elfsign(1) is
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # new enough to safely sign non-crypto binaries. We test
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # debugging output from elfsign to detect the old version.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki newelfsigntest=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -z "$newelfsigntest" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: /usr/bin/elfsign out of date;" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "will only sign crypto modules\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: VERIFY_ELFSIGN=y requires" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "the -t flag; ignoring VERIFY_ELFSIGN\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiecho "==== Build environment ====\n" | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# nightly (will fail in year 2100 due to SCCS flaw)
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiecho "%M% version %I% 20%E%\n" | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiecho "number of concurrent jobs = $DMAKE_MAX_JOBS" |
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Report the compiler versions.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\nUnable to find \"Makefile\" in $BRINGOVER_WS/usr/src or $SRC." |
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki for target in cc-version cc64-version java-version; do
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Put statefile somewhere we know we can write to rather than trip
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # over a read-only $srcroot. Use /usr/ccs/bin/make here because
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if /usr/ccs/bin/make -K $TMPDIR/make-state -e $target 2>/dev/null; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "Aborting due to missing compiler." |
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkias -V 2>&1 | head -1 | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Check that we're running a capable link-editor
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "The link-editor needs to be at version 422 or higher to build" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "the latest stuff, hope your build works." | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiecho "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiecho "\n==== Build version ====\n" | tee -a $mail_msg_file >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Decide whether to clobber
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # remove old clobber file
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Remove all .make.state* files, just in case we are restarting
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # the build after having interrupted a previous 'make clobber'.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki find . \( -name SCCS -o -name 'interfaces.*' \) -prune \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Make tools clobber ERRORS ====\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Get back to a clean workspace as much as possible to catch
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # problems that only occur on fresh workspaces.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Remove all .make.state* files, libraries, and .o's that may
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # have been ommitted from clobber.
dc6ca969834c6d8d1aac19aaea19d86c5b73cf75fw # We should probably blow away temporary directories too.
dc6ca969834c6d8d1aac19aaea19d86c5b73cf75fw find . \( -name SCCS -o -name 'interfaces.*' \) -prune -o \
dc6ca969834c6d8d1aac19aaea19d86c5b73cf75fw \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Decide whether to bringover to the codemgr workspace
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # sleep on the parent workspace's lock
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki while egrep -s write $BRINGOVER_WS/Codemgr_wsdata/locks
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki staffer $TEAMWARE/bin/bringover -c "nightly update" -p $BRINGOVER_WS \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "trouble with bringover, quitting at `date`." >> $LOGFILE
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw # on297 printing
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # on297 CSI project
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# Build tools if requested
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD=
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki export ONBLD_TOOLS=${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld}
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw echo "\n==== NOT Building base OS-Net source ====\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Retrieving SCCS files at `date` ====\n" >> $LOGFILE
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkisccs get SCCS >/dev/null 2>&1
2ea390f3bec3fff24e17f2bb5bf7457e44834af2Michael Bergknoff find . -name SCCS | xargs -L 1 ${SCCSHELPER}
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw# EXPORT_SRC comes after CRYPT_SRC since a domestic build will need
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# $SRC pointing to the export_source usr/src.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then
2ea390f3bec3fff24e17f2bb5bf7457e44834af2Michael Bergknoff # drop the crypt files in place.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\nextracting crypt_files.cpio.Z onto export_source.\n" \
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw echo "\n==== DOMESTIC extraction succeeded ====\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== DOMESTIC extraction failed ====\n" \
aaba19e23c48a32e927f4e39464be188bfcbef37fwif [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then
aaba19e23c48a32e927f4e39464be188bfcbef37fw # remove proto area here, since we don't clobber
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Creating protolist system file at `date` ====" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "==== protolist system file created at `date` ====\n" \
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw echo "\n==== Impact on packages ====\n" >> $mail_msg_file
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw # If there is a reference proto list, compare the build's proto
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # list with the reference to see changes in proto areas.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Use the current exception list.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki if [ -f "$REF_PROTO_LIST" ]; then
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki "Files in yesterday's proto area, but not today's:" \
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw "Files in today's proto area, but not yesterday's:" \
1c60fca8a4c7f20e66b3fadbbd9180e37c8db195fw "Files that changed between yesterday and today:" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Compare the build's proto list with current package
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # definitions to audit the quality of package definitions
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # and makefile install targets. Use the current exception list.
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer "Files missing from the proto area:" \
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer "Files missing from packages:" \
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer "Inconsistencies between pkgdefs and proto area:" \
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyerif [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer# Update parent proto area if necessary. This is done now
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer# so that the proto area has either DEBUG or non-DEBUG kernels.
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer# Note that this clears out the lock file, so we can dispense with
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer# the variable now.
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyerif [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # The rm -rf command below produces predictable errors if
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # nightly is invoked from the parent's $ROOT/opt/onbld/bin,
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # and that directory is accessed via NFS. This is because
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # deleted-but-still-open files don't actually disappear as
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # expected, but rather turn into .nfsXXXX junk files, leaving
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # the directory non-empty. Since this is a not-unusual usage
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # pattern, and we still want to catch other errors here, we
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # take the unusal step of moving aside 'nightly' from that
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # directory (if we're using it).
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer if [ $0 -ef $PARENT_WS/proto/root_$MACH/$mypath ]; then
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer ( tar cf - . | ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf - ) ) 2>&1 |
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer# do shared library interface verification
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyerif [ "$A_FLAG" = "y" -a "$build_ok" = "y" ]; then
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer echo "\n==== Check versioning and ABI information ====\n" | \
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # report any ERROR found in log file
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer fgrep 'ERROR' $SRC/interfaces.out/log | sed 's/^ERROR: //' | \
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer echo "\n==== Diff versioning warnings (since last build) ====\n" | \
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer out_vers=`grep ^VERSION $SRC/interfaces.out/log`;
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer ref_vers=`grep ^VERSION $SRC/interfaces.ref/log`;
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # Report any differences in WARNING messages between last
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer # and current build.
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer diff $SRC/interfaces.ref/log $SRC/interfaces.out/log | \
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyerif [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then
817697f4a28f704a2d88ace09406d985aa3a8549Kelly Moyer echo "\n==== Check ELF runtime attributes ====\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # If we're doing a debug build the proto area will be left with
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # debuggable objects, thus don't assert -s.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki check_rtime -d $ROOT -i -m -o $rtime_sflag $ROOT 2>&1 | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki egrep -v ": unreferenced object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki egrep -v ": unused object=$ROOT/.*/lib(w|intl|thread|pthread).so" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # Determine any processing errors that will affect the final output
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # and display these first.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: ldd(1) does not support -e. The version of ldd(1)" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "on your system is old - 4390308 (s81_30) is required.\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: wrong class message detected. ldd(1) was unable" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "to execute an object, thus it could not be checked fully." | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "Perhaps a 64-bit object was encountered on a 32-bit system," | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "or an i386 object was encountered on a sparc system?\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "WARNING: creation of an alternative dependency cache failed." | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "Dependencies will bind to the base system libraries.\n" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki grep "$CRLERROR" $SRC/runtime.out | grep -v "$CRLECONF" | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki egrep '<dependency no longer necessary>' $SRC/runtime.out | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # NEEDED= and RPATH= are informational; report anything else that we
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # haven't already.
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki egrep -v "NEEDED=|RPATH=|$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki # probably should compare against a 'known ok runpaths' list
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki echo "\n==== Diff ELF runtime attributes (since last build) ====\n" \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" $SRC/runtime.out | \
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# For now, don't make archives or packages for GPROF/TRACE builds
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenki# GPROF build begins
0d63ce2b32a9e1cc8ed71d4d92536c44d66a530avenkiif [ "$i_CMD_LINE_FLAG" = "n" -a "$P_FLAG" = "y" ]; then
unset EXTRA_CFLAGS
set $LINTDIRS
# remove old check.out
cd $SRC
arg=-b
for unreffile; do