Print this page
4028 remove CLOSED_IS_PRESENT

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 ↓ 519 lines elided ↑ open up ↑
 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  848  #
 897  849  function check_closed_tree {
 898  850          if [[ ! -d "$ON_CLOSED_BINS" ]]; then
 899      -                echo "If the closed sources are not present," \
 900      -                    "ON_CLOSED_BINS"
 901      -                echo "must point to the closed binaries tree."
      851 +                echo "ON_CLOSED_BINS must point to the closed binaries tree."
 902  852                  build_ok=n
 903  853                  exit 1
 904  854          fi
 905  855  }
 906  856  
 907  857  function obsolete_build {
 908  858          echo "WARNING: Obsolete $1 build requested; request will be ignored"
 909  859  }
 910  860  
 911  861  #
↓ open down ↓ 330 lines elided ↑ open up ↑
1242 1192          CLOSED_BRINGOVER_WS=$CLOSED_CLONE_WS
1243 1193  fi
1244 1194  
1245 1195  #
1246 1196  # If BRINGOVER_FILES was not specified, default to usr
1247 1197  #
1248 1198  if [ "$BRINGOVER_FILES" = "" ]; then
1249 1199          BRINGOVER_FILES="usr"
1250 1200  fi
1251 1201  
1252      -#
1253      -# If the closed sources are not present, the closed binaries must be
1254      -# present for the build to succeed.  If there's no pointer to the
1255      -# closed binaries, flag that now, rather than forcing the user to wait
1256      -# a couple hours (or more) to find out.
1257      -#
1258      -orig_closed_is_present="$CLOSED_IS_PRESENT"
1259 1202  check_closed_tree
1260 1203  
1261 1204  #
1262 1205  # Note: changes to the option letters here should also be applied to the
1263 1206  #       bldenv script.  `d' is listed for backward compatibility.
1264 1207  #
1265 1208  NIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-}
1266 1209  OPTIND=1
1267 1210  while getopts +ABCDdFfGIilMmNnOoPpRrS:TtUuWwXxz FLAG $NIGHTLY_OPTIONS
1268 1211  do
1269 1212          case $FLAG in
1270 1213            A )   A_FLAG=y
1271      -                #
1272      -                # If ELF_DATA_BASELINE_DIR is not defined, and we are on SWAN
1273      -                # (based on CLOSED_IS_PRESENT), then refuse to run. The value
1274      -                # of ELF version checking is greatly enhanced by including
1275      -                # the baseline gate comparison.
1276      -                if [ "$CLOSED_IS_PRESENT" = 'yes' -a \
1277      -                     "$ELF_DATA_BASELINE_DIR" = '' ]; then
1278      -                        echo "ELF_DATA_BASELINE_DIR must be set if the A" \
1279      -                            "flag is present in\nNIGHTLY_OPTIONS and closed" \
1280      -                            "sources are present. Update environment file."
1281      -                        exit 1;
1282      -                fi
1283 1214                  ;;
1284 1215            B )   D_FLAG=y
1285 1216                  ;; # old version of D
1286 1217            C )   C_FLAG=y
1287 1218                  ;;
1288 1219            D )   D_FLAG=y
1289 1220                  ;;
1290 1221            F )   F_FLAG=y
1291 1222                  ;;
1292 1223            f )   f_FLAG=y
↓ open down ↓ 86 lines elided ↑ open up ↑
1379 1310          export MAILTO
1380 1311  fi
1381 1312  
1382 1313  PATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin"
1383 1314  PATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb"
1384 1315  PATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
1385 1316  export PATH
1386 1317  
1387 1318  # roots of source trees, both relative to $SRC and absolute.
1388 1319  relsrcdirs="."
1389      -if [[ -d $CODEMGR_WS/usr/closed && "$CLOSED_IS_PRESENT" != no ]]; then
1390      -        relsrcdirs="$relsrcdirs ../closed"
1391      -fi
1392      -abssrcdirs=""
1393      -for d in $relsrcdirs; do
1394      -        abssrcdirs="$abssrcdirs $SRC/$d"
1395      -done
     1320 +abssrcdirs="$SRC"
