Print this page
4522 the build doesn't fail nearly often enough


 182         export ENVLDLIBS1=`myldlibs $ROOT`
 183         export ENVCPPFLAGS1=`myheaders $ROOT`
 184 
 185         this_build_ok=y
 186         #
 187         #       Build OS-Networking source
 188         #
 189         echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \
 190                 >> $LOGFILE
 191 
 192         rm -f $SRC/${INSTALLOG}.out
 193         cd $SRC
 194         /bin/time $MAKE -e install 2>&1 | \
 195             tee -a $SRC/${INSTALLOG}.out >> $LOGFILE
 196 
 197         echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file
 198         egrep ":" $SRC/${INSTALLOG}.out |
 199                 egrep -e "(^${MAKE}:|[  ]error[:        \n])" | \
 200                 egrep -v "Ignoring unknown host" | \
 201                 egrep -v "cc .* -o error " | \
 202                 egrep -v "warning" >> $mail_msg_file
 203         if [ "$?" = "0" ]; then

 204                 build_ok=n
 205                 this_build_ok=n
 206         fi
 207         grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \
 208                 >> $mail_msg_file
 209         if [ "$?" = "0" ]; then
 210                 build_ok=n
 211                 this_build_ok=n
 212         fi
 213 
 214         echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file
 215         egrep -i warning: $SRC/${INSTALLOG}.out \
 216                 | egrep -v '^tic:' \
 217                 | egrep -v "symbol (\`|')timezone' has differing types:" \
 218                 | egrep -v "parameter <PSTAMP> set to" \
 219                 | egrep -v "Ignoring unknown host" \
 220                 | egrep -v "redefining segment flags attribute for" \
 221                 >> $mail_msg_file




 222 
 223         echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \
 224                 >> $LOGFILE
 225 
 226         echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file
 227         tail -3  $SRC/${INSTALLOG}.out >>$mail_msg_file
 228 
 229         if [ "$i_FLAG" = "n" ]; then
 230                 rm -f $SRC/${NOISE}.ref
 231                 if [ -f $SRC/${NOISE}.out ]; then
 232                         mv $SRC/${NOISE}.out $SRC/${NOISE}.ref
 233                 fi
 234                 grep : $SRC/${INSTALLOG}.out \
 235                         | egrep -v '^/' \
 236                         | egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \
 237                         | egrep -v '^tic:' \
 238                         | egrep -v '^mcs' \
 239                         | egrep -v '^LD_LIBRARY_PATH=' \
 240                         | egrep -v 'ar: creating' \
 241                         | egrep -v 'ar: writing' \


 316         #
 317         if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then
 318                 if [ -d $SRC/pkg ]; then
 319                         echo "\n==== Creating $LABEL packages at `date` ====\n" \
 320                                 >> $LOGFILE
 321                         echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE
 322                         rm -rf $PKGARCHIVE >> "$LOGFILE" 2>&1
 323                         mkdir -p $PKGARCHIVE >> "$LOGFILE" 2>&1
 324 
 325                         rm -f $SRC/pkg/${INSTALLOG}.out
 326                         cd $SRC/pkg
 327                         /bin/time $MAKE -e install 2>&1 | \
 328                             tee -a $SRC/pkg/${INSTALLOG}.out >> $LOGFILE
 329 
 330                         echo "\n==== package build errors ($LABEL) ====\n" \
 331                                 >> $mail_msg_file
 332 
 333                         egrep "${MAKE}|ERROR|WARNING" $SRC/pkg/${INSTALLOG}.out | \
 334                                 grep ':' | \
 335                                 grep -v PSTAMP | \
 336                                 egrep -v "Ignoring unknown host" \
 337                                 >> $mail_msg_file




 338                 else
 339                         #
 340                         # Handle it gracefully if -p was set but there are
 341                         # neither pkg directories.
 342                         #
 343                         echo "\n==== No $LABEL packages to build ====\n" \
 344                                 >> $LOGFILE
 345                 fi
 346         else
 347                 echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE
 348         fi
 349 
 350         ROOT=$ORIGROOT
 351 }
 352 
 353 # Usage: dolint /dir y|n
 354 # Arg. 2 is a flag to turn on/off the lint diff output
 355 function dolint {
 356         if [ ! -d "$1" ]; then
 357                 echo "dolint error: $1 is not a directory"


 378         #
 379         echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
 380 
 381         # remove old lint.out
 382         rm -f $lintdir/lint.out $lintdir/lint-noise.out
 383         if [ -f $lintdir/lint-noise.ref ]; then
 384                 mv $lintdir/lint-noise.ref ${LINTNOISE}.ref
 385         fi
 386 
 387         rm -f $LINTOUT
 388         cd $lintdir
 389         #
 390         # Remove all .ln files to ensure a full reference file
 391         #
 392         rm -f Nothing_to_remove \
 393             `find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \) \
 394                 -prune -o -type f -name '*.ln' -print `
 395 
 396         /bin/time $MAKE -ek lint 2>&1 | \
 397             tee -a $LINTOUT >> $LOGFILE

 398         echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file

 399         grep "$MAKE:" $LINTOUT |
 400                 egrep -v "Ignoring unknown host" \
 401                 >> $mail_msg_file



 402 
 403         echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
 404 
 405         echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \
 406                 >>$mail_msg_file
 407         tail -3  $LINTOUT >>$mail_msg_file
 408 
 409         rm -f ${LINTNOISE}.ref
 410         if [ -f ${LINTNOISE}.out ]; then
 411                 mv ${LINTNOISE}.out ${LINTNOISE}.ref
 412         fi
 413         grep : $LINTOUT | \
 414                 egrep -v '^(real|user|sys)' |
 415                 egrep -v '(library construction)' | \
 416                 egrep -v ': global crosschecks' | \
 417                 egrep -v 'Ignoring unknown host' | \
 418                 egrep -v '\.c:$' | \
 419                 sort | uniq > ${LINTNOISE}.out
 420         if [ ! -f ${LINTNOISE}.ref ]; then
 421                 cp ${LINTNOISE}.out ${LINTNOISE}.ref
 422         fi

 423         if [ "$dodiff" != "n" ]; then
 424                 echo "\n==== lint warnings $base ====\n" \
 425                         >>$mail_msg_file
 426                 # should be none, though there are a few that were filtered out
 427                 # above
 428                 egrep -i '(warning|lint):' ${LINTNOISE}.out \
 429                         | sort | uniq >> $mail_msg_file



 430                 echo "\n==== lint noise differences $base ====\n" \
 431                         >> $mail_msg_file
 432                 diff ${LINTNOISE}.ref ${LINTNOISE}.out \
 433                         >> $mail_msg_file
 434         fi
 435 }
 436 
 437 #
 438 # Build and install the onbld tools.
 439 #
 440 # usage: build_tools DESTROOT
 441 #
 442 # returns non-zero status if the build was successful.
 443 #
 444 function build_tools {
 445         DESTROOT=$1
 446 
 447         INSTALLOG=install-${MACH}
 448 
 449         echo "\n==== Building tools at `date` ====\n" \
 450                 >> $LOGFILE
 451 
 452         rm -f ${TOOLS}/${INSTALLOG}.out
 453         cd ${TOOLS}
 454         /bin/time $MAKE TOOLS_PROTO=${DESTROOT} -e install 2>&1 | \
 455             tee -a ${TOOLS}/${INSTALLOG}.out >> $LOGFILE
 456 
 457         echo "\n==== Tools build errors ====\n" >> $mail_msg_file
 458 
 459         egrep ":" ${TOOLS}/${INSTALLOG}.out |
 460                 egrep -e "(${MAKE}:|[   ]error[:        \n])" | \
 461                 egrep -v "Ignoring unknown host" | \
 462                 egrep -v warning >> $mail_msg_file
 463         return $?




 464 }
 465 
 466 #
 467 # Set up to use locally installed tools.
 468 #
 469 # usage: use_tools TOOLSROOT
 470 #
 471 function use_tools {
 472         TOOLSROOT=$1
 473 
 474         #
 475         # If we're not building ON workspace, then the TOOLSROOT
 476         # settings here are clearly ignored by the workspace
 477         # makefiles, prepending nonexistent directories to PATH is
 478         # harmless, and we clearly do not wish to override
 479         # ONBLD_TOOLS.
 480         #
 481         # If we're building an ON workspace, then the prepended PATH
 482         # elements should supercede the preexisting ONBLD_TOOLS paths,
 483         # and we want to override ONBLD_TOOLS to catch the tools that


 653 A_FLAG=n
 654 C_FLAG=n
 655 D_FLAG=n
 656 F_FLAG=n
 657 f_FLAG=n
 658 i_FLAG=n; i_CMD_LINE_FLAG=n
 659 l_FLAG=n
 660 M_FLAG=n
 661 m_FLAG=n
 662 N_FLAG=n
 663 n_FLAG=n
 664 p_FLAG=n
 665 r_FLAG=n
 666 t_FLAG=y
 667 U_FLAG=n
 668 u_FLAG=n
 669 V_FLAG=n
 670 w_FLAG=n
 671 #
 672 build_ok=y

 673 
 674 #
 675 # examine arguments
 676 #
 677 
 678 OPTIND=1
 679 while getopts +intV: FLAG
 680 do
 681         case $FLAG in
 682           i )   i_FLAG=y; i_CMD_LINE_FLAG=y
 683                 ;;
 684           n )   n_FLAG=y
 685                 ;;
 686          +t )   t_FLAG=n
 687                 ;;
 688           V )   V_FLAG=y
 689                 V_ARG="$OPTARG"
 690                 ;;
 691          \? )   echo "$USAGE"
 692                 exit 1


1133         if [ -s $build_noise_file ]; then
1134                 echo "\n==== Nightly build noise ====\n" |
1135                     tee -a $LOGFILE >>$mail_msg_file
1136                 cat $build_noise_file >>$LOGFILE
1137                 cat $build_noise_file >>$mail_msg_file
1138                 echo | tee -a $LOGFILE >>$mail_msg_file
1139         fi
1140         rm -f $build_noise_file
1141 
1142         case "$build_ok" in
1143                 y)
1144                         state=Completed
1145                         ;;
1146                 i)
1147                         state=Interrupted
1148                         ;;
1149                 *)
1150                         state=Failed
1151                         ;;
1152         esac





1153         NIGHTLY_STATUS=$state
1154         export NIGHTLY_STATUS
1155 
1156         run_hook POST_NIGHTLY $state
1157         run_hook SYS_POST_NIGHTLY $state
1158 
1159         #
1160         # mailx(1) sets From: based on the -r flag
1161         # if it is given.
1162         #
1163         mailx_r=
1164         if [[ -n "${MAILFROM}" ]]; then
1165                 mailx_r="-r ${MAILFROM}"
1166         fi
1167 
1168         cat $build_time_file $build_environ_file $mail_msg_file \
1169             > ${LLOG}/mail_msg
1170         if [ "$m_FLAG" = "y" ]; then
1171                 cat ${LLOG}/mail_msg | /usr/bin/mailx ${mailx_r} -s \
1172         "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \


1478 #
1479 #       Decide whether to clobber
1480 #
1481 if [ "$i_FLAG" = "n" -a -d "$SRC" ]; then
1482         echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE
1483 
1484         cd $SRC
1485         # remove old clobber file
1486         rm -f $SRC/clobber.out
1487         rm -f $SRC/clobber-${MACH}.out
1488 
1489         # Remove all .make.state* files, just in case we are restarting
1490         # the build after having interrupted a previous 'make clobber'.
1491         find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \
1492                 -o -name 'interfaces.*' \) -prune \
1493                 -o -name '.make.*' -print | xargs rm -f
1494 
1495         $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE
1496         echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file
1497         grep "$MAKE:" $SRC/clobber-${MACH}.out |
1498                 egrep -v "Ignoring unknown host" \
1499                 >> $mail_msg_file




1500 
1501         if [[ "$t_FLAG" = "y" ]]; then
1502                 echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE
1503                 cd ${TOOLS}
1504                 rm -f ${TOOLS}/clobber-${MACH}.out
1505                 $MAKE TOOLS_PROTO=$TOOLS_PROTO -ek clobber 2>&1 | \
1506                         tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE
1507                 echo "\n==== Make tools clobber ERRORS ====\n" \
1508                         >> $mail_msg_file
1509                 grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \
1510                         >> $mail_msg_file



1511                 rm -rf ${TOOLS_PROTO}
1512                 mkdir -p ${TOOLS_PROTO}
1513         fi
1514 
1515         typeset roots=$(allprotos)
1516         echo "\n\nClearing $roots" >> "$LOGFILE"
1517         rm -rf $roots
1518 
1519         # Get back to a clean workspace as much as possible to catch
1520         # problems that only occur on fresh workspaces.
1521         # Remove all .make.state* files, libraries, and .o's that may
1522         # have been omitted from clobber.  A couple of libraries are
1523         # under source code control, so leave them alone.
1524         # We should probably blow away temporary directories too.
1525         cd $SRC
1526         find $relsrcdirs \( -name SCCS -o -name .hg -o -name .svn \
1527             -o -name .git -o -name 'interfaces.*' \) -prune -o \
1528             \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \
1529                -name '*.o' \) -print | \
1530             grep -v 'tools/ctf/dwarf/.*/libdwarf' | xargs rm -f


1761 
1762 # Check that we're running a capable link-editor
1763 whence ld | tee -a $build_environ_file >> $LOGFILE
1764 LDVER=`ld -V 2>&1`
1765 echo $LDVER | tee -a $build_environ_file >> $LOGFILE
1766 LDVER=`echo $LDVER | sed -e "s/.*-1\.\([0-9]*\).*/\1/"`
1767 if [ `expr $LDVER \< 422` -eq 1 ]; then
1768         echo "The link-editor needs to be at version 422 or higher to build" | \
1769             tee -a $build_environ_file >> $LOGFILE
1770         echo "the latest stuff.  Hope your build works." | \
1771             tee -a $build_environ_file >> $LOGFILE
1772 fi
1773 
1774 #
1775 # Build and use the workspace's tools if requested
1776 #
1777 if [[ "$t_FLAG" = "y" ]]; then
1778         set_non_debug_build_flags
1779 
1780         build_tools ${TOOLS_PROTO}
1781         if [[ $? != 0  && "$t_FLAG" = y ]]; then


1782                 use_tools $TOOLS_PROTO
1783         fi
1784 fi
1785 
1786 # timestamp the start of the normal build; the findunref tool uses it.
1787 touch $SRC/.build.tstamp
1788 
1789 normal_build
1790 
1791 ORIG_SRC=$SRC
1792 BINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z
1793 
1794 
1795 #
1796 # There are several checks that need to look at the proto area, but
1797 # they only need to look at one, and they don't care whether it's
1798 # DEBUG or non-DEBUG.
1799 #
1800 if [[ "$MULTI_PROTO" = yes && "$D_FLAG" = n ]]; then
1801         checkroot=$ROOT-nd


1819                                 E1="$E1 -e $f"
1820                         fi
1821                 done
1822 
1823                 E2=
1824                 f2=
1825                 if [ -d "$SRC/pkg" ]; then
1826                         f2="$f2 exceptions/packaging"
1827                 fi
1828 
1829                 for f in $f2; do
1830                         if [ -f "$f" ]; then
1831                                 E2="$E2 -e $f"
1832                         fi
1833                 done
1834         fi
1835 
1836         if [ "$N_FLAG" != "y" -a -d $SRC/pkg ]; then
1837                 echo "\n==== Validating manifests against proto area ====\n" \
1838                     >> $mail_msg_file
1839                 ( cd $SRC/pkg ; $MAKE -e protocmp ROOT="$checkroot" ) \
1840                     >> $mail_msg_file
1841 


1842         fi
1843 
1844         if [ "$N_FLAG" != "y" -a -f "$REF_PROTO_LIST" ]; then
1845                 echo "\n==== Impact on proto area ====\n" >> $mail_msg_file
1846                 if [ -n "$E2" ]; then
1847                         ELIST=$E2
1848                 else
1849                         ELIST=$E1
1850                 fi
1851                 $PROTOCMPTERSE \
1852                         "Files in yesterday's proto area, but not today's:" \
1853                         "Files in today's proto area, but not yesterday's:" \
1854                         "Files that changed between yesterday and today:" \
1855                         ${ELIST} \
1856                         -d $REF_PROTO_LIST \
1857                         $ATLOG/proto_list_${MACH} \
1858                         >> $mail_msg_file
1859         fi
1860 fi
1861 
1862 if [ "$u_FLAG" = "y"  -a "$build_ok" = "y" ]; then
1863         staffer cp $ATLOG/proto_list_${MACH} \
1864                 $PARENT_WS/usr/src/proto_list_${MACH}
1865 fi
1866 
1867 # Update parent proto area if necessary. This is done now
1868 # so that the proto area has either DEBUG or non-DEBUG kernels.
1869 # Note that this clears out the lock file, so we can dispense with
1870 # the variable now.
1871 if [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then
1872         echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \
1873             tee -a $LOGFILE >> $mail_msg_file
1874         rm -rf $NIGHTLY_PARENT_ROOT/*
1875         unset Ulockfile
1876         mkdir -p $NIGHTLY_PARENT_ROOT
1877         if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
1878                 ( cd $ROOT; tar cf - . |
1879                     ( cd $NIGHTLY_PARENT_ROOT;  umask 0; tar xpf - ) ) 2>&1 |
1880                     tee -a $mail_msg_file >> $LOGFILE
1881         fi
1882         if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n ]]; then


1887                     ( cd $NIGHTLY_PARENT_ROOT-nd; umask 0; tar xpf - ) ) 2>&1 |
1888                     tee -a $mail_msg_file >> $LOGFILE
1889         fi
1890         if [ -n "${NIGHTLY_PARENT_TOOLS_ROOT}" ]; then
1891                 echo "\n==== Copying tools proto area to $NIGHTLY_PARENT_TOOLS_ROOT ====\n" | \
1892                     tee -a $LOGFILE >> $mail_msg_file
1893                 rm -rf $NIGHTLY_PARENT_TOOLS_ROOT/*
1894                 mkdir -p $NIGHTLY_PARENT_TOOLS_ROOT
1895                 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
1896                         ( cd $TOOLS_PROTO; tar cf - . |
1897                             ( cd $NIGHTLY_PARENT_TOOLS_ROOT; 
1898                             umask 0; tar xpf - ) ) 2>&1 |
1899                             tee -a $mail_msg_file >> $LOGFILE
1900                 fi
1901         fi
1902 fi
1903 
1904 #
1905 # ELF verification: ABI (-A) and runtime (-r) checks
1906 #
1907 if [[ ($build_ok = y) && ( ($A_FLAG = y) || ($r_FLAG = y) ) ]]; then
1908         # Directory ELF-data.$MACH holds the files produced by these tests.
1909         elf_ddir=$SRC/ELF-data.$MACH
1910 
1911         # If there is a previous ELF-data backup directory, remove it. Then,
1912         # rotate current ELF-data directory into its place and create a new
1913         # empty directory
1914         rm -rf $elf_ddir.ref
1915         if [[ -d $elf_ddir ]]; then
1916                 mv $elf_ddir $elf_ddir.ref
1917         fi
1918         mkdir -p $elf_ddir
1919 
1920         # Call find_elf to produce a list of the ELF objects in the proto area.
1921         # This list is passed to check_rtime and interface_check, preventing
1922         # them from separately calling find_elf to do the same work twice.
1923         find_elf -fr $checkroot > $elf_ddir/object_list
1924 
1925         if [[ $A_FLAG = y ]]; then
1926                 echo "\n==== Check versioning and ABI information ====\n"  | \
1927                     tee -a $LOGFILE >> $mail_msg_file
1928 
1929                 # Produce interface description for the proto. Report errors.
1930                 interface_check -o -w $elf_ddir -f object_list \
1931                         -i interface -E interface.err
1932                 if [[ -s $elf_ddir/interface.err ]]; then
1933                         tee -a $LOGFILE < $elf_ddir/interface.err \
1934                                 >> $mail_msg_file

1935                 fi
1936 
1937                 # If ELF_DATA_BASELINE_DIR is defined, compare the new interface
1938                 # description file to that from the baseline gate. Issue a
1939                 # warning if the baseline is not present, and keep going.
1940                 if [[ "$ELF_DATA_BASELINE_DIR" != '' ]]; then
1941                         base_ifile="$ELF_DATA_BASELINE_DIR/interface"
1942 
1943                         echo "\n==== Compare versioning and ABI information" \
1944                             "to baseline ====\n"  | \
1945                             tee -a $LOGFILE >> $mail_msg_file
1946                         echo "Baseline:  $base_ifile\n" >> $LOGFILE
1947 
1948                         if [[ -f $base_ifile ]]; then
1949                                 interface_cmp -d -o $base_ifile \
1950                                     $elf_ddir/interface > $elf_ddir/interface.cmp
1951                                 if [[ -s $elf_ddir/interface.cmp ]]; then
1952                                         echo | tee -a $LOGFILE >> $mail_msg_file
1953                                         tee -a $LOGFILE < \
1954                                             $elf_ddir/interface.cmp \
1955                                             >> $mail_msg_file

1956                                 fi
1957                         else
1958                                 echo "baseline not available. comparison" \
1959                                     "skipped" | \
1960                                     tee -a $LOGFILE >> $mail_msg_file
1961                         fi
1962 
1963                 fi
1964         fi
1965 
1966         if [[ $r_FLAG = y ]]; then
1967                 echo "\n==== Check ELF runtime attributes ====\n" | \
1968                     tee -a $LOGFILE >> $mail_msg_file
1969 
1970                 # If we're doing a DEBUG build the proto area will be left
1971                 # with debuggable objects, thus don't assert -s.
1972                 if [[ $D_FLAG = y ]]; then
1973                         rtime_sflag=""
1974                 else
1975                         rtime_sflag="-s"
1976                 fi
1977                 check_rtime -i -m -v $rtime_sflag -o -w $elf_ddir \
1978                         -D object_list  -f object_list -E runtime.err \
1979                         -I runtime.attr.raw



1980 
1981                 # check_rtime -I output needs to be sorted in order to 
1982                 # compare it to that from previous builds.
1983                 sort $elf_ddir/runtime.attr.raw > $elf_ddir/runtime.attr
1984                 rm $elf_ddir/runtime.attr.raw
1985 
1986                 # Report errors
1987                 if [[ -s $elf_ddir/runtime.err ]]; then
1988                         tee -a $LOGFILE < $elf_ddir/runtime.err \
1989                                 >> $mail_msg_file

1990                 fi
1991 
1992                 # If there is an ELF-data directory from a previous build,
1993                 # then diff the attr files. These files contain information
1994                 # about dependencies, versioning, and runpaths. There is some
1995                 # overlap with the ABI checking done above, but this also
1996                 # flushes out non-ABI interface differences along with the
1997                 # other information.
1998                 echo "\n==== Diff ELF runtime attributes" \
1999                     "(since last build) ====\n" | \
2000                     tee -a $LOGFILE >> $mail_msg_file >> $mail_msg_file
2001 
2002                 if [[ -f $elf_ddir.ref/runtime.attr ]]; then
2003                         diff $elf_ddir.ref/runtime.attr \
2004                                 $elf_ddir/runtime.attr \
2005                                 >> $mail_msg_file
2006                 fi
2007         fi
2008 
2009         # If -u set, copy contents of ELF-data.$MACH to the parent workspace.


2043                 dolint $1 $2; shift; shift
2044         done
2045 else
2046         echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE
2047 fi
2048 
2049 # "make check" begins
2050 
2051 if [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then
2052         # remove old check.out
2053         rm -f $SRC/check.out
2054 
2055         rm -f $SRC/check-${MACH}.out
2056         cd $SRC
2057         $MAKE -ek check ROOT="$checkroot" 2>&1 | tee -a $SRC/check-${MACH}.out \
2058             >> $LOGFILE
2059         echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file
2060 
2061         grep ":" $SRC/check-${MACH}.out |
2062                 egrep -v "Ignoring unknown host" | \
2063                 sort | uniq >> $mail_msg_file




2064 else
2065         echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE
2066 fi
2067 
2068 echo "\n==== Find core files ====\n" | \
2069     tee -a $LOGFILE >> $mail_msg_file
2070 
2071 find $abssrcdirs -name core -a -type f -exec file {} \; | \
2072         tee -a $LOGFILE >> $mail_msg_file
2073 
2074 if [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then
2075         echo "\n==== Diff unreferenced files (since last build) ====\n" \
2076             | tee -a $LOGFILE >>$mail_msg_file
2077         rm -f $SRC/unref-${MACH}.ref
2078         if [ -f $SRC/unref-${MACH}.out ]; then
2079                 mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref
2080         fi
2081 
2082         findunref -S $SCM_TYPE -t $SRC/.build.tstamp -s usr $CODEMGR_WS \
2083             ${TOOLS}/findunref/exception_list 2>> $mail_msg_file | \
2084             sort > $SRC/unref-${MACH}.out
2085 
2086         if [ ! -f $SRC/unref-${MACH}.ref ]; then
2087                 cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref
2088         fi
2089 
2090         diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file
2091 fi
2092 
2093 # Verify that the usual lists of files, such as exception lists,
2094 # contain only valid references to files.  If the build has failed,
2095 # then don't check the proto area.
2096 CHECK_PATHS=${CHECK_PATHS:-y}
2097 if [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then
2098         echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \
2099                 >>$mail_msg_file
2100         arg=-b
2101         [ "$build_ok" = y ] && arg=
2102         checkpaths $arg $checkroot 2>&1 | tee -a $LOGFILE >>$mail_msg_file




2103 fi
2104 
2105 if [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then
2106         echo "\n==== Impact on file permissions ====\n" \
2107                 >> $mail_msg_file
2108 
2109         abspkg=
2110         for d in $abssrcdirs; do
2111                 if [ -d "$d/pkg" ]; then
2112                         abspkg="$abspkg $d"
2113                 fi
2114         done
2115 
2116         if [ -n "$abspkg" ]; then
2117                 for d in "$abspkg"; do
2118                         ( cd $d/pkg ; $MAKE -e pmodes ) >> $mail_msg_file
2119                 done
2120         fi
2121 fi
2122 


2165         # which was already on the parent.
2166         #
2167 
2168         set -- $PARENT_WS/usr/src/unref-*.out
2169         cp "$1" ${TMPDIR}/unref.merge
2170         shift
2171 
2172         for unreffile; do
2173                 comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$
2174                 mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge
2175         done
2176 
2177         staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out
2178 fi
2179 
2180 #
2181 # All done save for the sweeping up.
2182 # (whichever exit we hit here will trigger the "cleanup" trap which
2183 # optionally sends mail on completion).
2184 #
2185 if [ "$build_ok" = "y" ]; then
2186         exit 0
2187 fi
2188 exit 1


 182         export ENVLDLIBS1=`myldlibs $ROOT`
 183         export ENVCPPFLAGS1=`myheaders $ROOT`
 184 
 185         this_build_ok=y
 186         #
 187         #       Build OS-Networking source
 188         #
 189         echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \
 190                 >> $LOGFILE
 191 
 192         rm -f $SRC/${INSTALLOG}.out
 193         cd $SRC
 194         /bin/time $MAKE -e install 2>&1 | \
 195             tee -a $SRC/${INSTALLOG}.out >> $LOGFILE
 196 
 197         echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file
 198         egrep ":" $SRC/${INSTALLOG}.out |
 199                 egrep -e "(^${MAKE}:|[  ]error[:        \n])" | \
 200                 egrep -v "Ignoring unknown host" | \
 201                 egrep -v "cc .* -o error " | \
 202                 egrep -v "warning" | tee $TMPDIR/build_errs${SUFFIX} \
 203                 >> $mail_msg_file
 204         if [[ -s $TMPDIR/build_errs${SUFFIX} ]]; then
 205                 build_ok=n
 206                 this_build_ok=n
 207         fi
 208         grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \
 209                 >> $mail_msg_file
 210         if [ "$?" = "0" ]; then
 211                 build_ok=n
 212                 this_build_ok=n
 213         fi
 214 
 215         echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file
 216         egrep -i warning: $SRC/${INSTALLOG}.out \
 217                 | egrep -v '^tic:' \
 218                 | egrep -v "symbol (\`|')timezone' has differing types:" \
 219                 | egrep -v "parameter <PSTAMP> set to" \
 220                 | egrep -v "Ignoring unknown host" \
 221                 | egrep -v "redefining segment flags attribute for" \
 222                 | tee $TMPDIR/build_warnings${SUFFIX} >> $mail_msg_file
 223         if [[ -s $TMPDIR/build_warnings${SUFFIX} ]]; then
 224                 build_ok=n
 225                 this_build_ok=n
 226         fi
 227 
 228         echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \
 229                 >> $LOGFILE
 230 
 231         echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file
 232         tail -3  $SRC/${INSTALLOG}.out >>$mail_msg_file
 233 
 234         if [ "$i_FLAG" = "n" ]; then
 235                 rm -f $SRC/${NOISE}.ref
 236                 if [ -f $SRC/${NOISE}.out ]; then
 237                         mv $SRC/${NOISE}.out $SRC/${NOISE}.ref
 238                 fi
 239                 grep : $SRC/${INSTALLOG}.out \
 240                         | egrep -v '^/' \
 241                         | egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \
 242                         | egrep -v '^tic:' \
 243                         | egrep -v '^mcs' \
 244                         | egrep -v '^LD_LIBRARY_PATH=' \
 245                         | egrep -v 'ar: creating' \
 246                         | egrep -v 'ar: writing' \


 321         #
 322         if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then
 323                 if [ -d $SRC/pkg ]; then
 324                         echo "\n==== Creating $LABEL packages at `date` ====\n" \
 325                                 >> $LOGFILE
 326                         echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE
 327                         rm -rf $PKGARCHIVE >> "$LOGFILE" 2>&1
 328                         mkdir -p $PKGARCHIVE >> "$LOGFILE" 2>&1
 329 
 330                         rm -f $SRC/pkg/${INSTALLOG}.out
 331                         cd $SRC/pkg
 332                         /bin/time $MAKE -e install 2>&1 | \
 333                             tee -a $SRC/pkg/${INSTALLOG}.out >> $LOGFILE
 334 
 335                         echo "\n==== package build errors ($LABEL) ====\n" \
 336                                 >> $mail_msg_file
 337 
 338                         egrep "${MAKE}|ERROR|WARNING" $SRC/pkg/${INSTALLOG}.out | \
 339                                 grep ':' | \
 340                                 grep -v PSTAMP | \
 341                                 egrep -v "Ignoring unknown host" | \
 342                                 tee $TMPDIR/package >> $mail_msg_file
 343                         if [[ -s $TMPDIR/package ]]; then
 344                                 build_extras_ok=n
 345                                 this_build_ok=n
 346                         fi
 347                 else
 348                         #
 349                         # Handle it gracefully if -p was set but there are
 350                         # neither pkg directories.
 351                         #
 352                         echo "\n==== No $LABEL packages to build ====\n" \
 353                                 >> $LOGFILE
 354                 fi
 355         else
 356                 echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE
 357         fi
 358 
 359         ROOT=$ORIGROOT
 360 }
 361 
 362 # Usage: dolint /dir y|n
 363 # Arg. 2 is a flag to turn on/off the lint diff output
 364 function dolint {
 365         if [ ! -d "$1" ]; then
 366                 echo "dolint error: $1 is not a directory"


 387         #
 388         echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
 389 
 390         # remove old lint.out
 391         rm -f $lintdir/lint.out $lintdir/lint-noise.out
 392         if [ -f $lintdir/lint-noise.ref ]; then
 393                 mv $lintdir/lint-noise.ref ${LINTNOISE}.ref
 394         fi
 395 
 396         rm -f $LINTOUT
 397         cd $lintdir
 398         #
 399         # Remove all .ln files to ensure a full reference file
 400         #
 401         rm -f Nothing_to_remove \
 402             `find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \) \
 403                 -prune -o -type f -name '*.ln' -print `
 404 
 405         /bin/time $MAKE -ek lint 2>&1 | \
 406             tee -a $LINTOUT >> $LOGFILE
 407 
 408         echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file
 409 
 410         grep "$MAKE:" $LINTOUT |
 411                 egrep -v "Ignoring unknown host" | \
 412                 tee $TMPDIR/lint_errs >> $mail_msg_file
 413         if [[ -s $TMPDIR/lint_errs ]]; then
 414                 build_extras_ok=n
 415         fi
 416 
 417         echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
 418 
 419         echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \
 420                 >>$mail_msg_file
 421         tail -3  $LINTOUT >>$mail_msg_file
 422 
 423         rm -f ${LINTNOISE}.ref
 424         if [ -f ${LINTNOISE}.out ]; then
 425                 mv ${LINTNOISE}.out ${LINTNOISE}.ref
 426         fi
 427         grep : $LINTOUT | \
 428                 egrep -v '^(real|user|sys)' |
 429                 egrep -v '(library construction)' | \
 430                 egrep -v ': global crosschecks' | \
 431                 egrep -v 'Ignoring unknown host' | \
 432                 egrep -v '\.c:$' | \
 433                 sort | uniq > ${LINTNOISE}.out
 434         if [ ! -f ${LINTNOISE}.ref ]; then
 435                 cp ${LINTNOISE}.out ${LINTNOISE}.ref
 436         fi
 437 
 438         if [ "$dodiff" != "n" ]; then
 439                 echo "\n==== lint warnings $base ====\n" \
 440                         >>$mail_msg_file
 441                 # should be none, though there are a few that were filtered out
 442                 # above
 443                 egrep -i '(warning|lint):' ${LINTNOISE}.out \
 444                         | sort | uniq | tee $TMPDIR/lint_warns >> $mail_msg_file
 445                 if [[ -s $TMPDIR/lint_warns ]]; then
 446                         build_extras_ok=n
 447                 fi
 448                 echo "\n==== lint noise differences $base ====\n" \
 449                         >> $mail_msg_file
 450                 diff ${LINTNOISE}.ref ${LINTNOISE}.out \
 451                         >> $mail_msg_file
 452         fi
 453 }
 454 
 455 #
 456 # Build and install the onbld tools.
 457 #
 458 # usage: build_tools DESTROOT
 459 #
 460 # returns non-zero status if the build was successful.
 461 #
 462 function build_tools {
 463         DESTROOT=$1
 464 
 465         INSTALLOG=install-${MACH}
 466 
 467         echo "\n==== Building tools at `date` ====\n" \
 468                 >> $LOGFILE
 469 
 470         rm -f ${TOOLS}/${INSTALLOG}.out
 471         cd ${TOOLS}
 472         /bin/time $MAKE TOOLS_PROTO=${DESTROOT} -e install 2>&1 | \
 473             tee -a ${TOOLS}/${INSTALLOG}.out >> $LOGFILE
 474 
 475         echo "\n==== Tools build errors ====\n" >> $mail_msg_file
 476 
 477         egrep ":" ${TOOLS}/${INSTALLOG}.out |
 478                 egrep -e "(${MAKE}:|[   ]error[:        \n])" | \
 479                 egrep -v "Ignoring unknown host" | \
 480                 egrep -v warning | tee $TMPDIR/tools_errors >> $mail_msg_file
 481 
 482         if [[ -s $TMPDIR/tools_errors ]]; then
 483                 return 1
 484         fi
 485         return 0
 486 }
 487 
 488 #
 489 # Set up to use locally installed tools.
 490 #
 491 # usage: use_tools TOOLSROOT
 492 #
 493 function use_tools {
 494         TOOLSROOT=$1
 495 
 496         #
 497         # If we're not building ON workspace, then the TOOLSROOT
 498         # settings here are clearly ignored by the workspace
 499         # makefiles, prepending nonexistent directories to PATH is
 500         # harmless, and we clearly do not wish to override
 501         # ONBLD_TOOLS.
 502         #
 503         # If we're building an ON workspace, then the prepended PATH
 504         # elements should supercede the preexisting ONBLD_TOOLS paths,
 505         # and we want to override ONBLD_TOOLS to catch the tools that


 675 A_FLAG=n
 676 C_FLAG=n
 677 D_FLAG=n
 678 F_FLAG=n
 679 f_FLAG=n
 680 i_FLAG=n; i_CMD_LINE_FLAG=n
 681 l_FLAG=n
 682 M_FLAG=n
 683 m_FLAG=n
 684 N_FLAG=n
 685 n_FLAG=n
 686 p_FLAG=n
 687 r_FLAG=n
 688 t_FLAG=y
 689 U_FLAG=n
 690 u_FLAG=n
 691 V_FLAG=n
 692 w_FLAG=n
 693 #
 694 build_ok=y
 695 build_extras_ok=y
 696 
 697 #
 698 # examine arguments
 699 #
 700 
 701 OPTIND=1
 702 while getopts +intV: FLAG
 703 do
 704         case $FLAG in
 705           i )   i_FLAG=y; i_CMD_LINE_FLAG=y
 706                 ;;
 707           n )   n_FLAG=y
 708                 ;;
 709          +t )   t_FLAG=n
 710                 ;;
 711           V )   V_FLAG=y
 712                 V_ARG="$OPTARG"
 713                 ;;
 714          \? )   echo "$USAGE"
 715                 exit 1


1156         if [ -s $build_noise_file ]; then
1157                 echo "\n==== Nightly build noise ====\n" |
1158                     tee -a $LOGFILE >>$mail_msg_file
1159                 cat $build_noise_file >>$LOGFILE
1160                 cat $build_noise_file >>$mail_msg_file
1161                 echo | tee -a $LOGFILE >>$mail_msg_file
1162         fi
1163         rm -f $build_noise_file
1164 
1165         case "$build_ok" in
1166                 y)
1167                         state=Completed
1168                         ;;
1169                 i)
1170                         state=Interrupted
1171                         ;;
1172                 *)
1173                         state=Failed
1174                         ;;
1175         esac
1176 
1177         if [[ $state != "Interrupted" && $build_extras_ok != "y" ]]; then
1178                 state=Failed
1179         fi
1180 
1181         NIGHTLY_STATUS=$state
1182         export NIGHTLY_STATUS
1183 
1184         run_hook POST_NIGHTLY $state
1185         run_hook SYS_POST_NIGHTLY $state
1186 
1187         #
1188         # mailx(1) sets From: based on the -r flag
1189         # if it is given.
1190         #
1191         mailx_r=
1192         if [[ -n "${MAILFROM}" ]]; then
1193                 mailx_r="-r ${MAILFROM}"
1194         fi
1195 
1196         cat $build_time_file $build_environ_file $mail_msg_file \
1197             > ${LLOG}/mail_msg
1198         if [ "$m_FLAG" = "y" ]; then
1199                 cat ${LLOG}/mail_msg | /usr/bin/mailx ${mailx_r} -s \
1200         "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \


1506 #
1507 #       Decide whether to clobber
1508 #
1509 if [ "$i_FLAG" = "n" -a -d "$SRC" ]; then
1510         echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE
1511 
1512         cd $SRC
1513         # remove old clobber file
1514         rm -f $SRC/clobber.out
1515         rm -f $SRC/clobber-${MACH}.out
1516 
1517         # Remove all .make.state* files, just in case we are restarting
1518         # the build after having interrupted a previous 'make clobber'.
1519         find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \
1520                 -o -name 'interfaces.*' \) -prune \
1521                 -o -name '.make.*' -print | xargs rm -f
1522 
1523         $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE
1524         echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file
1525         grep "$MAKE:" $SRC/clobber-${MACH}.out |
1526                 egrep -v "Ignoring unknown host" | \
1527                 tee $TMPDIR/clobber_errs >> $mail_msg_file
1528 
1529         if [[ -s $TMPDIR/clobber_errs ]]; then
1530                 build_extras_ok=n
1531         fi
1532 
1533         if [[ "$t_FLAG" = "y" ]]; then
1534                 echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE
1535                 cd ${TOOLS}
1536                 rm -f ${TOOLS}/clobber-${MACH}.out
1537                 $MAKE TOOLS_PROTO=$TOOLS_PROTO -ek clobber 2>&1 | \
1538                         tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE
1539                 echo "\n==== Make tools clobber ERRORS ====\n" \
1540                         >> $mail_msg_file
1541                 grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \
1542                         >> $mail_msg_file
1543                 if (( $? == 0 )); then
1544                         build_extras_ok=n
1545                 fi
1546                 rm -rf ${TOOLS_PROTO}
1547                 mkdir -p ${TOOLS_PROTO}
1548         fi
1549 
1550         typeset roots=$(allprotos)
1551         echo "\n\nClearing $roots" >> "$LOGFILE"
1552         rm -rf $roots
1553 
1554         # Get back to a clean workspace as much as possible to catch
1555         # problems that only occur on fresh workspaces.
1556         # Remove all .make.state* files, libraries, and .o's that may
1557         # have been omitted from clobber.  A couple of libraries are
1558         # under source code control, so leave them alone.
1559         # We should probably blow away temporary directories too.
1560         cd $SRC
1561         find $relsrcdirs \( -name SCCS -o -name .hg -o -name .svn \
1562             -o -name .git -o -name 'interfaces.*' \) -prune -o \
1563             \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \
1564                -name '*.o' \) -print | \
1565             grep -v 'tools/ctf/dwarf/.*/libdwarf' | xargs rm -f


1796 
1797 # Check that we're running a capable link-editor
1798 whence ld | tee -a $build_environ_file >> $LOGFILE
1799 LDVER=`ld -V 2>&1`
1800 echo $LDVER | tee -a $build_environ_file >> $LOGFILE
1801 LDVER=`echo $LDVER | sed -e "s/.*-1\.\([0-9]*\).*/\1/"`
1802 if [ `expr $LDVER \< 422` -eq 1 ]; then
1803         echo "The link-editor needs to be at version 422 or higher to build" | \
1804             tee -a $build_environ_file >> $LOGFILE
1805         echo "the latest stuff.  Hope your build works." | \
1806             tee -a $build_environ_file >> $LOGFILE
1807 fi
1808 
1809 #
1810 # Build and use the workspace's tools if requested
1811 #
1812 if [[ "$t_FLAG" = "y" ]]; then
1813         set_non_debug_build_flags
1814 
1815         build_tools ${TOOLS_PROTO}
1816         if (( $? != 0 )); then
1817                 build_ok=n
1818         else
1819                 use_tools $TOOLS_PROTO
1820         fi
1821 fi
1822 
1823 # timestamp the start of the normal build; the findunref tool uses it.
1824 touch $SRC/.build.tstamp
1825 
1826 normal_build
1827 
1828 ORIG_SRC=$SRC
1829 BINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z
1830 
1831 
1832 #
1833 # There are several checks that need to look at the proto area, but
1834 # they only need to look at one, and they don't care whether it's
1835 # DEBUG or non-DEBUG.
1836 #
1837 if [[ "$MULTI_PROTO" = yes && "$D_FLAG" = n ]]; then
1838         checkroot=$ROOT-nd


1856                                 E1="$E1 -e $f"
1857                         fi
1858                 done
1859 
1860                 E2=
1861                 f2=
1862                 if [ -d "$SRC/pkg" ]; then
1863                         f2="$f2 exceptions/packaging"
1864                 fi
1865 
1866                 for f in $f2; do
1867                         if [ -f "$f" ]; then
1868                                 E2="$E2 -e $f"
1869                         fi
1870                 done
1871         fi
1872 
1873         if [ "$N_FLAG" != "y" -a -d $SRC/pkg ]; then
1874                 echo "\n==== Validating manifests against proto area ====\n" \
1875                     >> $mail_msg_file
1876                 ( cd $SRC/pkg ; $MAKE -e protocmp ROOT="$checkroot" ) | \
1877                     tee $TMPDIR/protocmp_noise >> $mail_msg_file
1878                 if [[ -s $TMPDIR/protocmp_noise ]]; then
1879                         build_extras_ok=n
1880                 fi
1881         fi
1882 
1883         if [ "$N_FLAG" != "y" -a -f "$REF_PROTO_LIST" ]; then
1884                 echo "\n==== Impact on proto area ====\n" >> $mail_msg_file
1885                 if [ -n "$E2" ]; then
1886                         ELIST=$E2
1887                 else
1888                         ELIST=$E1
1889                 fi
1890                 $PROTOCMPTERSE \
1891                         "Files in yesterday's proto area, but not today's:" \
1892                         "Files in today's proto area, but not yesterday's:" \
1893                         "Files that changed between yesterday and today:" \
1894                         ${ELIST} \
1895                         -d $REF_PROTO_LIST \
1896                         $ATLOG/proto_list_${MACH} \
1897                         >> $mail_msg_file
1898         fi
1899 fi
1900 
1901 if [ "$u_FLAG" = "y"  -a "$build_ok" = "y" -a "$build_extras_ok" = "y" ]; then
1902         staffer cp $ATLOG/proto_list_${MACH} \
1903                 $PARENT_WS/usr/src/proto_list_${MACH}
1904 fi
1905 
1906 # Update parent proto area if necessary. This is done now
1907 # so that the proto area has either DEBUG or non-DEBUG kernels.
1908 # Note that this clears out the lock file, so we can dispense with
1909 # the variable now.
1910 if [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then
1911         echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \
1912             tee -a $LOGFILE >> $mail_msg_file
1913         rm -rf $NIGHTLY_PARENT_ROOT/*
1914         unset Ulockfile
1915         mkdir -p $NIGHTLY_PARENT_ROOT
1916         if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
1917                 ( cd $ROOT; tar cf - . |
1918                     ( cd $NIGHTLY_PARENT_ROOT;  umask 0; tar xpf - ) ) 2>&1 |
1919                     tee -a $mail_msg_file >> $LOGFILE
1920         fi
1921         if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n ]]; then


1926                     ( cd $NIGHTLY_PARENT_ROOT-nd; umask 0; tar xpf - ) ) 2>&1 |
1927                     tee -a $mail_msg_file >> $LOGFILE
1928         fi
1929         if [ -n "${NIGHTLY_PARENT_TOOLS_ROOT}" ]; then
1930                 echo "\n==== Copying tools proto area to $NIGHTLY_PARENT_TOOLS_ROOT ====\n" | \
1931                     tee -a $LOGFILE >> $mail_msg_file
1932                 rm -rf $NIGHTLY_PARENT_TOOLS_ROOT/*
1933                 mkdir -p $NIGHTLY_PARENT_TOOLS_ROOT
1934                 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
1935                         ( cd $TOOLS_PROTO; tar cf - . |
1936                             ( cd $NIGHTLY_PARENT_TOOLS_ROOT; 
1937                             umask 0; tar xpf - ) ) 2>&1 |
1938                             tee -a $mail_msg_file >> $LOGFILE
1939                 fi
1940         fi
1941 fi
1942 
1943 #
1944 # ELF verification: ABI (-A) and runtime (-r) checks
1945 #
1946 if [[ ($build_ok = y) && (($A_FLAG = y) || ($r_FLAG = y)) ]]; then
1947         # Directory ELF-data.$MACH holds the files produced by these tests.
1948         elf_ddir=$SRC/ELF-data.$MACH
1949 
1950         # If there is a previous ELF-data backup directory, remove it. Then,
1951         # rotate current ELF-data directory into its place and create a new
1952         # empty directory
1953         rm -rf $elf_ddir.ref
1954         if [[ -d $elf_ddir ]]; then
1955                 mv $elf_ddir $elf_ddir.ref
1956         fi
1957         mkdir -p $elf_ddir
1958 
1959         # Call find_elf to produce a list of the ELF objects in the proto area.
1960         # This list is passed to check_rtime and interface_check, preventing
1961         # them from separately calling find_elf to do the same work twice.
1962         find_elf -fr $checkroot > $elf_ddir/object_list
1963 
1964         if [[ $A_FLAG = y ]]; then
1965                 echo "\n==== Check versioning and ABI information ====\n"  | \
1966                     tee -a $LOGFILE >> $mail_msg_file
1967 
1968                 # Produce interface description for the proto. Report errors.
1969                 interface_check -o -w $elf_ddir -f object_list \
1970                         -i interface -E interface.err
1971                 if [[ -s $elf_ddir/interface.err ]]; then
1972                         tee -a $LOGFILE < $elf_ddir/interface.err \
1973                             >> $mail_msg_file
1974                         build_extras_ok=n
1975                 fi
1976 
1977                 # If ELF_DATA_BASELINE_DIR is defined, compare the new interface
1978                 # description file to that from the baseline gate. Issue a
1979                 # warning if the baseline is not present, and keep going.
1980                 if [[ "$ELF_DATA_BASELINE_DIR" != '' ]]; then
1981                         base_ifile="$ELF_DATA_BASELINE_DIR/interface"
1982 
1983                         echo "\n==== Compare versioning and ABI information" \
1984                             "to baseline ====\n"  | \
1985                             tee -a $LOGFILE >> $mail_msg_file
1986                         echo "Baseline:  $base_ifile\n" >> $LOGFILE
1987 
1988                         if [[ -f $base_ifile ]]; then
1989                                 interface_cmp -d -o $base_ifile \
1990                                     $elf_ddir/interface > $elf_ddir/interface.cmp
1991                                 if [[ -s $elf_ddir/interface.cmp ]]; then
1992                                         echo | tee -a $LOGFILE >> $mail_msg_file
1993                                         tee -a $LOGFILE < \
1994                                             $elf_ddir/interface.cmp \
1995                                             >> $mail_msg_file
1996                                         build_extras_ok=n
1997                                 fi
1998                         else
1999                                 echo "baseline not available. comparison" \
2000                                     "skipped" | \
2001                                     tee -a $LOGFILE >> $mail_msg_file
2002                         fi
2003 
2004                 fi
2005         fi
2006 
2007         if [[ $r_FLAG = y ]]; then
2008                 echo "\n==== Check ELF runtime attributes ====\n" | \
2009                     tee -a $LOGFILE >> $mail_msg_file
2010 
2011                 # If we're doing a DEBUG build the proto area will be left
2012                 # with debuggable objects, thus don't assert -s.
2013                 if [[ $D_FLAG = y ]]; then
2014                         rtime_sflag=""
2015                 else
2016                         rtime_sflag="-s"
2017                 fi
2018                 check_rtime -i -m -v $rtime_sflag -o -w $elf_ddir \
2019                         -D object_list  -f object_list -E runtime.err \
2020                         -I runtime.attr.raw
2021                 if (( "$?" != 0 )); then
2022                         build_extras_ok=n
2023                 fi
2024 
2025                 # check_rtime -I output needs to be sorted in order to 
2026                 # compare it to that from previous builds.
2027                 sort $elf_ddir/runtime.attr.raw > $elf_ddir/runtime.attr
2028                 rm $elf_ddir/runtime.attr.raw
2029 
2030                 # Report errors
2031                 if [[ -s $elf_ddir/runtime.err ]]; then
2032                         tee -a $LOGFILE < $elf_ddir/runtime.err \
2033                                 >> $mail_msg_file
2034                         build_extras_ok=n
2035                 fi
2036 
2037                 # If there is an ELF-data directory from a previous build,
2038                 # then diff the attr files. These files contain information
2039                 # about dependencies, versioning, and runpaths. There is some
2040                 # overlap with the ABI checking done above, but this also
2041                 # flushes out non-ABI interface differences along with the
2042                 # other information.
2043                 echo "\n==== Diff ELF runtime attributes" \
2044                     "(since last build) ====\n" | \
2045                     tee -a $LOGFILE >> $mail_msg_file >> $mail_msg_file
2046 
2047                 if [[ -f $elf_ddir.ref/runtime.attr ]]; then
2048                         diff $elf_ddir.ref/runtime.attr \
2049                                 $elf_ddir/runtime.attr \
2050                                 >> $mail_msg_file
2051                 fi
2052         fi
2053 
2054         # If -u set, copy contents of ELF-data.$MACH to the parent workspace.


2088                 dolint $1 $2; shift; shift
2089         done
2090 else
2091         echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE
2092 fi
2093 
2094 # "make check" begins
2095 
2096 if [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then
2097         # remove old check.out
2098         rm -f $SRC/check.out
2099 
2100         rm -f $SRC/check-${MACH}.out
2101         cd $SRC
2102         $MAKE -ek check ROOT="$checkroot" 2>&1 | tee -a $SRC/check-${MACH}.out \
2103             >> $LOGFILE
2104         echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file
2105 
2106         grep ":" $SRC/check-${MACH}.out |
2107                 egrep -v "Ignoring unknown host" | \
2108                 sort | uniq | tee $TMPDIR/check_errors >> $mail_msg_file
2109 
2110         if [[ -s $TMPDIR/check_errors ]]; then
2111                 build_extras_ok=n
2112         fi
2113 else
2114         echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE
2115 fi
2116 
2117 echo "\n==== Find core files ====\n" | \
2118     tee -a $LOGFILE >> $mail_msg_file
2119 
2120 find $abssrcdirs -name core -a -type f -exec file {} \; | \
2121         tee -a $LOGFILE >> $mail_msg_file
2122 
2123 if [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then
2124         echo "\n==== Diff unreferenced files (since last build) ====\n" \
2125             | tee -a $LOGFILE >>$mail_msg_file
2126         rm -f $SRC/unref-${MACH}.ref
2127         if [ -f $SRC/unref-${MACH}.out ]; then
2128                 mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref
2129         fi
2130 
2131         findunref -S $SCM_TYPE -t $SRC/.build.tstamp -s usr $CODEMGR_WS \
2132             ${TOOLS}/findunref/exception_list 2>> $mail_msg_file | \
2133             sort > $SRC/unref-${MACH}.out
2134 
2135         if [ ! -f $SRC/unref-${MACH}.ref ]; then
2136                 cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref
2137         fi
2138 
2139         diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file
2140 fi
2141 
2142 # Verify that the usual lists of files, such as exception lists,
2143 # contain only valid references to files.  If the build has failed,
2144 # then don't check the proto area.
2145 CHECK_PATHS=${CHECK_PATHS:-y}
2146 if [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then
2147         echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \
2148                 >>$mail_msg_file
2149         arg=-b
2150         [ "$build_ok" = y ] && arg=
2151         checkpaths $arg $checkroot > $SRC/checkpaths.out 2>&1
2152         if [[ -s $SRC/checkpaths.out ]]; then
2153                 tee -a $LOGFILE < $SRC/checkpaths.out >> $mail_msg_file
2154                 build_extras_ok=n
2155         fi
2156 fi
2157 
2158 if [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then
2159         echo "\n==== Impact on file permissions ====\n" \
2160                 >> $mail_msg_file
2161 
2162         abspkg=
2163         for d in $abssrcdirs; do
2164                 if [ -d "$d/pkg" ]; then
2165                         abspkg="$abspkg $d"
2166                 fi
2167         done
2168 
2169         if [ -n "$abspkg" ]; then
2170                 for d in "$abspkg"; do
2171                         ( cd $d/pkg ; $MAKE -e pmodes ) >> $mail_msg_file
2172                 done
2173         fi
2174 fi
2175 


2218         # which was already on the parent.
2219         #
2220 
2221         set -- $PARENT_WS/usr/src/unref-*.out
2222         cp "$1" ${TMPDIR}/unref.merge
2223         shift
2224 
2225         for unreffile; do
2226                 comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$
2227                 mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge
2228         done
2229 
2230         staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out
2231 fi
2232 
2233 #
2234 # All done save for the sweeping up.
2235 # (whichever exit we hit here will trigger the "cleanup" trap which
2236 # optionally sends mail on completion).
2237 #
2238 if [[ "$build_ok" == "y" && "$build_extras_ok" == "y" ]]; then
2239         exit 0
2240 fi
2241 exit 1