Print this page
4027 remove CLOSED_BUILD
4028 remove CLOSED_IS_PRESENT
4029 remove tonic build bits
Reviewed by: Andy Stormont <andyjstormont@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/scripts/nightly.sh
          +++ new/usr/src/tools/scripts/nightly.sh
↓ open down ↓ 286 lines elided ↑ open up ↑
 287  287                  echo "Tree copy is not supported for workspace type" \
 288  288                      "$SCM_TYPE" | tee -a $mail_msg_file >> $LOGFILE
 289  289                  return 1
 290  290                  ;;
 291  291          esac
 292  292  
 293  293          return 0
 294  294  }
 295  295  
 296  296  #
 297      -# Mercurial-specific copy code for copy_source().  Handles the
 298      -# combined open and closed trees.
      297 +# Mercurial-specific copy code for copy_source().
 299  298  #
 300  299  # Returns 0 for success, non-zero for failure.
 301  300  #
 302  301  # usage: copy_source_mercurial destdir srcroot
 303  302  #
 304  303  function copy_source_mercurial {
 305  304          typeset dest=$1
 306  305          typeset srcroot=$2
 307      -        typeset open_top closed_top
 308  306  
 309      -        case $srcroot in
 310      -        usr)
 311      -                open_top=usr
 312      -                if [[ "$CLOSED_IS_PRESENT" = yes ]]; then
 313      -                        closed_top=usr/closed
 314      -                fi
 315      -                ;;
 316      -        usr/closed*)
 317      -                if [[ "$CLOSED_IS_PRESENT" = no ]]; then
 318      -                        printf "can't copy %s: closed tree not present.\n" \
 319      -                            "$srcroot" | tee -a $mail_msg_file >> $LOGFILE
 320      -                        return 1
 321      -                fi
 322      -                closed_top="$srcroot"
 323      -                ;;
 324      -        *)
 325      -                open_top="$srcroot"
 326      -                ;;
 327      -        esac            
 328      -
 329      -        if [[ -n "$open_top" ]]; then
 330      -                hg locate -I "$open_top" | cpio -pd "$dest" >>$LOGFILE 2>&1
 331      -                if (( $? != 0 )) ; then
 332      -                    printf "cpio failed for %s\n" "$dest" |
 333      -                        tee -a $mail_msg_file >> $LOGFILE
 334      -                    return 1
 335      -                fi
 336      -        fi
 337      -
 338      -        if [[ -n "$closed_top" ]]; then
 339      -                mkdir -p "$dest/usr/closed" || return 1
 340      -                if [[ "$closed_top" = usr/closed ]]; then
 341      -                        (cd usr/closed; hg locate |
 342      -                            cpio -pd "$dest/usr/closed") >>$LOGFILE 2>&1
 343      -                        if (( $? != 0 )) ; then
 344      -                            printf "cpio failed for %s/usr/closed\n" \
 345      -                                "$dest" | tee -a $mail_msg_file >> $LOGFILE
 346      -                            return 1
 347      -                        fi
 348      -                else
 349      -                        # copy subtree of usr/closed
 350      -                        closed_top=${closed_top#usr/closed/}
 351      -                        (cd usr/closed; hg locate -I "$closed_top" |
 352      -                            cpio -pd "$dest/usr/closed") >>$LOGFILE 2>&1
 353      -                        if (( $? != 0 )) ; then
 354      -                            printf "cpio failed for %s/usr/closed/%s\n" \
 355      -                                "$dest" "$closed_top" |
 356      -                                tee -a $mail_msg_file >> $LOGFILE
 357      -                            return 1
 358      -                        fi
 359      -                fi
      307 +        hg locate -I "$srcroot" | cpio -pd "$dest" >>$LOGFILE 2>&1
      308 +        if (( $? != 0 )) ; then
      309 +            printf "cpio failed for %s\n" "$dest" |
      310 +                tee -a $mail_msg_file >> $LOGFILE
      311 +            return 1
 360  312          fi
 361  313  
 362  314          return 0
 363  315  }
 364  316  
 365  317  #
 366  318  # function to create (but not build) the export/crypt source tree.
 367  319  # usage: set_up_source_build CODEMGR_WS DESTDIR MAKE_TARGET
 368  320  # Sets SRC to the modified source tree, for use by the caller when it
 369  321  # builds the tree.
