277 ;;
278 mercurial)
279 copy_source_mercurial $DEST $srcroot
280 if (( $? != 0 )) ; then
281 build_ok=n
282 return 1
283 fi
284 ;;
285 *)
286 build_ok=n
287 echo "Tree copy is not supported for workspace type" \
288 "$SCM_TYPE" | tee -a $mail_msg_file >> $LOGFILE
289 return 1
290 ;;
291 esac
292
293 return 0
294 }
295
296 #
297 # Mercurial-specific copy code for copy_source(). Handles the
298 # combined open and closed trees.
299 #
300 # Returns 0 for success, non-zero for failure.
301 #
302 # usage: copy_source_mercurial destdir srcroot
303 #
304 function copy_source_mercurial {
305 typeset dest=$1
306 typeset srcroot=$2
307 typeset open_top closed_top
308
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
360 fi
361
362 return 0
363 }
364
365 #
366 # function to create (but not build) the export/crypt source tree.
367 # usage: set_up_source_build CODEMGR_WS DESTDIR MAKE_TARGET
368 # Sets SRC to the modified source tree, for use by the caller when it
369 # builds the tree.
370 #
371 function set_up_source_build {
372 WS=$1
373 DEST=$2
374 MAKETARG=$3
375
376 copy_source $WS $DEST $MAKETARG usr
377 if (( $? != 0 )); then
378 echo "\nCould not copy source tree for source build." |
379 tee -a $mail_msg_file >> $LOGFILE
380 build_ok=n
879
880 function staffer {
881 if [ $ISUSER -ne 0 ]; then
882 "$@"
883 else
884 arg="\"$1\""
885 shift
886 for i
887 do
888 arg="$arg \"$i\""
889 done
890 eval su $STAFFER -c \'$arg\'
891 fi
892 }
893
894 #
895 # Verify that the closed tree is present if it needs to be.
896 #
897 function check_closed_tree {
898 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."
902 build_ok=n
903 exit 1
904 fi
905 }
906
907 function obsolete_build {
908 echo "WARNING: Obsolete $1 build requested; request will be ignored"
909 }
910
911 #
912 # wrapper over wsdiff.
913 # usage: do_wsdiff LABEL OLDPROTO NEWPROTO
914 #
915 function do_wsdiff {
916 label=$1
917 oldproto=$2
918 newproto=$3
919
920 wsdiff="wsdiff"
921 [ "$t_FLAG" = y ] && wsdiff="wsdiff -t"
1232 # If BRINGOVER_WS was not specified, let it default to CLONE_WS
1233 #
1234 if [ "$BRINGOVER_WS" = "" ]; then
1235 BRINGOVER_WS=$CLONE_WS
1236 fi
1237
1238 #
1239 # If CLOSED_BRINGOVER_WS was not specified, let it default to CLOSED_CLONE_WS
1240 #
1241 if [ "$CLOSED_BRINGOVER_WS" = "" ]; then
1242 CLOSED_BRINGOVER_WS=$CLOSED_CLONE_WS
1243 fi
1244
1245 #
1246 # If BRINGOVER_FILES was not specified, default to usr
1247 #
1248 if [ "$BRINGOVER_FILES" = "" ]; then
1249 BRINGOVER_FILES="usr"
1250 fi
1251
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 check_closed_tree
1260
1261 #
1262 # Note: changes to the option letters here should also be applied to the
1263 # bldenv script. `d' is listed for backward compatibility.
1264 #
1265 NIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-}
1266 OPTIND=1
1267 while getopts +ABCDdFfGIilMmNnOoPpRrS:TtUuWwXxz FLAG $NIGHTLY_OPTIONS
1268 do
1269 case $FLAG in
1270 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 ;;
1284 B ) D_FLAG=y
1285 ;; # old version of D
1286 C ) C_FLAG=y
1287 ;;
1288 D ) D_FLAG=y
1289 ;;
1290 F ) F_FLAG=y
1291 ;;
1292 f ) f_FLAG=y
1293 ;;
1294 G ) u_FLAG=y
1295 ;;
1296 I ) m_FLAG=y
1297 p_FLAG=y
1298 u_FLAG=y
1299 ;;
1300 i ) i_FLAG=y
1301 ;;
1302 l ) l_FLAG=y
1369
1370 # Set default value for STAFFER, if needed.
1371 if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then
1372 STAFFER=`/usr/xpg4/bin/id -un`
1373 export STAFFER
1374 fi
1375 fi
1376
1377 if [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then
1378 MAILTO=$STAFFER
1379 export MAILTO
1380 fi
1381
1382 PATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin"
1383 PATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb"
1384 PATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
1385 export PATH
1386
1387 # roots of source trees, both relative to $SRC and absolute.
1388 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
1396
1397 unset CH
1398 if [ "$o_FLAG" = "y" ]; then
1399 # root invoked old-style build -- make sure it works as it always has
1400 # by exporting 'CH'. The current Makefile.master doesn't use this, but
1401 # the old ones still do.
1402 PROTOCMPTERSE="protocmp.terse"
1403 CH=
1404 export CH
1405 else
1406 PROTOCMPTERSE="protocmp.terse -gu"
1407 fi
1408 POUND_SIGN="#"
1409 # have we set RELEASE_DATE in our env file?
1410 if [ -z "$RELEASE_DATE" ]; then
1411 RELEASE_DATE=$(LC_ALL=C date +"%B %Y")
1412 fi
1413 BUILD_DATE=$(LC_ALL=C date +%Y-%b-%d)
1414 BASEWSDIR=$(basename $CODEMGR_WS)
1415 DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
2123 touch $TMPDIR/bringover_failed
2124
2125 staffer bringovercheck $CODEMGR_WS >$TMPDIR/bringovercheck.out 2>&1
2126 if [ -s $TMPDIR/bringovercheck.out ]; then
2127 echo "\n==== POST-BRINGOVER CLEANUP NOISE ====\n"
2128 cat $TMPDIR/bringovercheck.out
2129 fi
2130 }
2131
2132 type bringover_mercurial > /dev/null 2>&1 || function bringover_mercurial {
2133 typeset -x PATH=$PATH
2134
2135 # If the repository doesn't exist yet, then we want to populate it.
2136 if [[ ! -d $CODEMGR_WS/.hg ]]; then
2137 staffer hg init $CODEMGR_WS
2138 staffer echo "[paths]" > $CODEMGR_WS/.hg/hgrc
2139 staffer echo "default=$BRINGOVER_WS" >> $CODEMGR_WS/.hg/hgrc
2140 touch $TMPDIR/new_repository
2141 fi
2142
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 typeset -x HGMERGE="/bin/false"
2163
2164 #
2165 # If the user has changes, regardless of whether those changes are
2166 # committed, and regardless of whether those changes conflict, then
2167 # we'll attempt to merge them either implicitly (uncommitted) or
2168 # explicitly (committed).
2169 #
2170 # These are the messages we'll use to help clarify mercurial output
2171 # in those cases.
2172 #
2173 typeset mergefailmsg="\
2174 ***\n\
2175 *** nightly was unable to automatically merge your changes. You should\n\
2176 *** redo the full merge manually, following the steps outlined by mercurial\n\
2177 *** above, then restart nightly.\n\
2178 ***\n"
2179 typeset mergepassmsg="\
2180 ***\n\
2181 *** nightly successfully merged your changes. This means that your working\n\
2240 printf "%s: merge failed as follows:\n\n" \
2241 "$CODEMGR_WS"
2242 cat $TMPDIR/pull_open.out
2243 if grep "^merging.*failed" $TMPDIR/pull_open.out \
2244 > /dev/null 2>&1; then
2245 printf "$mergefailmsg"
2246 fi
2247 touch $TMPDIR/bringover_failed
2248 return
2249 fi
2250 fi
2251
2252 printf "updated %s with the following results:\n" "$CODEMGR_WS"
2253 cat $TMPDIR/pull_open.out
2254 if grep "^merging" $TMPDIR/pull_open.out >/dev/null 2>&1; then
2255 printf "$mergepassmsg"
2256 fi
2257 printf "\n"
2258
2259 #
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 # Per-changeset output is neither useful nor manageable for a
2324 # newly-created repository.
2325 #
2326 if [ -f $TMPDIR/new_repository ]; then
2327 return
2328 fi
2329
2330 printf "\nadded the following changesets to open repository:\n"
2331 cat $TMPDIR/incoming_open.out
2332
2333 #
2334 # The closed repository could have been newly created, even though
2335 # the open one previously existed...
2336 #
2337 if [ -f $TMPDIR/new_closed ]; then
2338 return
2339 fi
2340
2341 if [ -f $TMPDIR/incoming_closed.out ]; then
2342 printf "\nadded the following changesets to closed repository:\n"
2399 eval "bringover_${PARENT_SCM_TYPE}" 2>&1 |
2400 tee -a $mail_msg_file >> $LOGFILE
2401
2402 if [ -f $TMPDIR/bringover_failed ]; then
2403 rm -f $TMPDIR/bringover_failed
2404 build_ok=n
2405 echo "trouble with bringover, quitting at `date`." |
2406 tee -a $mail_msg_file >> $LOGFILE
2407 exit 1
2408 fi
2409
2410 #
2411 # It's possible that we used the bringover above to create
2412 # $CODEMGR_WS. If so, then SCM_TYPE was previously "none,"
2413 # but should now be the same as $BRINGOVER_WS.
2414 #
2415 [[ $SCM_TYPE = none ]] && SCM_TYPE=$PARENT_SCM_TYPE
2416
2417 run_hook POST_BRINGOVER
2418
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 check_closed_tree
2425
2426 else
2427 echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE
2428 fi
2429
2430 if [[ "$O_FLAG" = y && "$CLOSED_IS_PRESENT" != "yes" ]]; then
2431 build_ok=n
2432 echo "OpenSolaris binary deliverables need usr/closed." \
2433 | tee -a "$mail_msg_file" >> $LOGFILE
2434 exit 1
2435 fi
2436
2437 # Safeguards
2438 [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
2439 [[ -d "${CODEMGR_WS}" ]] || fatal_error "Error: ${CODEMGR_WS} is not a directory."
2440 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
2441
2442 echo "\n==== Build environment ====\n" | tee -a $build_environ_file >> $LOGFILE
2443
2444 # System
2445 whence uname | tee -a $build_environ_file >> $LOGFILE
2446 uname -a 2>&1 | tee -a $build_environ_file >> $LOGFILE
2447 echo | tee -a $build_environ_file >> $LOGFILE
2448
2449 # make
2450 whence $MAKE | tee -a $build_environ_file >> $LOGFILE
2590 >> $mail_msg_file
2591 else
2592 echo "\n==== DOMESTIC extraction failed ====\n" \
2593 >> $mail_msg_file
2594 fi
2595
2596 fi
2597
2598 if [ "$SO_FLAG" = "y" -a "$build_ok" = y ]; then
2599 #
2600 # Copy the open sources into their own tree.
2601 # If copy_source fails, it will have already generated an
2602 # error message and set build_ok=n, so we don't need to worry
2603 # about that here.
2604 #
2605 copy_source $CODEMGR_WS $OPEN_SRCDIR OPEN_SOURCE usr/src
2606 fi
2607
2608 if [ "$SO_FLAG" = "y" -a "$build_ok" = y ]; then
2609 SRC=$OPEN_SRCDIR/usr/src
2610 export CLOSED_IS_PRESENT=no
2611 fi
2612
2613 if is_source_build && [ $build_ok = y ] ; then
2614 # remove proto area(s) here, since we don't clobber
2615 rm -rf `allprotos`
2616 if [ "$t_FLAG" = "y" ]; then
2617 set_non_debug_build_flags
2618 ORIG_TOOLS=$TOOLS
2619 #
2620 # SRC was set earlier to point to the source build
2621 # source tree (e.g., $EXPORT_SRC).
2622 #
2623 TOOLS=${SRC}/tools
2624 TOOLS_PROTO=${TOOLS}/${TOOLS_PROTO_REL}; export TOOLS_PROTO
2625 build_tools ${TOOLS_PROTO}
2626 if [[ $? != 0 ]]; then
2627 use_tools ${TOOLS_PROTO}
2628 fi
2629 fi
2630
|
277 ;;
278 mercurial)
279 copy_source_mercurial $DEST $srcroot
280 if (( $? != 0 )) ; then
281 build_ok=n
282 return 1
283 fi
284 ;;
285 *)
286 build_ok=n
287 echo "Tree copy is not supported for workspace type" \
288 "$SCM_TYPE" | tee -a $mail_msg_file >> $LOGFILE
289 return 1
290 ;;
291 esac
292
293 return 0
294 }
295
296 #
297 # Mercurial-specific copy code for copy_source().
298 #
299 # Returns 0 for success, non-zero for failure.
300 #
301 # usage: copy_source_mercurial destdir srcroot
302 #
303 function copy_source_mercurial {
304 typeset dest=$1
305 typeset srcroot=$2
306
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
312 fi
313
314 return 0
315 }
316
317 #
318 # function to create (but not build) the export/crypt source tree.
319 # usage: set_up_source_build CODEMGR_WS DESTDIR MAKE_TARGET
320 # Sets SRC to the modified source tree, for use by the caller when it
321 # builds the tree.
322 #
323 function set_up_source_build {
324 WS=$1
325 DEST=$2
326 MAKETARG=$3
327
328 copy_source $WS $DEST $MAKETARG usr
329 if (( $? != 0 )); then
330 echo "\nCould not copy source tree for source build." |
331 tee -a $mail_msg_file >> $LOGFILE
332 build_ok=n
831
832 function staffer {
833 if [ $ISUSER -ne 0 ]; then
834 "$@"
835 else
836 arg="\"$1\""
837 shift
838 for i
839 do
840 arg="$arg \"$i\""
841 done
842 eval su $STAFFER -c \'$arg\'
843 fi
844 }
845
846 #
847 # Verify that the closed tree is present if it needs to be.
848 #
849 function check_closed_tree {
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
854 fi
855 }
856
857 function obsolete_build {
858 echo "WARNING: Obsolete $1 build requested; request will be ignored"
859 }
860
861 #
862 # wrapper over wsdiff.
863 # usage: do_wsdiff LABEL OLDPROTO NEWPROTO
864 #
865 function do_wsdiff {
866 label=$1
867 oldproto=$2
868 newproto=$3
869
870 wsdiff="wsdiff"
871 [ "$t_FLAG" = y ] && wsdiff="wsdiff -t"
1182 # If BRINGOVER_WS was not specified, let it default to CLONE_WS
1183 #
1184 if [ "$BRINGOVER_WS" = "" ]; then
1185 BRINGOVER_WS=$CLONE_WS
1186 fi
1187
1188 #
1189 # If CLOSED_BRINGOVER_WS was not specified, let it default to CLOSED_CLONE_WS
1190 #
1191 if [ "$CLOSED_BRINGOVER_WS" = "" ]; then
1192 CLOSED_BRINGOVER_WS=$CLOSED_CLONE_WS
1193 fi
1194
1195 #
1196 # If BRINGOVER_FILES was not specified, default to usr
1197 #
1198 if [ "$BRINGOVER_FILES" = "" ]; then
1199 BRINGOVER_FILES="usr"
1200 fi
1201
1202 check_closed_tree
1203
1204 #
1205 # Note: changes to the option letters here should also be applied to the
1206 # bldenv script. `d' is listed for backward compatibility.
1207 #
1208 NIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-}
1209 OPTIND=1
1210 while getopts +ABCDdFfGIilMmNnOoPpRrS:TtUuWwXxz FLAG $NIGHTLY_OPTIONS
1211 do
1212 case $FLAG in
1213 A ) A_FLAG=y
1214 ;;
1215 B ) D_FLAG=y
1216 ;; # old version of D
1217 C ) C_FLAG=y
1218 ;;
1219 D ) D_FLAG=y
1220 ;;
1221 F ) F_FLAG=y
1222 ;;
1223 f ) f_FLAG=y
1224 ;;
1225 G ) u_FLAG=y
1226 ;;
1227 I ) m_FLAG=y
1228 p_FLAG=y
1229 u_FLAG=y
1230 ;;
1231 i ) i_FLAG=y
1232 ;;
1233 l ) l_FLAG=y
1300
1301 # Set default value for STAFFER, if needed.
1302 if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then
1303 STAFFER=`/usr/xpg4/bin/id -un`
1304 export STAFFER
1305 fi
1306 fi
1307
1308 if [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then
1309 MAILTO=$STAFFER
1310 export MAILTO
1311 fi
1312
1313 PATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin"
1314 PATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb"
1315 PATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
1316 export PATH
1317
1318 # roots of source trees, both relative to $SRC and absolute.
1319 relsrcdirs="."
1320 abssrcdirs="$SRC"
1321
1322 unset CH
1323 if [ "$o_FLAG" = "y" ]; then
1324 # root invoked old-style build -- make sure it works as it always has
1325 # by exporting 'CH'. The current Makefile.master doesn't use this, but
1326 # the old ones still do.
1327 PROTOCMPTERSE="protocmp.terse"
1328 CH=
1329 export CH
1330 else
1331 PROTOCMPTERSE="protocmp.terse -gu"
1332 fi
1333 POUND_SIGN="#"
1334 # have we set RELEASE_DATE in our env file?
1335 if [ -z "$RELEASE_DATE" ]; then
1336 RELEASE_DATE=$(LC_ALL=C date +"%B %Y")
1337 fi
1338 BUILD_DATE=$(LC_ALL=C date +%Y-%b-%d)
1339 BASEWSDIR=$(basename $CODEMGR_WS)
1340 DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
2048 touch $TMPDIR/bringover_failed
2049
2050 staffer bringovercheck $CODEMGR_WS >$TMPDIR/bringovercheck.out 2>&1
2051 if [ -s $TMPDIR/bringovercheck.out ]; then
2052 echo "\n==== POST-BRINGOVER CLEANUP NOISE ====\n"
2053 cat $TMPDIR/bringovercheck.out
2054 fi
2055 }
2056
2057 type bringover_mercurial > /dev/null 2>&1 || function bringover_mercurial {
2058 typeset -x PATH=$PATH
2059
2060 # If the repository doesn't exist yet, then we want to populate it.
2061 if [[ ! -d $CODEMGR_WS/.hg ]]; then
2062 staffer hg init $CODEMGR_WS
2063 staffer echo "[paths]" > $CODEMGR_WS/.hg/hgrc
2064 staffer echo "default=$BRINGOVER_WS" >> $CODEMGR_WS/.hg/hgrc
2065 touch $TMPDIR/new_repository
2066 fi
2067
2068 typeset -x HGMERGE="/bin/false"
2069
2070 #
2071 # If the user has changes, regardless of whether those changes are
2072 # committed, and regardless of whether those changes conflict, then
2073 # we'll attempt to merge them either implicitly (uncommitted) or
2074 # explicitly (committed).
2075 #
2076 # These are the messages we'll use to help clarify mercurial output
2077 # in those cases.
2078 #
2079 typeset mergefailmsg="\
2080 ***\n\
2081 *** nightly was unable to automatically merge your changes. You should\n\
2082 *** redo the full merge manually, following the steps outlined by mercurial\n\
2083 *** above, then restart nightly.\n\
2084 ***\n"
2085 typeset mergepassmsg="\
2086 ***\n\
2087 *** nightly successfully merged your changes. This means that your working\n\
2146 printf "%s: merge failed as follows:\n\n" \
2147 "$CODEMGR_WS"
2148 cat $TMPDIR/pull_open.out
2149 if grep "^merging.*failed" $TMPDIR/pull_open.out \
2150 > /dev/null 2>&1; then
2151 printf "$mergefailmsg"
2152 fi
2153 touch $TMPDIR/bringover_failed
2154 return
2155 fi
2156 fi
2157
2158 printf "updated %s with the following results:\n" "$CODEMGR_WS"
2159 cat $TMPDIR/pull_open.out
2160 if grep "^merging" $TMPDIR/pull_open.out >/dev/null 2>&1; then
2161 printf "$mergepassmsg"
2162 fi
2163 printf "\n"
2164
2165 #
2166 # Per-changeset output is neither useful nor manageable for a
2167 # newly-created repository.
2168 #
2169 if [ -f $TMPDIR/new_repository ]; then
2170 return
2171 fi
2172
2173 printf "\nadded the following changesets to open repository:\n"
2174 cat $TMPDIR/incoming_open.out
2175
2176 #
2177 # The closed repository could have been newly created, even though
2178 # the open one previously existed...
2179 #
2180 if [ -f $TMPDIR/new_closed ]; then
2181 return
2182 fi
2183
2184 if [ -f $TMPDIR/incoming_closed.out ]; then
2185 printf "\nadded the following changesets to closed repository:\n"
2242 eval "bringover_${PARENT_SCM_TYPE}" 2>&1 |
2243 tee -a $mail_msg_file >> $LOGFILE
2244
2245 if [ -f $TMPDIR/bringover_failed ]; then
2246 rm -f $TMPDIR/bringover_failed
2247 build_ok=n
2248 echo "trouble with bringover, quitting at `date`." |
2249 tee -a $mail_msg_file >> $LOGFILE
2250 exit 1
2251 fi
2252
2253 #
2254 # It's possible that we used the bringover above to create
2255 # $CODEMGR_WS. If so, then SCM_TYPE was previously "none,"
2256 # but should now be the same as $BRINGOVER_WS.
2257 #
2258 [[ $SCM_TYPE = none ]] && SCM_TYPE=$PARENT_SCM_TYPE
2259
2260 run_hook POST_BRINGOVER
2261
2262 check_closed_tree
2263
2264 else
2265 echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE
2266 fi
2267
2268 if [[ "$O_FLAG" = y ]]; then
2269 build_ok=n
2270 echo "OpenSolaris binary deliverables need usr/closed." \
2271 | tee -a "$mail_msg_file" >> $LOGFILE
2272 exit 1
2273 fi
2274
2275 # Safeguards
2276 [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
2277 [[ -d "${CODEMGR_WS}" ]] || fatal_error "Error: ${CODEMGR_WS} is not a directory."
2278 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
2279
2280 echo "\n==== Build environment ====\n" | tee -a $build_environ_file >> $LOGFILE
2281
2282 # System
2283 whence uname | tee -a $build_environ_file >> $LOGFILE
2284 uname -a 2>&1 | tee -a $build_environ_file >> $LOGFILE
2285 echo | tee -a $build_environ_file >> $LOGFILE
2286
2287 # make
2288 whence $MAKE | tee -a $build_environ_file >> $LOGFILE
2428 >> $mail_msg_file
2429 else
2430 echo "\n==== DOMESTIC extraction failed ====\n" \
2431 >> $mail_msg_file
2432 fi
2433
2434 fi
2435
2436 if [ "$SO_FLAG" = "y" -a "$build_ok" = y ]; then
2437 #
2438 # Copy the open sources into their own tree.
2439 # If copy_source fails, it will have already generated an
2440 # error message and set build_ok=n, so we don't need to worry
2441 # about that here.
2442 #
2443 copy_source $CODEMGR_WS $OPEN_SRCDIR OPEN_SOURCE usr/src
2444 fi
2445
2446 if [ "$SO_FLAG" = "y" -a "$build_ok" = y ]; then
2447 SRC=$OPEN_SRCDIR/usr/src
2448 fi
2449
2450 if is_source_build && [ $build_ok = y ] ; then
2451 # remove proto area(s) here, since we don't clobber
2452 rm -rf `allprotos`
2453 if [ "$t_FLAG" = "y" ]; then
2454 set_non_debug_build_flags
2455 ORIG_TOOLS=$TOOLS
2456 #
2457 # SRC was set earlier to point to the source build
2458 # source tree (e.g., $EXPORT_SRC).
2459 #
2460 TOOLS=${SRC}/tools
2461 TOOLS_PROTO=${TOOLS}/${TOOLS_PROTO_REL}; export TOOLS_PROTO
2462 build_tools ${TOOLS_PROTO}
2463 if [[ $? != 0 ]]; then
2464 use_tools ${TOOLS_PROTO}
2465 fi
2466 fi
2467
|