1396 1321  
1397 1322  unset CH
1398 1323  if [ "$o_FLAG" = "y" ]; then
1399 1324  # root invoked old-style build -- make sure it works as it always has
1400 1325  # by exporting 'CH'.  The current Makefile.master doesn't use this, but
1401 1326  # the old ones still do.
1402 1327          PROTOCMPTERSE="protocmp.terse"
1403 1328          CH=
1404 1329          export CH
1405 1330  else
↓ open down ↓ 727 lines elided ↑ open up ↑
2133 2058          typeset -x PATH=$PATH
2134 2059  
2135 2060          # If the repository doesn't exist yet, then we want to populate it.
2136 2061          if [[ ! -d $CODEMGR_WS/.hg ]]; then
2137 2062                  staffer hg init $CODEMGR_WS
2138 2063                  staffer echo "[paths]" > $CODEMGR_WS/.hg/hgrc
2139 2064                  staffer echo "default=$BRINGOVER_WS" >> $CODEMGR_WS/.hg/hgrc
2140 2065                  touch $TMPDIR/new_repository
2141 2066          fi
2142 2067  
2143      -        #
2144      -        # If the user set CLOSED_BRINGOVER_WS and didn't set CLOSED_IS_PRESENT
2145      -        # to "no," then we'll want to initialise the closed repository
2146      -        #
2147      -        # We use $orig_closed_is_present instead of $CLOSED_IS_PRESENT,
2148      -        # because for newly-created source trees, the latter will be "no"
2149      -        # until after the bringover completes.
2150      -        #
2151      -        if [[ "$orig_closed_is_present" != "no" && \
2152      -            -n "$CLOSED_BRINGOVER_WS" && \
2153      -            ! -d $CODEMGR_WS/usr/closed/.hg ]]; then
2154      -                staffer mkdir -p $CODEMGR_WS/usr/closed
2155      -                staffer hg init $CODEMGR_WS/usr/closed
2156      -                staffer echo "[paths]" > $CODEMGR_WS/usr/closed/.hg/hgrc
2157      -                staffer echo "default=$CLOSED_BRINGOVER_WS" >> $CODEMGR_WS/usr/closed/.hg/hgrc
2158      -                touch $TMPDIR/new_closed
2159      -                export CLOSED_IS_PRESENT=yes
2160      -        fi
2161      -
2162 2068          typeset -x HGMERGE="/bin/false"
2163 2069  
2164 2070          #
2165 2071          # If the user has changes, regardless of whether those changes are
2166 2072          # committed, and regardless of whether those changes conflict, then
2167 2073          # we'll attempt to merge them either implicitly (uncommitted) or
2168 2074          # explicitly (committed).
2169 2075          #
2170 2076          # These are the messages we'll use to help clarify mercurial output
2171 2077          # in those cases.
↓ open down ↓ 78 lines elided ↑ open up ↑
2250 2156          fi
2251 2157  
2252 2158          printf "updated %s with the following results:\n" "$CODEMGR_WS"
2253 2159          cat $TMPDIR/pull_open.out
2254 2160          if grep "^merging" $TMPDIR/pull_open.out >/dev/null 2>&1; then
2255 2161                  printf "$mergepassmsg"
2256 2162          fi
2257 2163          printf "\n"
2258 2164  
2259 2165          #
2260      -        # We only want to update usr/closed if it exists, and we haven't been
2261      -        # told not to via $CLOSED_IS_PRESENT, and we actually know where to
2262      -        # pull from ($CLOSED_BRINGOVER_WS).
2263      -        #
2264      -        if [[ $CLOSED_IS_PRESENT = yes && \
2265      -            -d $CODEMGR_WS/usr/closed/.hg && \
2266      -            -n $CLOSED_BRINGOVER_WS ]]; then
2267      -
2268      -                HG_SOURCE=$CLOSED_BRINGOVER_WS
2269      -                if [ ! -f $TMPDIR/new_closed ]; then
2270      -                        HG_SOURCE=$TMPDIR/closed_bundle.hg
2271      -                        staffer hg --cwd $CODEMGR_WS/usr/closed incoming \
2272      -                            --bundle $HG_SOURCE -v $CLOSED_BRINGOVER_WS \
2273      -                            > $TMPDIR/incoming_closed.out
2274      -
2275      -                        #
2276      -                        # If there are no incoming changesets, then incoming will
2277      -                        # fail, and there will be no bundle file.  Reset the source,
2278      -                        # to allow the remaining logic to complete with no false
2279      -                        # negatives.  (Unlike incoming, pull will return success
2280      -                        # for the no-change case.)
2281      -                        #
2282      -                        if (( $? != 0 )); then
2283      -                                HG_SOURCE=$CLOSED_BRINGOVER_WS
2284      -                        fi
2285      -                fi
2286      -
2287      -                staffer hg --cwd $CODEMGR_WS/usr/closed pull -u \
2288      -                        $HG_SOURCE > $TMPDIR/pull_closed.out 2>&1
2289      -                if (( $? != 0 )); then
2290      -                        printf "closed pull failed as follows:\n\n"
2291      -                        cat $TMPDIR/pull_closed.out
2292      -                        if grep "^merging.*failed" $TMPDIR/pull_closed.out \
2293      -                            > /dev/null 2>&1; then
2294      -                                printf "$mergefailmsg"
2295      -                        fi
2296      -                        touch $TMPDIR/bringover_failed
2297      -                        return
2298      -                fi
2299      -
2300      -                if grep "not updating" $TMPDIR/pull_closed.out > /dev/null 2>&1; then
2301      -                        staffer hg --cwd $CODEMGR_WS/usr/closed merge \
2302      -                            >> $TMPDIR/pull_closed.out 2>&1
2303      -                        if (( $? != 0 )); then
2304      -                                printf "closed merge failed as follows:\n\n"
2305      -                                cat $TMPDIR/pull_closed.out
2306      -                                if grep "^merging.*failed" $TMPDIR/pull_closed.out > /dev/null 2>&1; then
2307      -                                        printf "$mergefailmsg"
2308      -                                fi
2309      -                                touch $TMPDIR/bringover_failed
2310      -                                return
2311      -                        fi
2312      -                fi
2313      -
2314      -                printf "updated %s with the following results:\n" \
2315      -                    "$CODEMGR_WS/usr/closed"
2316      -                cat $TMPDIR/pull_closed.out
2317      -                if grep "^merging" $TMPDIR/pull_closed.out > /dev/null 2>&1; then
2318      -                        printf "$mergepassmsg"
2319      -                fi
2320      -        fi
2321      -
2322      -        #
2323 2166          # Per-changeset output is neither useful nor manageable for a
2324 2167          # newly-created repository.
2325 2168          #
2326 2169          if [ -f $TMPDIR/new_repository ]; then
2327 2170                  return
2328 2171          fi
2329 2172  
2330 2173          printf "\nadded the following changesets to open repository:\n"
2331 2174          cat $TMPDIR/incoming_open.out
2332 2175  
↓ open down ↓ 76 lines elided ↑ open up ↑
2409 2252  
2410 2253          #
2411 2254          # It's possible that we used the bringover above to create
2412 2255          # $CODEMGR_WS.  If so, then SCM_TYPE was previously "none,"
2413 2256          # but should now be the same as $BRINGOVER_WS.
2414 2257          #
2415 2258          [[ $SCM_TYPE = none ]] && SCM_TYPE=$PARENT_SCM_TYPE
2416 2259  
2417 2260          run_hook POST_BRINGOVER
2418 2261  
2419      -        #
2420      -        # Possible transition from pre-split workspace to split
2421      -        # workspace.  See if the bringover changed anything.
2422      -        #
2423      -        CLOSED_IS_PRESENT="$orig_closed_is_present"
2424 2262          check_closed_tree
2425 2263  
2426 2264  else
2427 2265          echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE
2428 2266  fi
2429 2267  
2430      -if [[ "$O_FLAG" = y && "$CLOSED_IS_PRESENT" != "yes" ]]; then
     2268 +if [[ "$O_FLAG" = y ]]; then
2431 2269          build_ok=n
2432 2270          echo "OpenSolaris binary deliverables need usr/closed." \
2433 2271              | tee -a "$mail_msg_file" >> $LOGFILE
2434 2272          exit 1
2435 2273  fi
2436 2274  
2437 2275  # Safeguards
2438 2276  [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
2439 2277  [[ -d "${CODEMGR_WS}" ]] || fatal_error "Error: ${CODEMGR_WS} is not a directory."
2440 2278  [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
↓ open down ↓ 159 lines elided ↑ open up ↑
2600 2438          # Copy the open sources into their own tree.
2601 2439          # If copy_source fails, it will have already generated an
2602 2440          # error message and set build_ok=n, so we don't need to worry
2603 2441          # about that here.
2604 2442          #
2605 2443          copy_source $CODEMGR_WS $OPEN_SRCDIR OPEN_SOURCE usr/src
2606 2444  fi
2607 2445  
2608 2446  if [ "$SO_FLAG" = "y" -a "$build_ok" = y ]; then
2609 2447          SRC=$OPEN_SRCDIR/usr/src
2610      -        export CLOSED_IS_PRESENT=no
2611 2448  fi
2612 2449  
2613 2450  if is_source_build && [ $build_ok = y ] ; then
2614 2451          # remove proto area(s) here, since we don't clobber
2615 2452          rm -rf `allprotos`
2616 2453          if [ "$t_FLAG" = "y" ]; then
2617 2454                  set_non_debug_build_flags
2618 2455                  ORIG_TOOLS=$TOOLS
2619 2456                  #
2620 2457                  # SRC was set earlier to point to the source build
↓ open down ↓ 541 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX