5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 # Copyright 2008, 2010, Richard Lowe
26 # Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27 # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
29 # Based on the nightly script from the integration folks,
30 # Mostly modified and owned by mike_s.
31 # Changes also by kjc, dmk.
33 # BRINGOVER_WS may be specified in the env file.
34 # The default is the old behavior of CLONE_WS
36 # -i on the command line, means fast options, so when it's on the
37 # command line (only), lint and check builds are skipped no matter what
38 # the setting of their individual flags are in NIGHTLY_OPTIONS.
40 # LINTDIRS can be set in the env file, format is a list of:
42 # /dirname-to-run-lint-on flag
44 # Where flag is: y - enable lint noise diff output
45 # n - disable lint noise diff output
47 # For example: LINTDIRS="$SRC/uts n $SRC/stand y $SRC/psm y"
49 # OPTHOME and TEAMWARE may be set in the environment to override /opt
50 # and /opt/teamware defaults.
54 # The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
55 # under certain circumstances, which can really screw things up; unset it.
59 # Get the absolute path of the nightly script that the user invoked. This
60 # may be a relative path, and we need to do this before changing directory.
61 nightly_path
=`whence $0`
64 # Keep track of where we found nightly so we can invoke the matching
65 # which_scm script. If that doesn't work, don't go guessing, just rely
66 # on the $PATH settings, which will generally give us either /opt/onbld
67 # or the user's workspace.
69 WHICH_SCM
=$
(dirname $nightly_path)/which_scm
70 if [[ ! -x $WHICH_SCM ]]; then
76 print
-u2 "nightly: $*"
81 # Function to do a DEBUG and non-DEBUG build. Needed because we might
82 # need to do another for the source build, and since we only deliver DEBUG or
87 function normal_build
{
89 typeset orig_p_FLAG
="$p_FLAG"
90 typeset crypto_signer
="$CODESIGN_USER"
94 # non-DEBUG build begins
96 if [ "$F_FLAG" = "n" ]; then
97 set_non_debug_build_flags
98 CODESIGN_USER
="$crypto_signer" \
99 build
"non-DEBUG" "$suffix-nd" "-nd" "$MULTI_PROTO"
100 if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a \
101 "$p_FLAG" = "y" ]; then
102 copy_ihv_pkgs non-DEBUG
-nd
105 echo "\n==== No non-DEBUG $open_only build ====\n" >> "$LOGFILE"
108 # non-DEBUG build ends
112 if [ "$D_FLAG" = "y" ]; then
113 set_debug_build_flags
114 CODESIGN_USER
="$crypto_signer" \
115 build
"DEBUG" "$suffix" "" "$MULTI_PROTO"
116 if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a \
117 "$p_FLAG" = "y" ]; then
118 copy_ihv_pkgs DEBUG
""
121 echo "\n==== No DEBUG $open_only build ====\n" >> "$LOGFILE"
126 p_FLAG
="$orig_p_FLAG"
130 # usage: run_hook HOOKNAME ARGS...
132 # If variable "$HOOKNAME" is defined, insert a section header into
133 # our logs and then run the command with ARGS
137 eval HOOKCMD
=\$
$HOOKNAME
140 if [ -n "$HOOKCMD" ]; then
142 echo "\n==== Running $HOOKNAME command: $HOOKCMD ====\n"
143 ( $HOOKCMD "$@" 2>&1 )
144 if [ "$?" -ne 0 ]; then
145 # Let exit status propagate up
148 ) |
tee -a $mail_msg_file >> $LOGFILE
150 if [ -f $TMPDIR/abort
]; then
152 echo "\nAborting at request of $HOOKNAME" |
153 tee -a $mail_msg_file >> $LOGFILE
160 # usage: filelist DESTDIR PATTERN
168 # function to save off binaries after a full build for later
170 function save_binaries
{
171 # save off list of binaries
172 echo "\n==== Saving binaries from build at `date` ====\n" | \
173 tee -a $mail_msg_file >> $LOGFILE
176 filelist
${CODEMGR_WS} '^preserve:' >> $LOGFILE
177 filelist
${CODEMGR_WS} '^preserve:' | \
178 cpio -ocB 2>/dev
/null |
compress \
183 # usage: hybridize_files DESTDIR MAKE_TARGET
184 function hybridize_files
{
188 echo "\n==== Hybridizing files at `date` ====\n" | \
189 tee -a $mail_msg_file >> $LOGFILE
190 for i
in `filelist ${DEST} '^delete:'`
192 echo "removing ${i}." |
tee -a $mail_msg_file >> $LOGFILE
195 for i
in `filelist ${DEST} '^hybridize:' `
197 echo "hybridizing ${i}." |
tee -a $mail_msg_file >> $LOGFILE
199 sed -e "/^# HYBRID DELETE START/,/^# HYBRID DELETE END/d" \
205 # restore binaries into the proper source tree.
206 # usage: restore_binaries DESTDIR MAKE_TARGET
207 function restore_binaries
{
211 echo "\n==== Restoring binaries to ${MAKETARG} at `date` ====\n" | \
212 tee -a $mail_msg_file >> $LOGFILE
214 zcat
${BINARCHIVE} | \
215 cpio -idmucvB 2>/dev
/null |
tee -a $mail_msg_file >> ${LOGFILE}
218 # rename files we save binaries of
219 # usage: rename_files DESTDIR MAKE_TARGET
220 function rename_files
{
223 echo "\n==== Renaming source files in ${MAKETARG} at `date` ====\n" | \
224 tee -a $mail_msg_file >> $LOGFILE
225 for i
in `filelist ${DEST} '^rename:'`
227 echo ${i} |
tee -a $mail_msg_file >> ${LOGFILE}
233 # Return library search directive as function of given root.
235 echo "-L$1/lib -L$1/usr/lib"
238 # Return header search directive as function of given root.
240 echo "-I$1/usr/include"
244 # Function to do the build, including package generation.
245 # usage: build LABEL SUFFIX ND MULTIPROTO
246 # - LABEL is used to tag build output.
247 # - SUFFIX is used to distinguish files (e.g., DEBUG vs non-DEBUG,
248 # open-only vs full tree).
249 # - ND is "-nd" (non-DEBUG builds) or "" (DEBUG builds).
250 # - If MULTIPROTO is "yes", it means to name the proto area according to
251 # SUFFIX. Otherwise ("no"), (re)use the standard proto area.
258 INSTALLOG
=install${SUFFIX}-${MACH}
259 NOISE
=noise
${SUFFIX}-${MACH}
260 PKGARCHIVE
=${PKGARCHIVE_ORIG}${SUFFIX}
263 [ $MULTIPROTO = no
] ||
export ROOT
=$ROOT$SUFFIX
265 export ENVLDLIBS1
=`myldlibs $ROOT`
266 export ENVCPPFLAGS1
=`myheaders $ROOT`
270 # Build OS-Networking source
272 echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \
275 rm -f $SRC/${INSTALLOG}.out
277 /bin
/time $MAKE -e install 2>&1 | \
278 tee -a $SRC/${INSTALLOG}.out
>> $LOGFILE
280 if [[ "$SCM_TYPE" = teamware
]]; then
281 echo "\n==== SCCS Noise ($LABEL) ====\n" >> $mail_msg_file
282 egrep 'sccs(check:| *get)' $SRC/${INSTALLOG}.out
>> \
286 echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file
287 egrep ":" $SRC/${INSTALLOG}.out |
288 egrep -e "(^${MAKE}:|[ ]error[: \n])" | \
289 egrep -v "Ignoring unknown host" | \
290 egrep -v "cc .* -o error " | \
291 egrep -v "warning" >> $mail_msg_file
292 if [ "$?" = "0" ]; then
296 grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \
298 if [ "$?" = "0" ]; then
303 if [ "$W_FLAG" = "n" ]; then
304 echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file
305 egrep -i warning
: $SRC/${INSTALLOG}.out \
307 |
egrep -v "symbol (\`|')timezone' has differing types:" \
308 |
egrep -v "parameter <PSTAMP> set to" \
309 |
egrep -v "Ignoring unknown host" \
310 |
egrep -v "redefining segment flags attribute for" \
314 echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \
317 echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file
318 tail -3 $SRC/${INSTALLOG}.out
>>$mail_msg_file
320 if [ "$i_FLAG" = "n" -a "$W_FLAG" = "n" ]; then
321 rm -f $SRC/${NOISE}.ref
322 if [ -f $SRC/${NOISE}.out
]; then
323 mv $SRC/${NOISE}.out
$SRC/${NOISE}.ref
325 grep : $SRC/${INSTALLOG}.out \
327 |
egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \
330 |
egrep -v '^LD_LIBRARY_PATH=' \
331 |
egrep -v 'ar: creating' \
332 |
egrep -v 'ar: writing' \
333 |
egrep -v 'conflicts:' \
334 |
egrep -v ':saved created' \
335 |
egrep -v '^stty.*c:' \
336 |
egrep -v '^mfgname.c:' \
337 |
egrep -v '^uname-i.c:' \
338 |
egrep -v '^volumes.c:' \
339 |
egrep -v '^lint library construction:' \
340 |
egrep -v 'tsort: INFORM:' \
341 |
egrep -v 'stripalign:' \
342 |
egrep -v 'chars, width' \
343 |
egrep -v "symbol (\`|')timezone' has differing types:" \
344 |
egrep -v 'PSTAMP' \
345 |
egrep -v '|%WHOANDWHERE%|' \
346 |
egrep -v '^Manifying' \
347 |
egrep -v 'Ignoring unknown host' \
348 |
egrep -v 'Processing method:' \
349 |
egrep -v '^Writing' \
350 |
egrep -v 'spellin1:' \
351 |
egrep -v '^adding:' \
352 |
egrep -v "^echo 'msgid" \
353 |
egrep -v '^echo ' \
355 |
egrep -v '^Adding file:' \
356 |
egrep -v 'CLASSPATH=' \
357 |
egrep -v '\/var\/mail\/:saved' \
358 |
egrep -v -- '-DUTS_VERSION=' \
359 |
egrep -v '^Running Mkbootstrap' \
360 |
egrep -v '^Applet length read:' \
361 |
egrep -v 'bytes written:' \
362 |
egrep -v '^File:SolarisAuthApplet.bin' \
363 |
egrep -v -i 'jibversion' \
364 |
egrep -v '^Output size:' \
365 |
egrep -v '^Solo size statistics:' \
366 |
egrep -v '^Using ROM API Version' \
367 |
egrep -v '^Zero Signature length:' \
368 |
egrep -v '^Note \(probably harmless\):' \
370 |
egrep -v -- '-xcache' \
372 |
egrep -v '^cc1: note: -fwritable-strings' \
373 |
egrep -v 'svccfg-native -s svc:/' \
374 |
sort |
uniq >$SRC/${NOISE}.out
375 if [ ! -f $SRC/${NOISE}.ref
]; then
376 cp $SRC/${NOISE}.out
$SRC/${NOISE}.ref
378 echo "\n==== Build noise differences ($LABEL) ====\n" \
380 diff $SRC/${NOISE}.ref
$SRC/${NOISE}.out
>>$mail_msg_file
384 # Re-sign selected binaries using signing server
385 # (gatekeeper builds only)
387 if [ -n "$CODESIGN_USER" -a "$this_build_ok" = "y" ]; then
388 echo "\n==== Signing proto area at `date` ====\n" >> $LOGFILE
389 signing_file
="${TMPDIR}/signing"
390 rm -f ${signing_file}
392 signproto
$SRC/tools
/codesign
/creds
2>&1 | \
393 tee -a ${signing_file} >> $LOGFILE
394 echo "\n==== Finished signing proto area at `date` ====\n" \
396 echo "\n==== Crypto module signing errors ($LABEL) ====\n" \
398 egrep 'WARNING|ERROR' ${signing_file} >> $mail_msg_file
399 if (( $?
== 0 )) ; then
408 if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then
409 if [ -d $SRC/pkg
-o -d $SRC/pkgdefs
]; then
410 echo "\n==== Creating $LABEL packages at `date` ====\n" \
412 echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE
413 rm -rf $PKGARCHIVE >> "$LOGFILE" 2>&1
414 mkdir
-p $PKGARCHIVE >> "$LOGFILE" 2>&1
416 for d
in pkg pkgdefs
; do
417 if [ ! -f "$SRC/$d/Makefile" ]; then
420 rm -f $SRC/$d/${INSTALLOG}.out
422 /bin
/time $MAKE -e install 2>&1 | \
423 tee -a $SRC/$d/${INSTALLOG}.out
>> $LOGFILE
426 echo "\n==== package build errors ($LABEL) ====\n" \
429 for d
in pkg pkgdefs
; do
430 if [ ! -f "$SRC/$d/Makefile" ]; then
434 egrep "${MAKE}|ERROR|WARNING" $SRC/$d/${INSTALLOG}.out | \
437 egrep -v "Ignoring unknown host" \
442 # Handle it gracefully if -p was set but there are
443 # neither pkg nor pkgdefs directories.
445 echo "\n==== No $LABEL packages to build ====\n" \
449 echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE
455 # Usage: dolint /dir y|n
456 # Arg. 2 is a flag to turn on/off the lint diff output
458 if [ ! -d "$1" ]; then
459 echo "dolint error: $1 is not a directory"
463 if [ "$2" != "y" -a "$2" != "n" ]; then
464 echo "dolint internal error: $2 should be 'y' or 'n'"
470 base
=`basename $lintdir`
471 LINTOUT
=$lintdir/lint-
${MACH}.out
472 LINTNOISE
=$lintdir/lint-noise-
${MACH}
473 export ENVLDLIBS1
=`myldlibs $ROOT`
474 export ENVCPPFLAGS1
=`myheaders $ROOT`
476 set_debug_build_flags
479 # '$MAKE lint' in $lintdir
481 echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
483 # remove old lint.out
484 rm -f $lintdir/lint.out
$lintdir/lint-noise.out
485 if [ -f $lintdir/lint-noise.ref
]; then
486 mv $lintdir/lint-noise.ref
${LINTNOISE}.ref
492 # Remove all .ln files to ensure a full reference file
494 rm -f Nothing_to_remove \
495 `find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \) \
496 -prune -o -type f -name '*.ln' -print `
498 /bin
/time $MAKE -ek lint
2>&1 | \
499 tee -a $LINTOUT >> $LOGFILE
500 echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file
501 grep "$MAKE:" $LINTOUT |
502 egrep -v "Ignoring unknown host" \
505 echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
507 echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \
509 tail -3 $LINTOUT >>$mail_msg_file
511 rm -f ${LINTNOISE}.ref
512 if [ -f ${LINTNOISE}.out
]; then
513 mv ${LINTNOISE}.out
${LINTNOISE}.ref
516 egrep -v '^(real|user|sys)' |
517 egrep -v '(library construction)' | \
518 egrep -v ': global crosschecks' | \
519 egrep -v 'Ignoring unknown host' | \
521 sort |
uniq > ${LINTNOISE}.out
522 if [ ! -f ${LINTNOISE}.ref
]; then
523 cp ${LINTNOISE}.out
${LINTNOISE}.ref
525 if [ "$dodiff" != "n" ]; then
526 echo "\n==== lint warnings $base ====\n" \
528 # should be none, though there are a few that were filtered out
530 egrep -i '(warning|lint):' ${LINTNOISE}.out \
531 |
sort |
uniq >> $mail_msg_file
532 echo "\n==== lint noise differences $base ====\n" \
534 diff ${LINTNOISE}.ref
${LINTNOISE}.out \
539 # Install proto area from IHV build
541 function copy_ihv_proto
{
543 echo "\n==== Installing IHV proto area ====\n" \
545 if [ -d "$IA32_IHV_ROOT" ]; then
546 if [ ! -d "$ROOT" ]; then
547 echo "mkdir -p $ROOT" >> $LOGFILE
550 echo "copying $IA32_IHV_ROOT to $ROOT\n" >> $LOGFILE
552 tar cf
- . |
(cd $ROOT; umask 0; tar xpf
- ) 2>&1 >> $LOGFILE
554 echo "$IA32_IHV_ROOT: not found" >> $LOGFILE
557 if [ "$MULTI_PROTO" = yes ]; then
558 if [ ! -d "$ROOT-nd" ]; then
559 echo "mkdir -p $ROOT-nd" >> $LOGFILE
562 # If there's a non-DEBUG version of the IHV proto area,
563 # copy it, but copy something if there's not.
564 if [ -d "$IA32_IHV_ROOT-nd" ]; then
565 echo "copying $IA32_IHV_ROOT-nd to $ROOT-nd\n" >> $LOGFILE
567 elif [ -d "$IA32_IHV_ROOT" ]; then
568 echo "copying $IA32_IHV_ROOT to $ROOT-nd\n" >> $LOGFILE
571 echo "$IA32_IHV_ROOT{-nd,}: not found" >> $LOGFILE
574 tar cf
- . |
(cd $ROOT-nd; umask 0; tar xpf
- ) 2>&1 >> $LOGFILE
578 # Install IHV packages in PKGARCHIVE
579 # usage: copy_ihv_pkgs LABEL SUFFIX
580 function copy_ihv_pkgs
{
583 # always use non-DEBUG IHV packages
584 IA32_IHV_PKGS
=${IA32_IHV_PKGS_ORIG}-nd
585 PKGARCHIVE
=${PKGARCHIVE_ORIG}${SUFFIX}
587 echo "\n==== Installing IHV packages from $IA32_IHV_PKGS ($LABEL) ====\n" \
589 if [ -d "$IA32_IHV_PKGS" ]; then
592 (cd $PKGARCHIVE; umask 0; tar xpf
- ) 2>&1 >> $LOGFILE
594 echo "$IA32_IHV_PKGS: not found" >> $LOGFILE
597 echo "\n==== Installing IHV packages from $IA32_IHV_BINARY_PKGS ($LABEL) ====\n" \
599 if [ -d "$IA32_IHV_BINARY_PKGS" ]; then
600 cd $IA32_IHV_BINARY_PKGS
602 (cd $PKGARCHIVE; umask 0; tar xpf
- ) 2>&1 >> $LOGFILE
604 echo "$IA32_IHV_BINARY_PKGS: not found" >> $LOGFILE
609 # Build and install the onbld tools.
611 # usage: build_tools DESTROOT
613 # returns non-zero status if the build was successful.
615 function build_tools
{
618 INSTALLOG
=install-
${MACH}
620 echo "\n==== Building tools at `date` ====\n" \
623 rm -f ${TOOLS}/${INSTALLOG}.out
625 /bin
/time $MAKE TOOLS_PROTO
=${DESTROOT} -e install 2>&1 | \
626 tee -a ${TOOLS}/${INSTALLOG}.out
>> $LOGFILE
628 echo "\n==== Tools build errors ====\n" >> $mail_msg_file
630 egrep ":" ${TOOLS}/${INSTALLOG}.out |
631 egrep -e "(${MAKE}:|[ ]error[: \n])" | \
632 egrep -v "Ignoring unknown host" | \
633 egrep -v warning
>> $mail_msg_file
638 # Set up to use locally installed tools.
640 # usage: use_tools TOOLSROOT
646 # If we're not building ON workspace, then the TOOLSROOT
647 # settings here are clearly ignored by the workspace
648 # makefiles, prepending nonexistent directories to PATH is
649 # harmless, and we clearly do not wish to override
652 # If we're building an ON workspace, then the prepended PATH
653 # elements should supercede the preexisting ONBLD_TOOLS paths,
654 # and we want to override ONBLD_TOOLS to catch the tools that
655 # don't have specific path env vars here.
657 # So the only conditional behavior is overriding ONBLD_TOOLS,
658 # and we check for "an ON workspace" by looking for
659 # ${TOOLSROOT}/opt/onbld.
662 STABS
=${TOOLSROOT}/opt
/onbld
/bin
/${MACH}/stabs
664 CTFSTABS
=${TOOLSROOT}/opt
/onbld
/bin
/${MACH}/ctfstabs
666 GENOFFSETS
=${TOOLSROOT}/opt
/onbld
/bin
/genoffsets
669 CTFCONVERT
=${TOOLSROOT}/opt
/onbld
/bin
/${MACH}/ctfconvert
671 CTFMERGE
=${TOOLSROOT}/opt
/onbld
/bin
/${MACH}/ctfmerge
674 CTFCVTPTBL
=${TOOLSROOT}/opt
/onbld
/bin
/ctfcvtptbl
676 CTFFINDMOD
=${TOOLSROOT}/opt
/onbld
/bin
/ctffindmod
679 if [ "$VERIFY_ELFSIGN" = "y" ]; then
680 ELFSIGN
=${TOOLSROOT}/opt
/onbld
/bin
/elfsigncmp
682 ELFSIGN
=${TOOLSROOT}/opt
/onbld
/bin
/${MACH}/elfsign
686 PATH
="${TOOLSROOT}/opt/onbld/bin/${MACH}:${PATH}"
687 PATH
="${TOOLSROOT}/opt/onbld/bin:${PATH}"
690 if [ -d "${TOOLSROOT}/opt/onbld" ]; then
691 ONBLD_TOOLS
=${TOOLSROOT}/opt
/onbld
695 echo "\n==== New environment settings. ====\n" >> $LOGFILE
696 echo "STABS=${STABS}" >> $LOGFILE
697 echo "CTFSTABS=${CTFSTABS}" >> $LOGFILE
698 echo "CTFCONVERT=${CTFCONVERT}" >> $LOGFILE
699 echo "CTFMERGE=${CTFMERGE}" >> $LOGFILE
700 echo "CTFCVTPTBL=${CTFCVTPTBL}" >> $LOGFILE
701 echo "CTFFINDMOD=${CTFFINDMOD}" >> $LOGFILE
702 echo "ELFSIGN=${ELFSIGN}" >> $LOGFILE
703 echo "PATH=${PATH}" >> $LOGFILE
704 echo "ONBLD_TOOLS=${ONBLD_TOOLS}" >> $LOGFILE
708 if [ $ISUSER -ne 0 ]; then
717 eval su
$STAFFER -c \'$arg\'
722 # Verify that the closed tree is present if it needs to be.
724 function check_closed_tree
{
725 if [[ ! -d "$ON_CLOSED_BINS" ]]; then
726 echo "ON_CLOSED_BINS must point to the closed binaries tree."
732 function obsolete_build
{
733 echo "WARNING: Obsolete $1 build requested; request will be ignored"
737 # wrapper over wsdiff.
738 # usage: do_wsdiff LABEL OLDPROTO NEWPROTO
746 [ "$t_FLAG" = y
] && wsdiff
="wsdiff -t"
748 echo "\n==== Getting object changes since last build at `date`" \
749 "($label) ====\n" |
tee -a $LOGFILE >> $mail_msg_file
750 $wsdiff -s -r ${TMPDIR}/wsdiff.results
$oldproto $newproto 2>&1 | \
751 tee -a $LOGFILE >> $mail_msg_file
752 echo "\n==== Object changes determined at `date` ($label) ====\n" | \
753 tee -a $LOGFILE >> $mail_msg_file
757 # Functions for setting build flags (DEBUG/non-DEBUG). Keep them
761 function set_non_debug_build_flags
{
762 export INTERNAL_RELEASE_BUILD
; INTERNAL_RELEASE_BUILD
=
763 export RELEASE_BUILD
; RELEASE_BUILD
=
768 function set_debug_build_flags
{
769 export INTERNAL_RELEASE_BUILD
; INTERNAL_RELEASE_BUILD
=
778 if [ "$OPTHOME" = "" ]; then
782 if [ "$TEAMWARE" = "" ]; then
783 TEAMWARE
=$OPTHOME/teamware
787 USAGE
='Usage: nightly [-in] [+t] [-V VERS ] <env_file>
790 -i Fast incremental options (no clobber, lint, check)
791 -n Do not do a bringover
792 +t Use the build tools in $ONBLD_TOOLS/bin
793 -V VERS set the build version string to VERS
795 <env_file> file in Bourne shell syntax that sets and exports
796 variables that configure the operation of this script and many of
797 the scripts this one calls. If <env_file> does not exist,
798 it will be looked for in $OPTHOME/onbld/env.
800 non-DEBUG is the default build type. Build options can be set in the
801 NIGHTLY_OPTIONS variable in the <env_file> as follows:
803 -A check for ABI differences in .so files
804 -C check for cstyle/hdrchk errors
805 -D do a build with DEBUG on
806 -F do _not_ do a non-DEBUG build
807 -G gate keeper default group of options (-au)
808 -I integration engineer default group of options (-ampu)
809 -M do not run pmodes (safe file permission checker)
810 -N do not run protocmp
811 -R default group of options for building a release (-mp)
812 -U update proto area in the parent
813 -V VERS set the build version string to VERS
814 -X copy x86 IHV proto area
815 -f find unreferenced files
816 -i do an incremental build (no "make clobber")
817 -l do "make lint" in $LINTDIRS (default: $SRC y)
818 -m send mail to $MAILTO at end of build
819 -n do not do a bringover
820 -o build using root privileges to set OWNER/GROUP (old style)
822 -r check ELF runtime attributes in the proto area
823 -t build and use the tools in $SRC/tools (default setting)
824 +t Use the build tools in $ONBLD_TOOLS/bin
825 -u update proto_list_$MACH and friends in the parent workspace;
826 when used with -f, also build an unrefmaster.out in the parent
827 -w report on differences between previous and current proto areas
828 -z compress cpio archives with gzip
829 -W Do not report warnings (freeware gate ONLY)
832 # A log file will be generated under the name $LOGFILE
833 # for partially completed build and log.`date '+%F'`
834 # in the same directory for fully completed builds.
837 # default values for low-level FLAGS; G I R are group FLAGS
843 i_FLAG
=n
; i_CMD_LINE_FLAG
=n
871 while getopts +intV
: FLAG
874 i
) i_FLAG
=y
; i_CMD_LINE_FLAG
=y
889 # correct argument count after options
890 shift `expr $OPTIND - 1`
892 # test that the path to the environment-setting file was given
893 if [ $# -ne 1 ]; then
898 # check if user is running nightly as root
899 # ISUSER is set non-zero if an ordinary user runs nightly, or is zero
900 # when root invokes nightly.
901 /usr
/bin
/id |
grep '^uid=0(' >/dev
/null
2>&1
902 ISUSER
=$?
; export ISUSER
906 LC_COLLATE
=C
; export LC_COLLATE
907 LC_CTYPE
=C
; export LC_CTYPE
908 LC_MESSAGES
=C
; export LC_MESSAGES
909 LC_MONETARY
=C
; export LC_MONETARY
910 LC_NUMERIC
=C
; export LC_NUMERIC
911 LC_TIME
=C
; export LC_TIME
913 # clear environment variables we know to be bad for the build
915 unset LD_AUDIT LD_AUDIT_32 LD_AUDIT_64
916 unset LD_BIND_NOW LD_BIND_NOW_32 LD_BIND_NOW_64
917 unset LD_BREADTH LD_BREADTH_32 LD_BREADTH_64
918 unset LD_CONFIG LD_CONFIG_32 LD_CONFIG_64
919 unset LD_DEBUG LD_DEBUG_32 LD_DEBUG_64
920 unset LD_DEMANGLE LD_DEMANGLE_32 LD_DEMANGLE_64
921 unset LD_FLAGS LD_FLAGS_32 LD_FLAGS_64
922 unset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64
923 unset LD_LOADFLTR LD_LOADFLTR_32 LD_LOADFLTR_64
924 unset LD_NOAUDIT LD_NOAUDIT_32 LD_NOAUDIT_64
925 unset LD_NOAUXFLTR LD_NOAUXFLTR_32 LD_NOAUXFLTR_64
926 unset LD_NOCONFIG LD_NOCONFIG_32 LD_NOCONFIG_64
927 unset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64
928 unset LD_NODIRECT LD_NODIRECT_32 LD_NODIRECT_64
929 unset LD_NOLAZYLOAD LD_NOLAZYLOAD_32 LD_NOLAZYLOAD_64
930 unset LD_NOOBJALTER LD_NOOBJALTER_32 LD_NOOBJALTER_64
931 unset LD_NOVERSION LD_NOVERSION_32 LD_NOVERSION_64
932 unset LD_ORIGIN LD_ORIGIN_32 LD_ORIGIN_64
933 unset LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64
934 unset LD_PROFILE LD_PROFILE_32 LD_PROFILE_64
946 # To get ONBLD_TOOLS from the environment, it must come from the env file.
947 # If it comes interactively, it is generally TOOLS_PROTO, which will be
948 # clobbered before the compiler version checks, which will therefore fail.
953 # Setup environmental variables
955 if [ -f /etc
/nightly.conf
]; then
960 if [[ $1 = */* ]]; then
966 if [ -f $OPTHOME/onbld
/env
/$1 ]; then
967 .
$OPTHOME/onbld
/env
/$1
969 echo "Cannot find env file as either $1 or $OPTHOME/onbld/env/$1"
974 # contents of stdenv.sh inserted after next line:
978 # Check if we have sufficient data to continue...
979 [[ -v CODEMGR_WS
]] || fatal_error
"Error: Variable CODEMGR_WS not set."
980 if [[ "${NIGHTLY_OPTIONS}" == ~
(F
)n
]] ; then
981 # Check if the gate data are valid if we don't do a "bringover" below
982 [[ -d "${CODEMGR_WS}" ]] || \
983 fatal_error
"Error: ${CODEMGR_WS} is not a directory."
984 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || \
985 fatal_error
"Error: ${CODEMGR_WS}/usr/src/Makefile not found."
989 # place ourselves in a new task, respecting BUILD_PROJECT if set.
991 if [ -z "$BUILD_PROJECT" ]; then
992 /usr
/bin
/newtask
-c $$
994 /usr
/bin
/newtask
-c $$
-p $BUILD_PROJECT
997 ps
-o taskid
= -p $$ |
read build_taskid
998 ps
-o project
= -p $$ |
read build_project
1001 # See if NIGHTLY_OPTIONS is set
1003 if [ "$NIGHTLY_OPTIONS" = "" ]; then
1004 NIGHTLY_OPTIONS
="-aBm"
1008 # If BRINGOVER_WS was not specified, let it default to CLONE_WS
1010 if [ "$BRINGOVER_WS" = "" ]; then
1011 BRINGOVER_WS
=$CLONE_WS
1015 # If CLOSED_BRINGOVER_WS was not specified, let it default to CLOSED_CLONE_WS
1017 if [ "$CLOSED_BRINGOVER_WS" = "" ]; then
1018 CLOSED_BRINGOVER_WS
=$CLOSED_CLONE_WS
1022 # If BRINGOVER_FILES was not specified, default to usr
1024 if [ "$BRINGOVER_FILES" = "" ]; then
1025 BRINGOVER_FILES
="usr"
1031 # Note: changes to the option letters here should also be applied to the
1032 # bldenv script. `d' is listed for backward compatibility.
1034 NIGHTLY_OPTIONS
=-${NIGHTLY_OPTIONS#-}
1036 while getopts +ABCDdFfGIilMmNnoPpRrTtUuWwXxz FLAG
$NIGHTLY_OPTIONS
1042 ;; # old version of D
1084 U
) if [ -z "${PARENT_ROOT}" ]; then
1085 echo "PARENT_ROOT must be set if the U flag is" \
1086 "present in NIGHTLY_OPTIONS."
1089 NIGHTLY_PARENT_ROOT
=$PARENT_ROOT
1090 if [ -n "${PARENT_TOOLS_ROOT}" ]; then
1091 NIGHTLY_PARENT_TOOLS_ROOT
=$PARENT_TOOLS_ROOT
1102 X
) # now that we no longer need realmode builds, just
1103 # copy IHV packages. only meaningful on x86.
1104 if [ "$MACH" = "i386" ]; then
1116 if [ $ISUSER -ne 0 ]; then
1117 if [ "$o_FLAG" = "y" ]; then
1118 echo "Old-style build requires root permission."
1122 # Set default value for STAFFER, if needed.
1123 if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then
1124 STAFFER
=`/usr/xpg4/bin/id -un`
1129 if [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then
1134 PATH
="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin"
1135 PATH
="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb"
1136 PATH
="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
1139 # roots of source trees, both relative to $SRC and absolute.
1144 if [ "$o_FLAG" = "y" ]; then
1145 # root invoked old-style build -- make sure it works as it always has
1146 # by exporting 'CH'. The current Makefile.master doesn't use this, but
1147 # the old ones still do.
1148 PROTOCMPTERSE
="protocmp.terse"
1152 PROTOCMPTERSE
="protocmp.terse -gu"
1155 # have we set RELEASE_DATE in our env file?
1156 if [ -z "$RELEASE_DATE" ]; then
1157 RELEASE_DATE
=$
(LC_ALL
=C
date +"%B %Y")
1159 BUILD_DATE
=$
(LC_ALL
=C
date +%Y-
%b-
%d
)
1160 BASEWSDIR
=$
(basename $CODEMGR_WS)
1161 DEV_CM
="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
1163 # we export POUND_SIGN, RELEASE_DATE and DEV_CM to speed up the build process
1164 # by avoiding repeated shell invocations to evaluate Makefile.master definitions.
1165 # we export o_FLAG and X_FLAG for use by makebfu, and by usr/src/pkg/Makefile
1166 export o_FLAG X_FLAG POUND_SIGN RELEASE_DATE DEV_CM
1168 maketype
="distributed"
1170 # get the dmake version string alone
1171 DMAKE_VERSION
=$
( $MAKE -v )
1172 DMAKE_VERSION
=${DMAKE_VERSION#*: }
1173 # focus in on just the dotted version number alone
1174 DMAKE_MAJOR
=$
( echo $DMAKE_VERSION | \
1175 sed -e 's/.*\<\([^.]*\.[^ ]*\).*$/\1/' )
1176 # extract the second (or final) integer
1177 DMAKE_MINOR
=${DMAKE_MAJOR#*.}
1178 DMAKE_MINOR
=${DMAKE_MINOR%%.*}
1179 # extract the first integer
1180 DMAKE_MAJOR
=${DMAKE_MAJOR%%.*}
1181 CHECK_DMAKE
=${CHECK_DMAKE:-y}
1182 # x86 was built on the 12th, sparc on the 13th.
1183 if [ "$CHECK_DMAKE" = "y" -a \
1184 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \
1185 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \
( \
1186 "$DMAKE_MAJOR" -lt 7 -o \
1187 "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \
) ]; then
1188 if [ -z "$DMAKE_VERSION" ]; then
1189 echo "$MAKE is missing."
1192 echo `whence $MAKE`" version is:"
1193 echo " ${DMAKE_VERSION}"
1196 This version may not be safe for use. Either set TEAMWARE to a better
1197 path or (if you really want to use this version of dmake anyway), add
1198 the following to your environment to disable this check:
1207 if [ "${SUNWSPRO}" != "" ]; then
1208 PATH
="${SUNWSPRO}/bin:$PATH"
1212 hostname
=$
(uname
-n)
1213 if [[ $DMAKE_MAX_JOBS != +([0-9]) ||
$DMAKE_MAX_JOBS -eq 0 ]]
1216 if [[ -f $HOME/.
make.machines
]]
1218 # Note: there is a hard tab and space character in the []s
1220 egrep -i "^[ ]*$hostname[ \.]" \
1221 $HOME/.
make.machines |
read host jobs
1225 if [[ $maxjobs != +([0-9]) ||
$maxjobs -eq 0 ]]
1231 export DMAKE_MAX_JOBS
=$maxjobs
1234 DMAKE_MODE
=parallel
;
1237 if [ -z "${ROOT}" ]; then
1238 echo "ROOT must be set."
1243 # if -V flag was given, reset VERSION to V_ARG
1245 if [ "$V_FLAG" = "y" ]; then
1250 # Check for IHV root for copying ihv proto area
1252 if [ "$X_FLAG" = "y" ]; then
1253 if [ "$IA32_IHV_ROOT" = "" ]; then
1254 echo "IA32_IHV_ROOT: must be set for copying ihv proto"
1257 if [ ! -d "$IA32_IHV_ROOT" ]; then
1258 echo "$IA32_IHV_ROOT: not found"
1261 if [ "$IA32_IHV_WS" = "" ]; then
1262 echo "IA32_IHV_WS: must be set for copying ihv proto"
1265 if [ ! -d "$IA32_IHV_WS" ]; then
1266 echo "$IA32_IHV_WS: not found"
1271 TMPDIR
="/tmp/nightly.tmpdir.$$"
1274 mkdir
-p $TMPDIR ||
exit 1
1278 # Keep elfsign's use of pkcs11_softtoken from looking in the user home
1279 # directory, which doesn't always work. Needed until all build machines
1280 # have the fix for 6271754
1282 SOFTTOKEN_DIR
=$TMPDIR
1283 export SOFTTOKEN_DIR
1286 # Tools should only be built non-DEBUG. Keep track of the tools proto
1287 # area path relative to $TOOLS, because the latter changes in an
1290 # TOOLS_PROTO is included below for builds other than usr/src/tools
1291 # that look for this location. For usr/src/tools, this will be
1292 # overridden on the $MAKE command line in build_tools().
1295 TOOLS_PROTO_REL
=proto
/root_
${MACH}-nd
1296 TOOLS_PROTO
=${TOOLS}/${TOOLS_PROTO_REL}; export TOOLS_PROTO
1298 unset CFLAGS LD_LIBRARY_PATH LDFLAGS
1300 # create directories that are automatically removed if the nightly script
1301 # fails to start correctly
1305 while [ ! -d $dir ]; do
1311 for dir
in $toadd; do
1312 if staffer mkdir
$dir; then
1313 newlist
="$ISUSER $dir $newlist"
1316 [ -z "$torm" ] || staffer
rmdir $torm
1320 newdirlist
="$newlist $newdirlist"
1325 [ -d $CODEMGR_WS ] || newdir
$CODEMGR_WS ||
exit 1
1327 # since this script assumes the build is from full source, it nullifies
1328 # variables likely to have been set by a "ws" script; nullification
1329 # confines the search space for headers and libraries to the proto area
1330 # built from this immediate source.
1340 export ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \
1341 ENVLDLIBS1 ENVLDLIBS2 PARENT_ROOT
1343 PKGARCHIVE_ORIG
=$PKGARCHIVE
1344 IA32_IHV_PKGS_ORIG
=$IA32_IHV_PKGS
1347 # Juggle the logs and optionally send mail on completion.
1350 function logshuffle
{
1351 LLOG
="$ATLOG/log.`date '+%F.%H:%M'`"
1352 if [ -f $LLOG -o -d $LLOG ]; then
1358 if [ "$build_ok" = "y" ]; then
1359 mv $ATLOG/proto_list_
${MACH} $LLOG
1361 if [ -f $ATLOG/proto_list_tools_
${MACH} ]; then
1362 mv $ATLOG/proto_list_tools_
${MACH} $LLOG
1365 if [ -f $TMPDIR/wsdiff.results
]; then
1366 mv $TMPDIR/wsdiff.results
$LLOG
1369 if [ -f $TMPDIR/wsdiff-nd.results
]; then
1370 mv $TMPDIR/wsdiff-nd.results
$LLOG
1375 # Now that we're about to send mail, it's time to check the noise
1376 # file. In the event that an error occurs beyond this point, it will
1377 # be recorded in the nightly.log file, but nowhere else. This would
1378 # include only errors that cause the copying of the noise log to fail
1379 # or the mail itself not to be sent.
1382 exec >>$LOGFILE 2>&1
1383 if [ -s $build_noise_file ]; then
1384 echo "\n==== Nightly build noise ====\n" |
1385 tee -a $LOGFILE >>$mail_msg_file
1386 cat $build_noise_file >>$LOGFILE
1387 cat $build_noise_file >>$mail_msg_file
1388 echo |
tee -a $LOGFILE >>$mail_msg_file
1390 rm -f $build_noise_file
1403 NIGHTLY_STATUS
=$state
1404 export NIGHTLY_STATUS
1406 run_hook POST_NIGHTLY
$state
1407 run_hook SYS_POST_NIGHTLY
$state
1410 # mailx(1) sets From: based on the -r flag
1414 if [[ -n "${MAILFROM}" ]]; then
1415 mailx_r
="-r ${MAILFROM}"
1418 cat $build_time_file $build_environ_file $mail_msg_file \
1420 if [ "$m_FLAG" = "y" ]; then
1421 cat ${LLOG}/mail_msg |
/usr
/bin
/mailx
${mailx_r} -s \
1422 "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \
1426 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
1427 staffer
cp ${LLOG}/mail_msg
$PARENT_WS/usr
/src
/mail_msg-
${MACH}
1428 staffer
cp $LOGFILE $PARENT_WS/usr
/src
/nightly-
${MACH}.log
1435 # Remove the locks and temporary files on any exit
1440 [ -z "$lockfile" ] || staffer
rm -f $lockfile
1441 [ -z "$atloglockfile" ] ||
rm -f $atloglockfile
1442 [ -z "$ulockfile" ] || staffer
rm -f $ulockfile
1443 [ -z "$Ulockfile" ] ||
rm -f $Ulockfile
1446 while [ $# -gt 0 ]; do
1447 ISUSER
=$1 staffer
rmdir $2
1453 function cleanup_signal
{
1455 # this will trigger cleanup(), above.
1460 trap cleanup_signal
1 2 3 15
1463 # Generic lock file processing -- make sure that the lock file doesn't
1464 # exist. If it does, it should name the build host and PID. If it
1465 # doesn't, then make sure we can create it. Clean up locks that are
1466 # known to be stale (assumes host name is unique among build systems
1467 # for the workspace).
1469 function create_lock
{
1473 ldir
=`dirname $lockf`
1474 [ -d $ldir ] || newdir
$ldir ||
exit 1
1475 eval $lockvar=$lockf
1477 while ! staffer
ln -s $hostname.
$STAFFER.$$
$lockf 2> /dev
/null
; do
1478 basews
=`basename $CODEMGR_WS`
1479 ls -l $lockf | nawk
'{print $NF}' | IFS
=.
read host user pid
1480 if [ "$host" != "$hostname" ]; then
1481 echo "$MACH build of $basews apparently" \
1482 "already started by $user on $host as $pid."
1484 elif kill -s 0 $pid 2>/dev
/null
; then
1485 echo "$MACH build of $basews already started" \
1489 # stale lock; clear it out and try again
1496 # Return the list of interesting proto areas, depending on the current
1499 function allprotos
{
1500 typeset roots
="$ROOT"
1502 if [[ "$F_FLAG" = n
&& "$MULTI_PROTO" = yes ]]; then
1503 roots
="$roots $ROOT-nd"
1509 # Ensure no other instance of this script is running on this host.
1510 # LOCKNAME can be set in <env_file>, and is by default, but is not
1511 # required due to the use of $ATLOG below.
1512 if [ -n "$LOCKNAME" ]; then
1513 create_lock
/tmp
/$LOCKNAME "lockfile"
1516 # Create from one, two, or three other locks:
1517 # $ATLOG/nightly.lock
1518 # - protects against multiple builds in same workspace
1519 # $PARENT_WS/usr/src/nightly.$MACH.lock
1520 # - protects against multiple 'u' copy-backs
1521 # $NIGHTLY_PARENT_ROOT/nightly.lock
1522 # - protects against multiple 'U' copy-backs
1524 # Overriding ISUSER to 1 causes the lock to be created as root if the
1525 # script is run as root. The default is to create it as $STAFFER.
1526 ISUSER
=1 create_lock
$ATLOG/nightly.lock
"atloglockfile"
1527 if [ "$u_FLAG" = "y" ]; then
1528 create_lock
$PARENT_WS/usr
/src
/nightly.
$MACH.lock
"ulockfile"
1530 if [ "$U_FLAG" = "y" ]; then
1531 # NIGHTLY_PARENT_ROOT is written as root if script invoked as root.
1532 ISUSER
=1 create_lock
$NIGHTLY_PARENT_ROOT/nightly.lock
"Ulockfile"
1535 # Locks have been taken, so we're doing a build and we're committed to
1536 # the directories we may have created so far.
1540 # Create mail_msg_file
1542 mail_msg_file
="${TMPDIR}/mail_msg"
1543 touch $mail_msg_file
1544 build_time_file
="${TMPDIR}/build_time"
1545 build_environ_file
="${TMPDIR}/build_environ"
1546 touch $build_environ_file
1548 # Move old LOGFILE aside
1549 # ATLOG directory already made by 'create_lock' above
1551 if [ -f $LOGFILE ]; then
1552 mv -f $LOGFILE ${LOGFILE}-
1555 # Build OsNet source
1559 echo "\n==== Nightly $maketype build started: $START_DATE ====" \
1560 |
tee -a $LOGFILE > $build_time_file
1562 echo "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \
1563 tee -a $mail_msg_file >> $LOGFILE
1565 # make sure we log only to the nightly build file
1566 build_noise_file
="${TMPDIR}/build_noise"
1567 exec </dev
/null
>$build_noise_file 2>&1
1569 run_hook SYS_PRE_NIGHTLY
1570 run_hook PRE_NIGHTLY
1572 echo "\n==== list of environment variables ====\n" >> $LOGFILE
1575 echo "\n==== Nightly argument issues ====\n" |
tee -a $mail_msg_file >> $LOGFILE
1577 if [ "$P_FLAG" = "y" ]; then
1578 obsolete_build GPROF |
tee -a $mail_msg_file >> $LOGFILE
1581 if [ "$T_FLAG" = "y" ]; then
1582 obsolete_build TRACE |
tee -a $mail_msg_file >> $LOGFILE
1585 if [ "$N_FLAG" = "y" ]; then
1586 if [ "$p_FLAG" = "y" ]; then
1587 cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
1588 WARNING: the p option (create packages) is set, but so is the N option (do
1589 not run protocmp); this is dangerous; you should unset the N option
1592 cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
1593 Warning: the N option (do not run protocmp) is set; it probably shouldn't be
1596 echo "" |
tee -a $mail_msg_file >> $LOGFILE
1599 if [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then
1601 # In the past we just complained but went ahead with the lint
1602 # pass, even though the proto area was built non-DEBUG. It's
1603 # unlikely that non-DEBUG headers will make a difference, but
1604 # rather than assuming it's a safe combination, force the user
1605 # to specify a DEBUG build.
1607 echo "WARNING: DEBUG build not requested; disabling lint.\n" \
1608 |
tee -a $mail_msg_file >> $LOGFILE
1612 if [ "$f_FLAG" = "y" ]; then
1613 if [ "$i_FLAG" = "y" ]; then
1614 echo "WARNING: the -f flag cannot be used during incremental" \
1615 "builds; ignoring -f\n" |
tee -a $mail_msg_file >> $LOGFILE
1618 if [ "${l_FLAG}${p_FLAG}" != "yy" ]; then
1619 echo "WARNING: the -f flag requires -l, and -p;" \
1620 "ignoring -f\n" |
tee -a $mail_msg_file >> $LOGFILE
1625 if [ "$w_FLAG" = "y" -a ! -d $ROOT ]; then
1626 echo "WARNING: -w specified, but $ROOT does not exist;" \
1627 "ignoring -w\n" |
tee -a $mail_msg_file >> $LOGFILE
1631 if [ "$t_FLAG" = "n" ]; then
1633 # We're not doing a tools build, so make sure elfsign(1) is
1634 # new enough to safely sign non-crypto binaries. We test
1635 # debugging output from elfsign to detect the old version.
1637 newelfsigntest
=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \
1638 -e /usr/lib/security/pkcs11_softtoken.so.1 2>&1 \
1639 | egrep algorithmOID`
1640 if [ -z "$newelfsigntest" ]; then
1641 echo "WARNING: /usr/bin/elfsign out of date;" \
1642 "will only sign crypto modules\n" | \
1643 tee -a $mail_msg_file >> $LOGFILE
1644 export ELFSIGN_OBJECT
=true
1645 elif [ "$VERIFY_ELFSIGN" = "y" ]; then
1646 echo "WARNING: VERIFY_ELFSIGN=y requires" \
1647 "the -t flag; ignoring VERIFY_ELFSIGN\n" | \
1648 tee -a $mail_msg_file >> $LOGFILE
1652 case $MULTI_PROTO in
1655 echo "WARNING: MULTI_PROTO is \"$MULTI_PROTO\"; " \
1656 "should be \"yes\" or \"no\"." |
tee -a $mail_msg_file >> $LOGFILE
1657 echo "Setting MULTI_PROTO to \"no\".\n" | \
1658 tee -a $mail_msg_file >> $LOGFILE
1659 export MULTI_PROTO
=no
1663 echo "\n==== Build version ====\n" |
tee -a $mail_msg_file >> $LOGFILE
1664 echo $VERSION |
tee -a $mail_msg_file >> $LOGFILE
1666 # Save the current proto area if we're comparing against the last build
1667 if [ "$w_FLAG" = "y" -a -d "$ROOT" ]; then
1668 if [ -d "$ROOT.prev" ]; then
1674 # Same for non-DEBUG proto area
1675 if [ "$w_FLAG" = "y" -a "$MULTI_PROTO" = yes -a -d "$ROOT-nd" ]; then
1676 if [ -d "$ROOT-nd.prev" ]; then
1677 rm -rf $ROOT-nd.prev
1679 mv $ROOT-nd $ROOT-nd.prev
1683 # Echo the SCM type of the parent workspace, this can't just be which_scm
1684 # as that does not know how to identify various network repositories.
1686 function parent_wstype
{
1687 typeset scm_type junk
1689 CODEMGR_WS
="$BRINGOVER_WS" "$WHICH_SCM" 2>/dev
/null \
1690 |
read scm_type junk
1691 if [[ -z "$scm_type" ||
"$scm_type" == unknown
]]; then
1692 # Probe BRINGOVER_WS to determine its type
1693 if [[ $BRINGOVER_WS == svn
*://* ]]; then
1694 scm_type
="subversion"
1695 elif [[ $BRINGOVER_WS == file://* ]] &&
1696 egrep -s "This is a Subversion repository" \
1697 ${BRINGOVER_WS#file://}/README.txt
2> /dev
/null
; then
1698 scm_type
="subversion"
1699 elif [[ $BRINGOVER_WS == ssh://* ]]; then
1700 scm_type
="mercurial"
1701 elif [[ $BRINGOVER_WS == http
://* ]] && \
1702 wget
-q -O- --save-headers "$BRINGOVER_WS/?cmd=heads" | \
1703 egrep -s "application/mercurial" 2> /dev
/null
; then
1704 scm_type
="mercurial"
1705 elif svn info
$BRINGOVER_WS > /dev
/null
2>&1; then
1706 scm_type
="subversion"
1712 # fold both unsupported and unrecognized results into "none"
1714 none|subversion|teamware|mercurial
)
1723 # Echo the SCM types of $CODEMGR_WS and $BRINGOVER_WS
1724 function child_wstype
{
1725 typeset scm_type junk
1727 # Probe CODEMGR_WS to determine its type
1728 if [[ -d $CODEMGR_WS ]]; then
1729 $WHICH_SCM |
read scm_type junk ||
exit 1
1733 none|subversion|git|teamware|mercurial
)
1742 SCM_TYPE
=$
(child_wstype
)
1745 # Decide whether to clobber
1747 if [ "$i_FLAG" = "n" -a -d "$SRC" ]; then
1748 echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE
1751 # remove old clobber file
1752 rm -f $SRC/clobber.out
1753 rm -f $SRC/clobber-
${MACH}.out
1755 # Remove all .make.state* files, just in case we are restarting
1756 # the build after having interrupted a previous 'make clobber'.
1757 find . \
( -name SCCS
-o -name .hg
-o -name .svn
-o -name .git \
1758 -o -name 'interfaces.*' \
) -prune \
1759 -o -name '.make.*' -print |
xargs rm -f
1761 $MAKE -ek clobber
2>&1 |
tee -a $SRC/clobber-
${MACH}.out
>> $LOGFILE
1762 echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file
1763 grep "$MAKE:" $SRC/clobber-
${MACH}.out |
1764 egrep -v "Ignoring unknown host" \
1767 if [[ "$t_FLAG" = "y" ]]; then
1768 echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE
1770 rm -f ${TOOLS}/clobber-
${MACH}.out
1771 $MAKE TOOLS_PROTO
=$TOOLS_PROTO -ek clobber
2>&1 | \
1772 tee -a ${TOOLS}/clobber-
${MACH}.out
>> $LOGFILE
1773 echo "\n==== Make tools clobber ERRORS ====\n" \
1775 grep "$MAKE:" ${TOOLS}/clobber-
${MACH}.out \
1777 rm -rf ${TOOLS_PROTO}
1778 mkdir
-p ${TOOLS_PROTO}
1781 typeset roots
=$
(allprotos
)
1782 echo "\n\nClearing $roots" >> "$LOGFILE"
1785 # Get back to a clean workspace as much as possible to catch
1786 # problems that only occur on fresh workspaces.
1787 # Remove all .make.state* files, libraries, and .o's that may
1788 # have been omitted from clobber. A couple of libraries are
1789 # under source code control, so leave them alone.
1790 # We should probably blow away temporary directories too.
1792 find $relsrcdirs \
( -name SCCS
-o -name .hg
-o -name .svn \
1793 -o -name .git
-o -name 'interfaces.*' \
) -prune -o \
1794 \
( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \
1795 -name '*.o' \
) -print | \
1796 grep -v 'tools/ctf/dwarf/.*/libdwarf' |
xargs rm -f
1798 echo "\n==== No clobber at `date` ====\n" >> $LOGFILE
1801 type bringover_teamware
> /dev
/null
2>&1 ||
function bringover_teamware
{
1802 # sleep on the parent workspace's lock
1803 while egrep -s write $BRINGOVER_WS/Codemgr_wsdata
/locks
1808 if [[ -z $BRINGOVER ]]; then
1809 BRINGOVER
=$TEAMWARE/bin
/bringover
1812 staffer
$BRINGOVER -c "nightly update" -p $BRINGOVER_WS \
1813 -w $CODEMGR_WS $BRINGOVER_FILES < /dev
/null
2>&1 ||
1814 touch $TMPDIR/bringover_failed
1816 staffer bringovercheck
$CODEMGR_WS >$TMPDIR/bringovercheck.out
2>&1
1817 if [ -s $TMPDIR/bringovercheck.out
]; then
1818 echo "\n==== POST-BRINGOVER CLEANUP NOISE ====\n"
1819 cat $TMPDIR/bringovercheck.out
1823 type bringover_mercurial
> /dev
/null
2>&1 ||
function bringover_mercurial
{
1824 typeset
-x PATH
=$PATH
1826 # If the repository doesn't exist yet, then we want to populate it.
1827 if [[ ! -d $CODEMGR_WS/.hg
]]; then
1828 staffer hg init
$CODEMGR_WS
1829 staffer
echo "[paths]" > $CODEMGR_WS/.hg
/hgrc
1830 staffer
echo "default=$BRINGOVER_WS" >> $CODEMGR_WS/.hg
/hgrc
1831 touch $TMPDIR/new_repository
1834 typeset
-x HGMERGE
="/bin/false"
1837 # If the user has changes, regardless of whether those changes are
1838 # committed, and regardless of whether those changes conflict, then
1839 # we'll attempt to merge them either implicitly (uncommitted) or
1840 # explicitly (committed).
1842 # These are the messages we'll use to help clarify mercurial output
1845 typeset mergefailmsg
="\
1847 *** nightly was unable to automatically merge your changes. You should\n\
1848 *** redo the full merge manually, following the steps outlined by mercurial\n\
1849 *** above, then restart nightly.\n\
1851 typeset mergepassmsg
="\
1853 *** nightly successfully merged your changes. This means that your working\n\
1854 *** directory has been updated, but those changes are not yet committed.\n\
1855 *** After nightly completes, you should validate the results of the merge,\n\
1856 *** then use hg commit manually.\n\
1860 # For each repository in turn:
1862 # 1. Do the pull. If this fails, dump the output and bail out.
1864 # 2. If the pull resulted in an extra head, do an explicit merge.
1865 # If this fails, dump the output and bail out.
1867 # Because we can't rely on Mercurial to exit with a failure code
1868 # when a merge fails (Mercurial issue #186), we must grep the
1869 # output of pull/merge to check for attempted and/or failed merges.
1871 # 3. If a merge failed, set the message and fail the bringover.
1873 # 4. Otherwise, if a merge succeeded, set the message
1875 # 5. Dump the output, and any message from step 3 or 4.
1878 typeset HG_SOURCE
=$BRINGOVER_WS
1879 if [ ! -f $TMPDIR/new_repository
]; then
1880 HG_SOURCE
=$TMPDIR/open_bundle.hg
1881 staffer hg
--cwd $CODEMGR_WS incoming
--bundle $HG_SOURCE \
1882 -v $BRINGOVER_WS > $TMPDIR/incoming_open.out
1885 # If there are no incoming changesets, then incoming will
1886 # fail, and there will be no bundle file. Reset the source,
1887 # to allow the remaining logic to complete with no false
1888 # negatives. (Unlike incoming, pull will return success
1889 # for the no-change case.)
1891 if (( $?
!= 0 )); then
1892 HG_SOURCE
=$BRINGOVER_WS
1896 staffer hg
--cwd $CODEMGR_WS pull
-u $HG_SOURCE \
1897 > $TMPDIR/pull_open.out
2>&1
1898 if (( $?
!= 0 )); then
1899 printf "%s: pull failed as follows:\n\n" "$CODEMGR_WS"
1900 cat $TMPDIR/pull_open.out
1901 if grep "^merging.*failed" $TMPDIR/pull_open.out
> /dev
/null
2>&1; then
1902 printf "$mergefailmsg"
1904 touch $TMPDIR/bringover_failed
1908 if grep "not updating" $TMPDIR/pull_open.out
> /dev
/null
2>&1; then
1909 staffer hg
--cwd $CODEMGR_WS merge \
1910 >> $TMPDIR/pull_open.out
2>&1
1911 if (( $?
!= 0 )); then
1912 printf "%s: merge failed as follows:\n\n" \
1914 cat $TMPDIR/pull_open.out
1915 if grep "^merging.*failed" $TMPDIR/pull_open.out \
1916 > /dev
/null
2>&1; then
1917 printf "$mergefailmsg"
1919 touch $TMPDIR/bringover_failed
1924 printf "updated %s with the following results:\n" "$CODEMGR_WS"
1925 cat $TMPDIR/pull_open.out
1926 if grep "^merging" $TMPDIR/pull_open.out
>/dev
/null
2>&1; then
1927 printf "$mergepassmsg"
1932 # Per-changeset output is neither useful nor manageable for a
1933 # newly-created repository.
1935 if [ -f $TMPDIR/new_repository
]; then
1939 printf "\nadded the following changesets to open repository:\n"
1940 cat $TMPDIR/incoming_open.out
1943 # The closed repository could have been newly created, even though
1944 # the open one previously existed...
1946 if [ -f $TMPDIR/new_closed
]; then
1950 if [ -f $TMPDIR/incoming_closed.out
]; then
1951 printf "\nadded the following changesets to closed repository:\n"
1952 cat $TMPDIR/incoming_closed.out
1956 type bringover_subversion
> /dev
/null
2>&1 ||
function bringover_subversion
{
1957 typeset
-x PATH
=$PATH
1959 if [[ ! -d $CODEMGR_WS/.svn
]]; then
1960 staffer svn checkout
$BRINGOVER_WS $CODEMGR_WS ||
1961 touch $TMPDIR/bringover_failed
1964 root
=$
(staffer svn info
$CODEMGR_WS |
1965 nawk
'/^Repository Root:/ {print $NF}')
1966 if [[ $root != $BRINGOVER_WS ]]; then
1967 # We fail here because there's no way to update
1968 # from a named repo.
1970 \$BRINGOVER_WS doesn't match repository root:
1971 \$BRINGOVER_WS: $BRINGOVER_WS
1972 Repository root: $root
1974 touch $TMPDIR/bringover_failed
1976 # If a conflict happens, svn still exits 0.
1977 staffer svn update
$CODEMGR_WS |
tee $TMPDIR/pull.out ||
1978 touch $TMPDIR/bringover_failed
1979 if grep "^C" $TMPDIR/pull.out
> /dev
/null
2>&1; then
1980 touch $TMPDIR/bringover_failed
1986 type bringover_none
> /dev
/null
2>&1 ||
function bringover_none
{
1987 echo "Couldn't figure out what kind of SCM to use for $BRINGOVER_WS."
1988 touch $TMPDIR/bringover_failed
1992 # Decide whether to bringover to the codemgr workspace
1994 if [ "$n_FLAG" = "n" ]; then
1995 PARENT_SCM_TYPE
=$
(parent_wstype
)
1997 if [[ $SCM_TYPE != none
&& $SCM_TYPE != $PARENT_SCM_TYPE ]]; then
1998 echo "cannot bringover from $PARENT_SCM_TYPE to $SCM_TYPE, " \
1999 "quitting at `date`." |
tee -a $mail_msg_file >> $LOGFILE
2003 run_hook PRE_BRINGOVER
2005 echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE
2006 echo "\n==== BRINGOVER LOG ====\n" >> $mail_msg_file
2008 eval "bringover_${PARENT_SCM_TYPE}" 2>&1 |
2009 tee -a $mail_msg_file >> $LOGFILE
2011 if [ -f $TMPDIR/bringover_failed
]; then
2012 rm -f $TMPDIR/bringover_failed
2014 echo "trouble with bringover, quitting at `date`." |
2015 tee -a $mail_msg_file >> $LOGFILE
2020 # It's possible that we used the bringover above to create
2021 # $CODEMGR_WS. If so, then SCM_TYPE was previously "none,"
2022 # but should now be the same as $BRINGOVER_WS.
2024 [[ $SCM_TYPE = none
]] && SCM_TYPE
=$PARENT_SCM_TYPE
2026 run_hook POST_BRINGOVER
2031 echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE
2035 [[ -v CODEMGR_WS
]] || fatal_error
"Error: Variable CODEMGR_WS not set."
2036 [[ -d "${CODEMGR_WS}" ]] || fatal_error
"Error: ${CODEMGR_WS} is not a directory."
2037 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error
"Error: ${CODEMGR_WS}/usr/src/Makefile not found."
2039 echo "\n==== Build environment ====\n" |
tee -a $build_environ_file >> $LOGFILE
2042 whence uname |
tee -a $build_environ_file >> $LOGFILE
2043 uname
-a 2>&1 |
tee -a $build_environ_file >> $LOGFILE
2044 echo |
tee -a $build_environ_file >> $LOGFILE
2047 whence
$MAKE |
tee -a $build_environ_file >> $LOGFILE
2048 $MAKE -v |
tee -a $build_environ_file >> $LOGFILE
2049 echo "number of concurrent jobs = $DMAKE_MAX_JOBS" |
2050 tee -a $build_environ_file >> $LOGFILE
2053 # Report the compiler versions.
2056 if [[ ! -f $SRC/Makefile
]]; then
2058 echo "\nUnable to find \"Makefile\" in $SRC." | \
2059 tee -a $build_environ_file >> $LOGFILE
2064 for target
in cc-version cc64-version java-version
; do
2067 # Put statefile somewhere we know we can write to rather than trip
2068 # over a read-only $srcroot.
2070 rm -f $TMPDIR/make-state
2072 if $MAKE -K $TMPDIR/make-state
-e $target 2>/dev
/null
; then
2075 touch $TMPDIR/nocompiler
2078 ) |
tee -a $build_environ_file >> $LOGFILE
2080 if [ -f $TMPDIR/nocompiler
]; then
2081 rm -f $TMPDIR/nocompiler
2083 echo "Aborting due to missing compiler." |
2084 tee -a $build_environ_file >> $LOGFILE
2089 whence as |
tee -a $build_environ_file >> $LOGFILE
2090 as
-V 2>&1 |
head -1 |
tee -a $build_environ_file >> $LOGFILE
2091 echo |
tee -a $build_environ_file >> $LOGFILE
2093 # Check that we're running a capable link-editor
2094 whence ld |
tee -a $build_environ_file >> $LOGFILE
2096 echo $LDVER |
tee -a $build_environ_file >> $LOGFILE
2097 LDVER
=`echo $LDVER | sed -e "s/.*-1\.\([0-9]*\).*/\1/"`
2098 if [ `expr $LDVER \< 422` -eq 1 ]; then
2099 echo "The link-editor needs to be at version 422 or higher to build" | \
2100 tee -a $build_environ_file >> $LOGFILE
2101 echo "the latest stuff. Hope your build works." | \
2102 tee -a $build_environ_file >> $LOGFILE
2106 # Build and use the workspace's tools if requested
2108 if [[ "$t_FLAG" = "y" ]]; then
2109 set_non_debug_build_flags
2111 build_tools
${TOOLS_PROTO}
2112 if [[ $?
!= 0 && "$t_FLAG" = y
]]; then
2113 use_tools
$TOOLS_PROTO
2118 # copy ihv proto area in addition to the build itself
2120 if [ "$X_FLAG" = "y" ]; then
2124 # timestamp the start of the normal build; the findunref tool uses it.
2125 touch $SRC/.build.tstamp
2130 BINARCHIVE
=${CODEMGR_WS}/bin-
${MACH}.
cpio.Z
2134 # There are several checks that need to look at the proto area, but
2135 # they only need to look at one, and they don't care whether it's
2136 # DEBUG or non-DEBUG.
2138 if [[ "$MULTI_PROTO" = yes && "$D_FLAG" = n
]]; then
2144 if [ "$build_ok" = "y" ]; then
2145 echo "\n==== Creating protolist system file at `date` ====" \
2147 protolist
$checkroot > $ATLOG/proto_list_
${MACH}
2148 echo "==== protolist system file created at `date` ====\n" \
2151 if [ "$N_FLAG" != "y" ]; then
2155 if [ -d "$SRC/pkgdefs" ]; then
2156 f1
="$SRC/pkgdefs/etc/exception_list_$MACH"
2157 if [ "$X_FLAG" = "y" ]; then
2158 f1
="$f1 $IA32_IHV_WS/usr/src/pkgdefs/etc/exception_list_$MACH"
2163 if [ -f "$f" ]; then
2170 if [ -d "$SRC/pkg" ]; then
2171 f2
="$f2 exceptions/packaging"
2175 if [ -f "$f" ]; then
2180 if [ -f "$REF_PROTO_LIST" ]; then
2182 # For builds that copy the IHV proto area (-X), add the
2183 # IHV proto list to the reference list if the reference
2184 # was built without -X.
2186 # For builds that don't copy the IHV proto area, add the
2187 # IHV proto list to the build's proto list if the
2188 # reference was built with -X.
2190 # Use the presence of the first file entry of the cached
2191 # IHV proto list in the reference list to determine
2192 # whether it was built with -X or not.
2194 IHV_REF_PROTO_LIST
=$SRC/pkg
/proto_list_ihv_
$MACH
2195 grepfor
=$
(nawk
'$1 == "f" { print $2; exit }' \
2196 $IHV_REF_PROTO_LIST 2> /dev
/null
)
2197 if [ $?
= 0 -a -n "$grepfor" ]; then
2198 if [ "$X_FLAG" = "y" ]; then
2199 grep -w "$grepfor" \
2200 $REF_PROTO_LIST > /dev
/null
2201 if [ ! "$?" = "0" ]; then
2202 REF_IHV_PROTO
="-d $IHV_REF_PROTO_LIST"
2205 grep -w "$grepfor" \
2206 $REF_PROTO_LIST > /dev
/null
2207 if [ "$?" = "0" ]; then
2208 IHV_PROTO_LIST
="$IHV_REF_PROTO_LIST"
2215 if [ "$N_FLAG" != "y" -a -f $SRC/pkgdefs
/Makefile
]; then
2216 echo "\n==== Impact on SVr4 packages ====\n" >> $mail_msg_file
2218 # Compare the build's proto list with current package
2219 # definitions to audit the quality of package
2220 # definitions and makefile install targets. Use the
2221 # current exception list.
2224 for d
in $abssrcdirs; do
2225 if [ -d $d/pkgdefs
]; then
2226 PKGDEFS_LIST
="$PKGDEFS_LIST -d $d/pkgdefs"
2229 if [ "$X_FLAG" = "y" -a \
2230 -d $IA32_IHV_WS/usr
/src
/pkgdefs
]; then
2231 PKGDEFS_LIST
="$PKGDEFS_LIST -d $IA32_IHV_WS/usr/src/pkgdefs"
2234 "Files missing from the proto area:" \
2235 "Files missing from packages:" \
2236 "Inconsistencies between pkgdefs and proto area:" \
2239 $ATLOG/proto_list_
${MACH} \
2243 if [ "$N_FLAG" != "y" -a -d $SRC/pkg
]; then
2244 echo "\n==== Validating manifests against proto area ====\n" \
2246 ( cd $SRC/pkg
; $MAKE -e protocmp ROOT
="$checkroot" ) \
2251 if [ "$N_FLAG" != "y" -a -f "$REF_PROTO_LIST" ]; then
2252 echo "\n==== Impact on proto area ====\n" >> $mail_msg_file
2253 if [ -n "$E2" ]; then
2259 "Files in yesterday's proto area, but not today's:" \
2260 "Files in today's proto area, but not yesterday's:" \
2261 "Files that changed between yesterday and today:" \
2263 -d $REF_PROTO_LIST \
2265 $ATLOG/proto_list_
${MACH} \
2271 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
2272 staffer
cp $ATLOG/proto_list_
${MACH} \
2273 $PARENT_WS/usr
/src
/proto_list_
${MACH}
2276 # Update parent proto area if necessary. This is done now
2277 # so that the proto area has either DEBUG or non-DEBUG kernels.
2278 # Note that this clears out the lock file, so we can dispense with
2280 if [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then
2281 echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \
2282 tee -a $LOGFILE >> $mail_msg_file
2283 rm -rf $NIGHTLY_PARENT_ROOT/*
2285 mkdir
-p $NIGHTLY_PARENT_ROOT
2286 if [[ "$MULTI_PROTO" = no ||
"$D_FLAG" = y
]]; then
2287 ( cd $ROOT; tar cf
- . |
2288 ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf
- ) ) 2>&1 |
2289 tee -a $mail_msg_file >> $LOGFILE
2291 if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n
]]; then
2292 rm -rf $NIGHTLY_PARENT_ROOT-nd/*
2293 mkdir
-p $NIGHTLY_PARENT_ROOT-nd
2296 ( cd $NIGHTLY_PARENT_ROOT-nd; umask 0; tar xpf
- ) ) 2>&1 |
2297 tee -a $mail_msg_file >> $LOGFILE
2299 if [ -n "${NIGHTLY_PARENT_TOOLS_ROOT}" ]; then
2300 echo "\n==== Copying tools proto area to $NIGHTLY_PARENT_TOOLS_ROOT ====\n" | \
2301 tee -a $LOGFILE >> $mail_msg_file
2302 rm -rf $NIGHTLY_PARENT_TOOLS_ROOT/*
2303 mkdir
-p $NIGHTLY_PARENT_TOOLS_ROOT
2304 if [[ "$MULTI_PROTO" = no ||
"$D_FLAG" = y
]]; then
2305 ( cd $TOOLS_PROTO; tar cf
- . |
2306 ( cd $NIGHTLY_PARENT_TOOLS_ROOT;
2307 umask 0; tar xpf
- ) ) 2>&1 |
2308 tee -a $mail_msg_file >> $LOGFILE
2314 # ELF verification: ABI (-A) and runtime (-r) checks
2316 if [[ ($build_ok = y
) && ( ($A_FLAG = y
) ||
($r_FLAG = y
) ) ]]; then
2317 # Directory ELF-data.$MACH holds the files produced by these tests.
2318 elf_ddir
=$SRC/ELF-data.
$MACH
2320 # If there is a previous ELF-data backup directory, remove it. Then,
2321 # rotate current ELF-data directory into its place and create a new
2323 rm -rf $elf_ddir.ref
2324 if [[ -d $elf_ddir ]]; then
2325 mv $elf_ddir $elf_ddir.ref
2329 # Call find_elf to produce a list of the ELF objects in the proto area.
2330 # This list is passed to check_rtime and interface_check, preventing
2331 # them from separately calling find_elf to do the same work twice.
2332 find_elf
-fr $checkroot > $elf_ddir/object_list
2334 if [[ $A_FLAG = y
]]; then
2335 echo "\n==== Check versioning and ABI information ====\n" | \
2336 tee -a $LOGFILE >> $mail_msg_file
2338 # Produce interface description for the proto. Report errors.
2339 interface_check
-o -w $elf_ddir -f object_list \
2340 -i interface
-E interface.err
2341 if [[ -s $elf_ddir/interface.err
]]; then
2342 tee -a $LOGFILE < $elf_ddir/interface.err \
2346 # If ELF_DATA_BASELINE_DIR is defined, compare the new interface
2347 # description file to that from the baseline gate. Issue a
2348 # warning if the baseline is not present, and keep going.
2349 if [[ "$ELF_DATA_BASELINE_DIR" != '' ]]; then
2350 base_ifile
="$ELF_DATA_BASELINE_DIR/interface"
2352 echo "\n==== Compare versioning and ABI information" \
2353 "to baseline ====\n" | \
2354 tee -a $LOGFILE >> $mail_msg_file
2355 echo "Baseline: $base_ifile\n" >> $LOGFILE
2357 if [[ -f $base_ifile ]]; then
2358 interface_cmp
-d -o $base_ifile \
2359 $elf_ddir/interface
> $elf_ddir/interface.
cmp
2360 if [[ -s $elf_ddir/interface.
cmp ]]; then
2361 echo |
tee -a $LOGFILE >> $mail_msg_file
2363 $elf_ddir/interface.
cmp \
2367 echo "baseline not available. comparison" \
2369 tee -a $LOGFILE >> $mail_msg_file
2375 if [[ $r_FLAG = y
]]; then
2376 echo "\n==== Check ELF runtime attributes ====\n" | \
2377 tee -a $LOGFILE >> $mail_msg_file
2379 # If we're doing a DEBUG build the proto area will be left
2380 # with debuggable objects, thus don't assert -s.
2381 if [[ $D_FLAG = y
]]; then
2386 check_rtime
-i -m -v $rtime_sflag -o -w $elf_ddir \
2387 -D object_list
-f object_list
-E runtime.err \
2390 # check_rtime -I output needs to be sorted in order to
2391 # compare it to that from previous builds.
2392 sort $elf_ddir/runtime.attr.raw
> $elf_ddir/runtime.attr
2393 rm $elf_ddir/runtime.attr.raw
2396 if [[ -s $elf_ddir/runtime.err
]]; then
2397 tee -a $LOGFILE < $elf_ddir/runtime.err \
2401 # If there is an ELF-data directory from a previous build,
2402 # then diff the attr files. These files contain information
2403 # about dependencies, versioning, and runpaths. There is some
2404 # overlap with the ABI checking done above, but this also
2405 # flushes out non-ABI interface differences along with the
2406 # other information.
2407 echo "\n==== Diff ELF runtime attributes" \
2408 "(since last build) ====\n" | \
2409 tee -a $LOGFILE >> $mail_msg_file >> $mail_msg_file
2411 if [[ -f $elf_ddir.ref
/runtime.attr
]]; then
2412 diff $elf_ddir.ref
/runtime.attr \
2413 $elf_ddir/runtime.attr \
2418 # If -u set, copy contents of ELF-data.$MACH to the parent workspace.
2419 if [[ "$u_FLAG" = "y" ]]; then
2420 p_elf_ddir
=$PARENT_WS/usr
/src
/ELF-data.
$MACH
2422 # If parent lacks the ELF-data.$MACH directory, create it
2423 if [[ ! -d $p_elf_ddir ]]; then
2424 staffer mkdir
-p $p_elf_ddir
2427 # These files are used asynchronously by other builds for ABI
2428 # verification, as above for the -A option. As such, we require
2429 # the file replacement to be atomic. Copy the data to a temp
2430 # file in the same filesystem and then rename into place.
2433 for elf_dfile
in *; do
2434 staffer
cp $elf_dfile \
2435 ${p_elf_ddir}/${elf_dfile}.new
2436 staffer
mv -f ${p_elf_ddir}/${elf_dfile}.new \
2437 ${p_elf_ddir}/${elf_dfile}
2443 # DEBUG lint of kernel begins
2445 if [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then
2446 if [ "$LINTDIRS" = "" ]; then
2447 # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y"
2451 while [ $# -gt 0 ]; do
2452 dolint
$1 $2; shift; shift
2455 echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE
2458 # "make check" begins
2460 if [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then
2461 # remove old check.out
2462 rm -f $SRC/check.out
2464 rm -f $SRC/check-
${MACH}.out
2466 $MAKE -ek check ROOT
="$checkroot" 2>&1 |
tee -a $SRC/check-
${MACH}.out \
2468 echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file
2470 grep ":" $SRC/check-
${MACH}.out |
2471 egrep -v "Ignoring unknown host" | \
2472 sort |
uniq >> $mail_msg_file
2474 echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE
2477 echo "\n==== Find core files ====\n" | \
2478 tee -a $LOGFILE >> $mail_msg_file
2480 find $abssrcdirs -name core
-a -type f
-exec file {} \
; | \
2481 tee -a $LOGFILE >> $mail_msg_file
2483 if [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then
2484 echo "\n==== Diff unreferenced files (since last build) ====\n" \
2485 |
tee -a $LOGFILE >>$mail_msg_file
2486 rm -f $SRC/unref-
${MACH}.ref
2487 if [ -f $SRC/unref-
${MACH}.out
]; then
2488 mv $SRC/unref-
${MACH}.out
$SRC/unref-
${MACH}.ref
2491 findunref
-S $SCM_TYPE -t $SRC/.build.tstamp
-s usr
$CODEMGR_WS \
2492 ${TOOLS}/findunref
/exception_list
2>> $mail_msg_file | \
2493 sort > $SRC/unref-
${MACH}.out
2495 if [ ! -f $SRC/unref-
${MACH}.ref
]; then
2496 cp $SRC/unref-
${MACH}.out
$SRC/unref-
${MACH}.ref
2499 diff $SRC/unref-
${MACH}.ref
$SRC/unref-
${MACH}.out
>>$mail_msg_file
2503 # Generate the OpenSolaris deliverables if requested. Some of these
2504 # steps need to come after findunref and are commented below.
2507 # Verify that the usual lists of files, such as exception lists,
2508 # contain only valid references to files. If the build has failed,
2509 # then don't check the proto area.
2510 CHECK_PATHS
=${CHECK_PATHS:-y}
2511 if [ "$CHECK_PATHS" = y
-a "$N_FLAG" != y
]; then
2512 echo "\n==== Check lists of files ====\n" |
tee -a $LOGFILE \
2515 [ "$build_ok" = y
] && arg
=
2516 checkpaths
$arg $checkroot 2>&1 |
tee -a $LOGFILE >>$mail_msg_file
2519 if [ "$M_FLAG" != "y" -a "$build_ok" = y
]; then
2520 echo "\n==== Impact on file permissions ====\n" \
2525 for d
in $abssrcdirs; do
2526 if [ -d "$d/pkgdefs" ]; then
2527 abspkgdefs
="$abspkgdefs $d"
2529 if [ -d "$d/pkg" ]; then
2534 if [ -n "$abspkgdefs" ]; then
2536 `find $abspkgdefs -name pkginfo.tmpl -print -o \
2537 -name .del\* -prune | sed -e 's:/pkginfo.tmpl$::' | \
2538 sort -u` >> $mail_msg_file
2541 if [ -n "$abspkg" ]; then
2542 for d
in "$abspkg"; do
2543 ( cd $d/pkg
; $MAKE -e pmodes
) >> $mail_msg_file
2548 if [ "$w_FLAG" = "y" -a "$build_ok" = "y" ]; then
2549 if [[ "$MULTI_PROTO" = no ||
"$D_FLAG" = y
]]; then
2550 do_wsdiff DEBUG
$ROOT.prev
$ROOT
2553 if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n
]]; then
2554 do_wsdiff non-DEBUG
$ROOT-nd.prev
$ROOT-nd
2559 echo "==== Nightly $maketype build completed: $END_DATE ====" | \
2560 tee -a $LOGFILE >> $build_time_file
2566 elapsed_time
=$SECONDS
2567 ((hours
= elapsed_time
/ 3600 ))
2568 ((minutes
= elapsed_time
/ 60 % 60))
2569 ((seconds
= elapsed_time
% 60))
2571 echo "\n==== Total build time ====" | \
2572 tee -a $LOGFILE >> $build_time_file
2573 echo "\nreal ${hours}:${minutes}:${seconds}" | \
2574 tee -a $LOGFILE >> $build_time_file
2576 if [ "$u_FLAG" = "y" -a "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then
2577 staffer
cp ${SRC}/unref-
${MACH}.out
$PARENT_WS/usr
/src
/
2580 # Produce a master list of unreferenced files -- ideally, we'd
2581 # generate the master just once after all of the nightlies
2582 # have finished, but there's no simple way to know when that
2583 # will be. Instead, we assume that we're the last nightly to
2584 # finish and merge all of the unref-${MACH}.out files in
2585 # $PARENT_WS/usr/src/. If we are in fact the final ${MACH} to
2586 # finish, then this file will be the authoritative master
2587 # list. Otherwise, another ${MACH}'s nightly will eventually
2588 # overwrite ours with its own master, but in the meantime our
2589 # temporary "master" will be no worse than any older master
2590 # which was already on the parent.
2593 set -- $PARENT_WS/usr
/src
/unref-
*.out
2594 cp "$1" ${TMPDIR}/unref.merge
2598 comm -12 ${TMPDIR}/unref.merge
"$unreffile" > ${TMPDIR}/unref.$$
2599 mv ${TMPDIR}/unref.$$
${TMPDIR}/unref.merge
2602 staffer
cp ${TMPDIR}/unref.merge
$PARENT_WS/usr
/src
/unrefmaster.out
2606 # All done save for the sweeping up.
2607 # (whichever exit we hit here will trigger the "cleanup" trap which
2608 # optionally sends mail on completion).
2610 if [ "$build_ok" = "y" ]; then