↓ open down ↓ 516 lines elided ↑ open up ↑
 886  838                  for i
 887  839                  do
 888  840                          arg="$arg \"$i\""
 889  841                  done
 890  842                  eval su $STAFFER -c \'$arg\'
 891  843          fi
 892  844  }
 893  845  
 894  846  #
 895  847  # Verify that the closed tree is present if it needs to be.
 896      -# Sets CLOSED_IS_PRESENT for future use.
 897  848  #
 898  849  function check_closed_tree {
 899      -        if [ -z "$CLOSED_IS_PRESENT" ]; then
 900      -                if [ -d $CODEMGR_WS/usr/closed ]; then
 901      -                        CLOSED_IS_PRESENT="yes"
 902      -                else
 903      -                        CLOSED_IS_PRESENT="no"
 904      -                fi
 905      -                export CLOSED_IS_PRESENT
 906      -        fi
 907      -        if [[ "$CLOSED_IS_PRESENT" = no && ! -d "$ON_CLOSED_BINS" ]]; then
 908      -                #
 909      -                # If it's an old (pre-split) tree or an empty
 910      -                # workspace, don't complain.
 911      -                #
 912      -                if grep -s CLOSED_BUILD $SRC/Makefile.master > /dev/null; then
 913      -                        echo "If the closed sources are not present," \
 914      -                            "ON_CLOSED_BINS"
 915      -                        echo "must point to the closed binaries tree."
 916      -                        build_ok=n
 917      -                        exit 1
 918      -                fi
      850 +        if [[ ! -d "$ON_CLOSED_BINS" ]]; then
      851 +                echo "ON_CLOSED_BINS must point to the closed binaries tree."
      852 +                build_ok=n
      853 +                exit 1
 919  854          fi
 920  855  }
 921  856  
 922  857  function obsolete_build {
 923  858          echo "WARNING: Obsolete $1 build requested; request will be ignored"
 924  859  }
 925  860  
 926  861  #
 927  862  # wrapper over wsdiff.
 928  863  # usage: do_wsdiff LABEL OLDPROTO NEWPROTO
↓ open down ↓ 328 lines elided ↑ open up ↑
1257 1192          CLOSED_BRINGOVER_WS=$CLOSED_CLONE_WS
1258 1193  fi
1259 1194  
1260 1195  #
1261 1196  # If BRINGOVER_FILES was not specified, default to usr
1262 1197  #
1263 1198  if [ "$BRINGOVER_FILES" = "" ]; then
1264 1199          BRINGOVER_FILES="usr"
1265 1200  fi
1266 1201  
1267      -#
1268      -# If the closed sources are not present, the closed binaries must be
1269      -# present for the build to succeed.  If there's no pointer to the
1270      -# closed binaries, flag that now, rather than forcing the user to wait
1271      -# a couple hours (or more) to find out.
1272      -#
1273      -orig_closed_is_present="$CLOSED_IS_PRESENT"
1274 1202  check_closed_tree
1275 1203  
1276 1204  #
1277 1205  # Note: changes to the option letters here should also be applied to the
1278 1206  #       bldenv script.  `d' is listed for backward compatibility.
1279 1207  #
1280 1208  NIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-}
1281 1209  OPTIND=1
1282 1210  while getopts +ABCDdFfGIilMmNnOoPpRrS:TtUuWwXxz FLAG $NIGHTLY_OPTIONS
1283 1211  do
1284 1212          case $FLAG in
1285 1213            A )   A_FLAG=y
1286      -                #
1287      -                # If ELF_DATA_BASELINE_DIR is not defined, and we are on SWAN
1288      -                # (based on CLOSED_IS_PRESENT), then refuse to run. The value
1289      -                # of ELF version checking is greatly enhanced by including
1290      -                # the baseline gate comparison.
1291      -                if [ "$CLOSED_IS_PRESENT" = 'yes' -a \
1292      -                     "$ELF_DATA_BASELINE_DIR" = '' ]; then
1293      -                        echo "ELF_DATA_BASELINE_DIR must be set if the A" \
1294      -                            "flag is present in\nNIGHTLY_OPTIONS and closed" \
1295      -                            "sources are present. Update environment file."
1296      -                        exit 1;
1297      -                fi
1298 1214                  ;;
1299 1215            B )   D_FLAG=y
1300 1216                  ;; # old version of D
1301 1217            C )   C_FLAG=y
1302 1218                  ;;
1303 1219            D )   D_FLAG=y
1304 1220                  ;;
1305 1221            F )   F_FLAG=y
1306 1222                  ;;
1307 1223            f )   f_FLAG=y
↓ open down ↓ 86 lines elided ↑ open up ↑
1394 1310          export MAILTO
1395 1311  fi
1396 1312  
1397 1313  PATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin"
1398 1314  PATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb"
1399 1315  PATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
1400 1316  export PATH
1401 1317  
1402 1318  # roots of source trees, both relative to $SRC and absolute.
1403 1319  relsrcdirs="."
1404      -if [[ -d $CODEMGR_WS/usr/closed && "$CLOSED_IS_PRESENT" != no ]]; then
1405      -        relsrcdirs="$relsrcdirs ../closed"
1406      -fi
1407      -abssrcdirs=""
1408      -for d in $relsrcdirs; do
1409      -        abssrcdirs="$abssrcdirs $SRC/$d"
1410      -done
     1320 +abssrcdirs="$SRC"
1411 1321  
1412 1322  unset CH
1413 1323  if [ "$o_FLAG" = "y" ]; then
1414 1324  # root invoked old-style build -- make sure it works as it always has
1415 1325  # by exporting 'CH'.  The current Makefile.master doesn't use this, but
1416 1326  # the old ones still do.
1417 1327          PROTOCMPTERSE="protocmp.terse"
1418 1328          CH=
1419 1329          export CH
1420 1330  else
↓ open down ↓ 45 lines elided ↑ open up ↑
1466 1376  path or (if you really want to use this version of dmake anyway), add
1467 1377  the following to your environment to disable this check:
1468 1378  
1469 1379    CHECK_DMAKE=n
1470 1380  EOF
1471 1381          exit 1
1472 1382  fi
1473 1383  export PATH
1474 1384  export MAKE
1475 1385  
1476      -if [[ "$O_FLAG" = y ]]; then
1477      -        export TONICBUILD=""
1478      -else
1479      -        export TONICBUILD="#"
1480      -fi
1481      -
1482 1386  if [ "${SUNWSPRO}" != "" ]; then
1483 1387          PATH="${SUNWSPRO}/bin:$PATH"
1484 1388          export PATH
1485 1389  fi
1486 1390  
1487 1391  hostname=$(uname -n)
1488 1392  if [[ $DMAKE_MAX_JOBS != +([0-9]) || $DMAKE_MAX_JOBS -eq 0 ]]
1489 1393  then
1490 1394          maxjobs=
1491 1395          if [[ -f $HOME/.make.machines ]]
↓ open down ↓ 656 lines elided ↑ open up ↑
2148 2052          typeset -x PATH=$PATH
2149 2053  
2150 2054          # If the repository doesn't exist yet, then we want to populate it.
2151 2055          if [[ ! -d $CODEMGR_WS/.hg ]]; then
2152 2056                  staffer hg init $CODEMGR_WS
2153 2057                  staffer echo "[paths]" > $CODEMGR_WS/.hg/hgrc
2154 2058                  staffer echo "default=$BRINGOVER_WS" >> $CODEMGR_WS/.hg/hgrc
2155 2059                  touch $TMPDIR/new_repository
2156 2060          fi
2157 2061  
2158      -        #
2159      -        # If the user set CLOSED_BRINGOVER_WS and didn't set CLOSED_IS_PRESENT
2160      -        # to "no," then we'll want to initialise the closed repository
2161      -        #
2162      -        # We use $orig_closed_is_present instead of $CLOSED_IS_PRESENT,
2163      -        # because for newly-created source trees, the latter will be "no"
2164      -        # until after the bringover completes.
2165      -        #
2166      -        if [[ "$orig_closed_is_present" != "no" && \
2167      -            -n "$CLOSED_BRINGOVER_WS" && \
2168      -            ! -d $CODEMGR_WS/usr/closed/.hg ]]; then
2169      -                staffer mkdir -p $CODEMGR_WS/usr/closed
2170      -                staffer hg init $CODEMGR_WS/usr/closed
2171      -                staffer echo "[paths]" > $CODEMGR_WS/usr/closed/.hg/hgrc
2172      -                staffer echo "default=$CLOSED_BRINGOVER_WS" >> $CODEMGR_WS/usr/closed/.hg/hgrc
2173      -                touch $TMPDIR/new_closed
2174      -                export CLOSED_IS_PRESENT=yes
2175      -        fi
2176      -
2177 2062          typeset -x HGMERGE="/bin/false"
2178 2063  
2179 2064          #
2180 2065          # If the user has changes, regardless of whether those changes are
2181 2066          # committed, and regardless of whether those changes conflict, then
2182 2067          # we'll attempt to merge them either implicitly (uncommitted) or
2183 2068          # explicitly (committed).
2184 2069          #
2185 2070          # These are the messages we'll use to help clarify mercurial output
2186 2071          # in those cases.
↓ open down ↓ 78 lines elided ↑ open up ↑
2265 2150          fi
2266 2151  
2267 2152          printf "updated %s with the following results:\n" "$CODEMGR_WS"
2268 2153          cat $TMPDIR/pull_open.out
2269 2154          if grep "^merging" $TMPDIR/pull_open.out >/dev/null 2>&1; then
2270 2155                  printf "$mergepassmsg"
2271 2156          fi
2272 2157          printf "\n"
2273 2158  
2274 2159          #
2275      -        # We only want to update usr/closed if it exists, and we haven't been
2276      -        # told not to via $CLOSED_IS_PRESENT, and we actually know where to
2277      -        # pull from ($CLOSED_BRINGOVER_WS).
2278      -        #
2279      -        if [[ $CLOSED_IS_PRESENT = yes && \
2280      -            -d $CODEMGR_WS/usr/closed/.hg && \
2281      -            -n $CLOSED_BRINGOVER_WS ]]; then
2282      -
2283      -                HG_SOURCE=$CLOSED_BRINGOVER_WS
2284      -                if [ ! -f $TMPDIR/new_closed ]; then
2285      -                        HG_SOURCE=$TMPDIR/closed_bundle.hg
2286      -                        staffer hg --cwd $CODEMGR_WS/usr/closed incoming \
2287      -                            --bundle $HG_SOURCE -v $CLOSED_BRINGOVER_WS \
2288      -                            > $TMPDIR/incoming_closed.out
2289      -
2290      -                        #
2291      -                        # If there are no incoming changesets, then incoming will
2292      -                        # fail, and there will be no bundle file.  Reset the source,
2293      -                        # to allow the remaining logic to complete with no false
2294      -                        # negatives.  (Unlike incoming, pull will return success
2295      -                        # for the no-change case.)
2296      -                        #
2297      -                        if (( $? != 0 )); then
2298      -                                HG_SOURCE=$CLOSED_BRINGOVER_WS
2299      -                        fi
2300      -                fi
2301      -
2302      -                staffer hg --cwd $CODEMGR_WS/usr/closed pull -u \
2303      -                        $HG_SOURCE > $TMPDIR/pull_closed.out 2>&1
2304      -                if (( $? != 0 )); then
2305      -                        printf "closed pull failed as follows:\n\n"
2306      -                        cat $TMPDIR/pull_closed.out
2307      -                        if grep "^merging.*failed" $TMPDIR/pull_closed.out \
2308      -                            > /dev/null 2>&1; then
2309      -                                printf "$mergefailmsg"
2310      -                        fi
2311      -                        touch $TMPDIR/bringover_failed
2312      -                        return
2313      -                fi
2314      -
2315      -                if grep "not updating" $TMPDIR/pull_closed.out > /dev/null 2>&1; then
2316      -                        staffer hg --cwd $CODEMGR_WS/usr/closed merge \
2317      -                            >> $TMPDIR/pull_closed.out 2>&1
2318      -                        if (( $? != 0 )); then
2319      -                                printf "closed merge failed as follows:\n\n"
2320      -                                cat $TMPDIR/pull_closed.out
2321      -                                if grep "^merging.*failed" $TMPDIR/pull_closed.out > /dev/null 2>&1; then
2322      -                                        printf "$mergefailmsg"
2323      -                                fi
2324      -                                touch $TMPDIR/bringover_failed
2325      -                                return
2326      -                        fi
2327      -                fi
2328      -
2329      -                printf "updated %s with the following results:\n" \
2330      -                    "$CODEMGR_WS/usr/closed"
2331      -                cat $TMPDIR/pull_closed.out
2332      -                if grep "^merging" $TMPDIR/pull_closed.out > /dev/null 2>&1; then
2333      -                        printf "$mergepassmsg"
2334      -                fi
2335      -        fi
2336      -
2337      -        #
2338 2160          # Per-changeset output is neither useful nor manageable for a
2339 2161          # newly-created repository.
2340 2162          #
2341 2163          if [ -f $TMPDIR/new_repository ]; then
2342 2164                  return
2343 2165          fi
2344 2166  
2345 2167          printf "\nadded the following changesets to open repository:\n"
2346 2168          cat $TMPDIR/incoming_open.out
2347 2169  
↓ open down ↓ 76 lines elided ↑ open up ↑
2424 2246  
2425 2247          #
2426 2248          # It's possible that we used the bringover above to create
2427 2249          # $CODEMGR_WS.  If so, then SCM_TYPE was previously "none,"
2428 2250          # but should now be the same as $BRINGOVER_WS.
2429 2251          #
2430 2252          [[ $SCM_TYPE = none ]] && SCM_TYPE=$PARENT_SCM_TYPE
2431 2253  
2432 2254          run_hook POST_BRINGOVER
2433 2255  
2434      -        #
2435      -        # Possible transition from pre-split workspace to split
2436      -        # workspace.  See if the bringover changed anything.
2437      -        #
2438      -        CLOSED_IS_PRESENT="$orig_closed_is_present"
2439 2256          check_closed_tree
2440 2257  
2441 2258  else
2442 2259          echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE
2443 2260  fi
2444 2261  
2445      -if [[ "$O_FLAG" = y && "$CLOSED_IS_PRESENT" != "yes" ]]; then
     2262 +if [[ "$O_FLAG" = y ]]; then
2446 2263          build_ok=n
2447 2264          echo "OpenSolaris binary deliverables need usr/closed." \
2448 2265              | tee -a "$mail_msg_file" >> $LOGFILE
2449 2266          exit 1
2450 2267  fi
2451 2268  
2452 2269  # Safeguards
2453 2270  [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
2454 2271  [[ -d "${CODEMGR_WS}" ]] || fatal_error "Error: ${CODEMGR_WS} is not a directory."
2455 2272  [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
↓ open down ↓ 159 lines elided ↑ open up ↑
2615 2432          # Copy the open sources into their own tree.
2616 2433          # If copy_source fails, it will have already generated an
2617 2434          # error message and set build_ok=n, so we don't need to worry
2618 2435          # about that here.
2619 2436          #
2620 2437          copy_source $CODEMGR_WS $OPEN_SRCDIR OPEN_SOURCE usr/src
2621 2438  fi
2622 2439  
2623 2440  if [ "$SO_FLAG" = "y" -a "$build_ok" = y ]; then
2624 2441          SRC=$OPEN_SRCDIR/usr/src
2625      -        export CLOSED_IS_PRESENT=no
2626 2442  fi
2627 2443  
2628 2444  if is_source_build && [ $build_ok = y ] ; then
2629 2445          # remove proto area(s) here, since we don't clobber
2630 2446          rm -rf `allprotos`
2631 2447          if [ "$t_FLAG" = "y" ]; then
2632 2448                  set_non_debug_build_flags
2633 2449                  ORIG_TOOLS=$TOOLS
2634 2450                  #
2635 2451                  # SRC was set earlier to point to the source build
↓ open down ↓ 541 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX