Print this page
4030 remove useless nightly/bldenv options
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
1 1 #!/bin/ksh -p
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 24 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 25 # Copyright 2008, 2010, Richard Lowe
26 26 # Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27 27 # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
28 28 #
29 29 # Based on the nightly script from the integration folks,
30 30 # Mostly modified and owned by mike_s.
31 31 # Changes also by kjc, dmk.
32 32 #
33 33 # BRINGOVER_WS may be specified in the env file.
34 34 # The default is the old behavior of CLONE_WS
35 35 #
36 36 # -i on the command line, means fast options, so when it's on the
37 37 # command line (only), lint and check builds are skipped no matter what
38 38 # the setting of their individual flags are in NIGHTLY_OPTIONS.
39 39 #
40 40 # LINTDIRS can be set in the env file, format is a list of:
41 41 #
42 42 # /dirname-to-run-lint-on flag
43 43 #
44 44 # Where flag is: y - enable lint noise diff output
45 45 # n - disable lint noise diff output
46 46 #
47 47 # For example: LINTDIRS="$SRC/uts n $SRC/stand y $SRC/psm y"
48 48 #
49 49 # OPTHOME and TEAMWARE may be set in the environment to override /opt
50 50 # and /opt/teamware defaults.
51 51 #
52 52
53 53 #
54 54 # The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
55 55 # under certain circumstances, which can really screw things up; unset it.
56 56 #
57 57 unset CDPATH
58 58
59 59 # Get the absolute path of the nightly script that the user invoked. This
60 60 # may be a relative path, and we need to do this before changing directory.
61 61 nightly_path=`whence $0`
62 62
63 63 #
64 64 # Keep track of where we found nightly so we can invoke the matching
65 65 # which_scm script. If that doesn't work, don't go guessing, just rely
66 66 # on the $PATH settings, which will generally give us either /opt/onbld
67 67 # or the user's workspace.
68 68 #
69 69 WHICH_SCM=$(dirname $nightly_path)/which_scm
70 70 if [[ ! -x $WHICH_SCM ]]; then
71 71 WHICH_SCM=which_scm
72 72 fi
73 73
74 74 function fatal_error
75 75 {
76 76 print -u2 "nightly: $*"
77 77 exit 1
78 78 }
79 79
80 80 #
81 81 # Function to do a DEBUG and non-DEBUG build. Needed because we might
82 82 # need to do another for the source build, and since we only deliver DEBUG or
83 83 # non-DEBUG packages.
84 84 #
85 85 # usage: normal_build
86 86 #
87 87 function normal_build {
88 88
89 89 typeset orig_p_FLAG="$p_FLAG"
90 90 typeset crypto_signer="$CODESIGN_USER"
91 91
92 92 suffix=""
93 93
94 94 # non-DEBUG build begins
95 95
96 96 if [ "$F_FLAG" = "n" ]; then
97 97 set_non_debug_build_flags
98 98 CODESIGN_USER="$crypto_signer" \
99 99 build "non-DEBUG" "$suffix-nd" "-nd" "$MULTI_PROTO"
100 100 if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a \
101 101 "$p_FLAG" = "y" ]; then
102 102 copy_ihv_pkgs non-DEBUG -nd
103 103 fi
104 104 else
105 105 echo "\n==== No non-DEBUG $open_only build ====\n" >> "$LOGFILE"
106 106 fi
107 107
108 108 # non-DEBUG build ends
109 109
110 110 # DEBUG build begins
111 111
112 112 if [ "$D_FLAG" = "y" ]; then
113 113 set_debug_build_flags
114 114 CODESIGN_USER="$crypto_signer" \
115 115 build "DEBUG" "$suffix" "" "$MULTI_PROTO"
116 116 if [ "$build_ok" = "y" -a "$X_FLAG" = "y" -a \
117 117 "$p_FLAG" = "y" ]; then
118 118 copy_ihv_pkgs DEBUG ""
119 119 fi
120 120 else
121 121 echo "\n==== No DEBUG $open_only build ====\n" >> "$LOGFILE"
122 122 fi
123 123
124 124 # DEBUG build ends
125 125
126 126 p_FLAG="$orig_p_FLAG"
127 127 }
128 128
129 129 #
130 130 # usage: run_hook HOOKNAME ARGS...
131 131 #
132 132 # If variable "$HOOKNAME" is defined, insert a section header into
133 133 # our logs and then run the command with ARGS
134 134 #
135 135 function run_hook {
136 136 HOOKNAME=$1
137 137 eval HOOKCMD=\$$HOOKNAME
138 138 shift
139 139
140 140 if [ -n "$HOOKCMD" ]; then
141 141 (
142 142 echo "\n==== Running $HOOKNAME command: $HOOKCMD ====\n"
143 143 ( $HOOKCMD "$@" 2>&1 )
144 144 if [ "$?" -ne 0 ]; then
145 145 # Let exit status propagate up
146 146 touch $TMPDIR/abort
147 147 fi
148 148 ) | tee -a $mail_msg_file >> $LOGFILE
149 149
150 150 if [ -f $TMPDIR/abort ]; then
151 151 build_ok=n
152 152 echo "\nAborting at request of $HOOKNAME" |
153 153 tee -a $mail_msg_file >> $LOGFILE
154 154 exit 1
155 155 fi
156 156 fi
157 157 }
158 158
159 159 #
160 160 # usage: filelist DESTDIR PATTERN
161 161 #
162 162 function filelist {
163 163 DEST=$1
164 164 PATTERN=$2
165 165 cd ${DEST}
166 166 }
167 167
168 168 # function to save off binaries after a full build for later
169 169 # restoration
170 170 function save_binaries {
171 171 # save off list of binaries
172 172 echo "\n==== Saving binaries from build at `date` ====\n" | \
173 173 tee -a $mail_msg_file >> $LOGFILE
174 174 rm -f ${BINARCHIVE}
175 175 cd ${CODEMGR_WS}
176 176 filelist ${CODEMGR_WS} '^preserve:' >> $LOGFILE
177 177 filelist ${CODEMGR_WS} '^preserve:' | \
178 178 cpio -ocB 2>/dev/null | compress \
179 179 > ${BINARCHIVE}
180 180 }
181 181
182 182 # delete files
183 183 # usage: hybridize_files DESTDIR MAKE_TARGET
184 184 function hybridize_files {
185 185 DEST=$1
186 186 MAKETARG=$2
187 187
188 188 echo "\n==== Hybridizing files at `date` ====\n" | \
189 189 tee -a $mail_msg_file >> $LOGFILE
190 190 for i in `filelist ${DEST} '^delete:'`
191 191 do
192 192 echo "removing ${i}." | tee -a $mail_msg_file >> $LOGFILE
193 193 rm -rf "${i}"
194 194 done
195 195 for i in `filelist ${DEST} '^hybridize:' `
196 196 do
197 197 echo "hybridizing ${i}." | tee -a $mail_msg_file >> $LOGFILE
198 198 rm -f ${i}+
199 199 sed -e "/^# HYBRID DELETE START/,/^# HYBRID DELETE END/d" \
200 200 < ${i} > ${i}+
201 201 mv ${i}+ ${i}
202 202 done
203 203 }
204 204
205 205 # restore binaries into the proper source tree.
206 206 # usage: restore_binaries DESTDIR MAKE_TARGET
207 207 function restore_binaries {
208 208 DEST=$1
209 209 MAKETARG=$2
210 210
211 211 echo "\n==== Restoring binaries to ${MAKETARG} at `date` ====\n" | \
212 212 tee -a $mail_msg_file >> $LOGFILE
213 213 cd ${DEST}
214 214 zcat ${BINARCHIVE} | \
215 215 cpio -idmucvB 2>/dev/null | tee -a $mail_msg_file >> ${LOGFILE}
216 216 }
217 217
218 218 # rename files we save binaries of
219 219 # usage: rename_files DESTDIR MAKE_TARGET
220 220 function rename_files {
221 221 DEST=$1
222 222 MAKETARG=$2
↓ open down ↓ |
222 lines elided |
↑ open up ↑ |
223 223 echo "\n==== Renaming source files in ${MAKETARG} at `date` ====\n" | \
224 224 tee -a $mail_msg_file >> $LOGFILE
225 225 for i in `filelist ${DEST} '^rename:'`
226 226 do
227 227 echo ${i} | tee -a $mail_msg_file >> ${LOGFILE}
228 228 rm -f ${i}.export
229 229 mv ${i} ${i}.export
230 230 done
231 231 }
232 232
233 -#
234 -# Copy some or all of the source tree.
235 -#
236 -# Returns 0 for success, non-zero for failure.
237 -#
238 -# usage: copy_source CODEMGR_WS DESTDIR LABEL SRCROOT
239 -#
240 -function copy_source {
241 - WS=$1
242 - DEST=$2
243 - label=$3
244 - srcroot=$4
245 -
246 - printf "\n==== Creating %s source from %s (%s) ====\n\n" \
247 - "$DEST" "$WS" "$label" | tee -a $mail_msg_file >> $LOGFILE
248 -
249 - printf "cleaning out %s\n" "$DEST." >> $LOGFILE
250 - rm -rf "$DEST" >> $LOGFILE 2>&1
251 -
252 - printf "creating %s\n" "$DEST." >> $LOGFILE
253 - mkdir -p "$DEST" 2>> $LOGFILE
254 -
255 - if (( $? != 0 )) ; then
256 - printf "failed to create %s\n" "$DEST" |
257 - tee -a $mail_msg_file >> $LOGFILE
258 - build_ok=n
259 - return 1
260 - fi
261 - cd "$WS"
262 -
263 - printf "populating %s\n" "$DEST." >> $LOGFILE
264 -
265 - case "$SCM_TYPE" in
266 - teamware)
267 - find $srcroot -name 's\.*' -a -type f -print | \
268 - sed -e 's,SCCS\/s.,,' | \
269 - grep -v '/\.del-*' | \
270 - cpio -pd $DEST >>$LOGFILE 2>&1
271 - if (( $? != 0 )) ; then
272 - printf "cpio failed for %s\n" "$DEST" |
273 - tee -a $mail_msg_file >> $LOGFILE
274 - build_ok=n
275 - return 1
276 - fi
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
333 - return
334 - fi
335 -
336 - SRC=${DEST}/usr/src
337 -
338 - cd $SRC
339 - rm -f ${MAKETARG}.out
340 - echo "making ${MAKETARG} in ${SRC}." >> $LOGFILE
341 - /bin/time $MAKE -e ${MAKETARG} 2>&1 | \
342 - tee -a $SRC/${MAKETARG}.out >> $LOGFILE
343 - echo "\n==== ${MAKETARG} build errors ====\n" >> $mail_msg_file
344 - egrep ":" $SRC/${MAKETARG}.out | \
345 - egrep -e "(^${MAKE}:|[ ]error[: \n])" | \
346 - egrep -v "Ignoring unknown host" | \
347 - egrep -v "warning" >> $mail_msg_file
348 -
349 - echo "clearing state files." >> $LOGFILE
350 - find . -name '.make*' -exec rm -f {} \;
351 -}
352 -
353 233 # Return library search directive as function of given root.
354 234 function myldlibs {
355 235 echo "-L$1/lib -L$1/usr/lib"
356 236 }
357 237
358 238 # Return header search directive as function of given root.
359 239 function myheaders {
360 240 echo "-I$1/usr/include"
361 241 }
362 242
363 243 #
364 244 # Function to do the build, including package generation.
365 245 # usage: build LABEL SUFFIX ND MULTIPROTO
366 246 # - LABEL is used to tag build output.
367 247 # - SUFFIX is used to distinguish files (e.g., DEBUG vs non-DEBUG,
368 248 # open-only vs full tree).
369 249 # - ND is "-nd" (non-DEBUG builds) or "" (DEBUG builds).
370 250 # - If MULTIPROTO is "yes", it means to name the proto area according to
371 251 # SUFFIX. Otherwise ("no"), (re)use the standard proto area.
372 252 #
373 253 function build {
374 254 LABEL=$1
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
375 255 SUFFIX=$2
376 256 ND=$3
377 257 MULTIPROTO=$4
378 258 INSTALLOG=install${SUFFIX}-${MACH}
379 259 NOISE=noise${SUFFIX}-${MACH}
380 260 PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX}
381 261
382 262 ORIGROOT=$ROOT
383 263 [ $MULTIPROTO = no ] || export ROOT=$ROOT$SUFFIX
384 264
385 - if [[ "$O_FLAG" = y ]]; then
386 - echo "\nSetting CLOSEDROOT= ${ROOT}-closed\n" >> $LOGFILE
387 - export CLOSEDROOT=${ROOT}-closed
388 - fi
389 -
390 265 export ENVLDLIBS1=`myldlibs $ROOT`
391 266 export ENVCPPFLAGS1=`myheaders $ROOT`
392 267
393 268 this_build_ok=y
394 269 #
395 270 # Build OS-Networking source
396 271 #
397 272 echo "\n==== Building OS-Net source at `date` ($LABEL) ====\n" \
398 273 >> $LOGFILE
399 274
400 275 rm -f $SRC/${INSTALLOG}.out
401 276 cd $SRC
402 277 /bin/time $MAKE -e install 2>&1 | \
403 278 tee -a $SRC/${INSTALLOG}.out >> $LOGFILE
404 279
405 280 if [[ "$SCM_TYPE" = teamware ]]; then
406 281 echo "\n==== SCCS Noise ($LABEL) ====\n" >> $mail_msg_file
407 282 egrep 'sccs(check:| *get)' $SRC/${INSTALLOG}.out >> \
408 283 $mail_msg_file
409 284 fi
410 285
411 286 echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file
412 287 egrep ":" $SRC/${INSTALLOG}.out |
413 288 egrep -e "(^${MAKE}:|[ ]error[: \n])" | \
414 289 egrep -v "Ignoring unknown host" | \
415 290 egrep -v "cc .* -o error " | \
416 291 egrep -v "warning" >> $mail_msg_file
417 292 if [ "$?" = "0" ]; then
418 293 build_ok=n
419 294 this_build_ok=n
420 295 fi
421 296 grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \
422 297 >> $mail_msg_file
423 298 if [ "$?" = "0" ]; then
424 299 build_ok=n
425 300 this_build_ok=n
426 301 fi
427 302
428 303 if [ "$W_FLAG" = "n" ]; then
429 304 echo "\n==== Build warnings ($LABEL) ====\n" >>$mail_msg_file
430 305 egrep -i warning: $SRC/${INSTALLOG}.out \
431 306 | egrep -v '^tic:' \
432 307 | egrep -v "symbol (\`|')timezone' has differing types:" \
433 308 | egrep -v "parameter <PSTAMP> set to" \
434 309 | egrep -v "Ignoring unknown host" \
435 310 | egrep -v "redefining segment flags attribute for" \
436 311 >> $mail_msg_file
437 312 fi
438 313
439 314 echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \
440 315 >> $LOGFILE
441 316
442 317 echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file
443 318 tail -3 $SRC/${INSTALLOG}.out >>$mail_msg_file
444 319
445 320 if [ "$i_FLAG" = "n" -a "$W_FLAG" = "n" ]; then
446 321 rm -f $SRC/${NOISE}.ref
447 322 if [ -f $SRC/${NOISE}.out ]; then
448 323 mv $SRC/${NOISE}.out $SRC/${NOISE}.ref
449 324 fi
450 325 grep : $SRC/${INSTALLOG}.out \
451 326 | egrep -v '^/' \
452 327 | egrep -v '^(Start|Finish|real|user|sys|./bld_awk)' \
453 328 | egrep -v '^tic:' \
454 329 | egrep -v '^mcs' \
455 330 | egrep -v '^LD_LIBRARY_PATH=' \
456 331 | egrep -v 'ar: creating' \
457 332 | egrep -v 'ar: writing' \
458 333 | egrep -v 'conflicts:' \
459 334 | egrep -v ':saved created' \
460 335 | egrep -v '^stty.*c:' \
461 336 | egrep -v '^mfgname.c:' \
462 337 | egrep -v '^uname-i.c:' \
463 338 | egrep -v '^volumes.c:' \
464 339 | egrep -v '^lint library construction:' \
465 340 | egrep -v 'tsort: INFORM:' \
466 341 | egrep -v 'stripalign:' \
467 342 | egrep -v 'chars, width' \
468 343 | egrep -v "symbol (\`|')timezone' has differing types:" \
469 344 | egrep -v 'PSTAMP' \
470 345 | egrep -v '|%WHOANDWHERE%|' \
471 346 | egrep -v '^Manifying' \
472 347 | egrep -v 'Ignoring unknown host' \
473 348 | egrep -v 'Processing method:' \
474 349 | egrep -v '^Writing' \
475 350 | egrep -v 'spellin1:' \
476 351 | egrep -v '^adding:' \
477 352 | egrep -v "^echo 'msgid" \
478 353 | egrep -v '^echo ' \
479 354 | egrep -v '\.c:$' \
480 355 | egrep -v '^Adding file:' \
481 356 | egrep -v 'CLASSPATH=' \
482 357 | egrep -v '\/var\/mail\/:saved' \
483 358 | egrep -v -- '-DUTS_VERSION=' \
484 359 | egrep -v '^Running Mkbootstrap' \
485 360 | egrep -v '^Applet length read:' \
486 361 | egrep -v 'bytes written:' \
487 362 | egrep -v '^File:SolarisAuthApplet.bin' \
488 363 | egrep -v -i 'jibversion' \
489 364 | egrep -v '^Output size:' \
490 365 | egrep -v '^Solo size statistics:' \
491 366 | egrep -v '^Using ROM API Version' \
492 367 | egrep -v '^Zero Signature length:' \
493 368 | egrep -v '^Note \(probably harmless\):' \
494 369 | egrep -v '::' \
495 370 | egrep -v -- '-xcache' \
496 371 | egrep -v '^\+' \
497 372 | egrep -v '^cc1: note: -fwritable-strings' \
498 373 | egrep -v 'svccfg-native -s svc:/' \
499 374 | sort | uniq >$SRC/${NOISE}.out
500 375 if [ ! -f $SRC/${NOISE}.ref ]; then
501 376 cp $SRC/${NOISE}.out $SRC/${NOISE}.ref
502 377 fi
503 378 echo "\n==== Build noise differences ($LABEL) ====\n" \
504 379 >>$mail_msg_file
505 380 diff $SRC/${NOISE}.ref $SRC/${NOISE}.out >>$mail_msg_file
506 381 fi
507 382
508 383 #
509 384 # Re-sign selected binaries using signing server
510 385 # (gatekeeper builds only)
511 386 #
512 387 if [ -n "$CODESIGN_USER" -a "$this_build_ok" = "y" ]; then
513 388 echo "\n==== Signing proto area at `date` ====\n" >> $LOGFILE
514 389 signing_file="${TMPDIR}/signing"
515 390 rm -f ${signing_file}
516 391 export CODESIGN_USER
517 392 signproto $SRC/tools/codesign/creds 2>&1 | \
518 393 tee -a ${signing_file} >> $LOGFILE
519 394 echo "\n==== Finished signing proto area at `date` ====\n" \
520 395 >> $LOGFILE
521 396 echo "\n==== Crypto module signing errors ($LABEL) ====\n" \
522 397 >> $mail_msg_file
523 398 egrep 'WARNING|ERROR' ${signing_file} >> $mail_msg_file
524 399 if (( $? == 0 )) ; then
525 400 build_ok=n
526 401 this_build_ok=n
527 402 fi
528 403 fi
529 404
530 405 #
531 406 # Building Packages
532 407 #
533 408 if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then
534 409 if [ -d $SRC/pkg -o -d $SRC/pkgdefs ]; then
535 410 echo "\n==== Creating $LABEL packages at `date` ====\n" \
536 411 >> $LOGFILE
537 412 echo "Clearing out $PKGARCHIVE ..." >> $LOGFILE
538 413 rm -rf $PKGARCHIVE >> "$LOGFILE" 2>&1
539 414 mkdir -p $PKGARCHIVE >> "$LOGFILE" 2>&1
540 415
541 416 for d in pkg pkgdefs; do
542 417 if [ ! -f "$SRC/$d/Makefile" ]; then
543 418 continue
544 419 fi
545 420 rm -f $SRC/$d/${INSTALLOG}.out
546 421 cd $SRC/$d
547 422 /bin/time $MAKE -e install 2>&1 | \
548 423 tee -a $SRC/$d/${INSTALLOG}.out >> $LOGFILE
549 424 done
550 425
551 426 echo "\n==== package build errors ($LABEL) ====\n" \
552 427 >> $mail_msg_file
553 428
554 429 for d in pkg pkgdefs; do
555 430 if [ ! -f "$SRC/$d/Makefile" ]; then
556 431 continue
557 432 fi
558 433
559 434 egrep "${MAKE}|ERROR|WARNING" $SRC/$d/${INSTALLOG}.out | \
560 435 grep ':' | \
561 436 grep -v PSTAMP | \
562 437 egrep -v "Ignoring unknown host" \
563 438 >> $mail_msg_file
564 439 done
565 440 else
566 441 #
567 442 # Handle it gracefully if -p was set but there are
568 443 # neither pkg nor pkgdefs directories.
569 444 #
570 445 echo "\n==== No $LABEL packages to build ====\n" \
571 446 >> $LOGFILE
572 447 fi
573 448 else
574 449 echo "\n==== Not creating $LABEL packages ====\n" >> $LOGFILE
575 450 fi
576 451
577 452 ROOT=$ORIGROOT
578 453 }
579 454
580 455 # Usage: dolint /dir y|n
581 456 # Arg. 2 is a flag to turn on/off the lint diff output
582 457 function dolint {
583 458 if [ ! -d "$1" ]; then
584 459 echo "dolint error: $1 is not a directory"
585 460 exit 1
586 461 fi
587 462
588 463 if [ "$2" != "y" -a "$2" != "n" ]; then
589 464 echo "dolint internal error: $2 should be 'y' or 'n'"
590 465 exit 1
591 466 fi
592 467
593 468 lintdir=$1
594 469 dodiff=$2
595 470 base=`basename $lintdir`
596 471 LINTOUT=$lintdir/lint-${MACH}.out
597 472 LINTNOISE=$lintdir/lint-noise-${MACH}
598 473 export ENVLDLIBS1=`myldlibs $ROOT`
599 474 export ENVCPPFLAGS1=`myheaders $ROOT`
600 475
601 476 set_debug_build_flags
602 477
603 478 #
604 479 # '$MAKE lint' in $lintdir
605 480 #
606 481 echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
607 482
608 483 # remove old lint.out
609 484 rm -f $lintdir/lint.out $lintdir/lint-noise.out
610 485 if [ -f $lintdir/lint-noise.ref ]; then
611 486 mv $lintdir/lint-noise.ref ${LINTNOISE}.ref
612 487 fi
613 488
614 489 rm -f $LINTOUT
615 490 cd $lintdir
616 491 #
617 492 # Remove all .ln files to ensure a full reference file
618 493 #
619 494 rm -f Nothing_to_remove \
620 495 `find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \) \
621 496 -prune -o -type f -name '*.ln' -print `
622 497
623 498 /bin/time $MAKE -ek lint 2>&1 | \
624 499 tee -a $LINTOUT >> $LOGFILE
625 500 echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file
626 501 grep "$MAKE:" $LINTOUT |
627 502 egrep -v "Ignoring unknown host" \
628 503 >> $mail_msg_file
629 504
630 505 echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
631 506
632 507 echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \
633 508 >>$mail_msg_file
634 509 tail -3 $LINTOUT >>$mail_msg_file
635 510
636 511 rm -f ${LINTNOISE}.ref
637 512 if [ -f ${LINTNOISE}.out ]; then
638 513 mv ${LINTNOISE}.out ${LINTNOISE}.ref
639 514 fi
640 515 grep : $LINTOUT | \
641 516 egrep -v '^(real|user|sys)' |
642 517 egrep -v '(library construction)' | \
643 518 egrep -v ': global crosschecks' | \
644 519 egrep -v 'Ignoring unknown host' | \
645 520 egrep -v '\.c:$' | \
646 521 sort | uniq > ${LINTNOISE}.out
647 522 if [ ! -f ${LINTNOISE}.ref ]; then
648 523 cp ${LINTNOISE}.out ${LINTNOISE}.ref
649 524 fi
650 525 if [ "$dodiff" != "n" ]; then
651 526 echo "\n==== lint warnings $base ====\n" \
652 527 >>$mail_msg_file
653 528 # should be none, though there are a few that were filtered out
654 529 # above
655 530 egrep -i '(warning|lint):' ${LINTNOISE}.out \
656 531 | sort | uniq >> $mail_msg_file
657 532 echo "\n==== lint noise differences $base ====\n" \
658 533 >> $mail_msg_file
659 534 diff ${LINTNOISE}.ref ${LINTNOISE}.out \
660 535 >> $mail_msg_file
661 536 fi
662 537 }
663 538
664 539 # Install proto area from IHV build
665 540
666 541 function copy_ihv_proto {
667 542
668 543 echo "\n==== Installing IHV proto area ====\n" \
669 544 >> $LOGFILE
670 545 if [ -d "$IA32_IHV_ROOT" ]; then
671 546 if [ ! -d "$ROOT" ]; then
672 547 echo "mkdir -p $ROOT" >> $LOGFILE
673 548 mkdir -p $ROOT
674 549 fi
675 550 echo "copying $IA32_IHV_ROOT to $ROOT\n" >> $LOGFILE
676 551 cd $IA32_IHV_ROOT
677 552 tar cf - . | (cd $ROOT; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
678 553 else
679 554 echo "$IA32_IHV_ROOT: not found" >> $LOGFILE
680 555 fi
681 556
682 557 if [ "$MULTI_PROTO" = yes ]; then
683 558 if [ ! -d "$ROOT-nd" ]; then
684 559 echo "mkdir -p $ROOT-nd" >> $LOGFILE
685 560 mkdir -p $ROOT-nd
686 561 fi
687 562 # If there's a non-DEBUG version of the IHV proto area,
688 563 # copy it, but copy something if there's not.
689 564 if [ -d "$IA32_IHV_ROOT-nd" ]; then
690 565 echo "copying $IA32_IHV_ROOT-nd to $ROOT-nd\n" >> $LOGFILE
691 566 cd $IA32_IHV_ROOT-nd
692 567 elif [ -d "$IA32_IHV_ROOT" ]; then
693 568 echo "copying $IA32_IHV_ROOT to $ROOT-nd\n" >> $LOGFILE
694 569 cd $IA32_IHV_ROOT
695 570 else
696 571 echo "$IA32_IHV_ROOT{-nd,}: not found" >> $LOGFILE
697 572 return
698 573 fi
699 574 tar cf - . | (cd $ROOT-nd; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
700 575 fi
701 576 }
702 577
703 578 # Install IHV packages in PKGARCHIVE
704 579 # usage: copy_ihv_pkgs LABEL SUFFIX
705 580 function copy_ihv_pkgs {
706 581 LABEL=$1
707 582 SUFFIX=$2
708 583 # always use non-DEBUG IHV packages
709 584 IA32_IHV_PKGS=${IA32_IHV_PKGS_ORIG}-nd
710 585 PKGARCHIVE=${PKGARCHIVE_ORIG}${SUFFIX}
711 586
712 587 echo "\n==== Installing IHV packages from $IA32_IHV_PKGS ($LABEL) ====\n" \
713 588 >> $LOGFILE
714 589 if [ -d "$IA32_IHV_PKGS" ]; then
715 590 cd $IA32_IHV_PKGS
716 591 tar cf - * | \
717 592 (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
718 593 else
719 594 echo "$IA32_IHV_PKGS: not found" >> $LOGFILE
720 595 fi
721 596
722 597 echo "\n==== Installing IHV packages from $IA32_IHV_BINARY_PKGS ($LABEL) ====\n" \
723 598 >> $LOGFILE
724 599 if [ -d "$IA32_IHV_BINARY_PKGS" ]; then
725 600 cd $IA32_IHV_BINARY_PKGS
726 601 tar cf - * | \
727 602 (cd $PKGARCHIVE; umask 0; tar xpf - ) 2>&1 >> $LOGFILE
728 603 else
729 604 echo "$IA32_IHV_BINARY_PKGS: not found" >> $LOGFILE
730 605 fi
731 606 }
732 607
733 608 #
734 609 # Build and install the onbld tools.
735 610 #
736 611 # usage: build_tools DESTROOT
737 612 #
738 613 # returns non-zero status if the build was successful.
739 614 #
740 615 function build_tools {
741 616 DESTROOT=$1
742 617
743 618 INSTALLOG=install-${MACH}
744 619
745 620 echo "\n==== Building tools at `date` ====\n" \
746 621 >> $LOGFILE
747 622
748 623 rm -f ${TOOLS}/${INSTALLOG}.out
749 624 cd ${TOOLS}
750 625 /bin/time $MAKE TOOLS_PROTO=${DESTROOT} -e install 2>&1 | \
751 626 tee -a ${TOOLS}/${INSTALLOG}.out >> $LOGFILE
752 627
753 628 echo "\n==== Tools build errors ====\n" >> $mail_msg_file
754 629
755 630 egrep ":" ${TOOLS}/${INSTALLOG}.out |
756 631 egrep -e "(${MAKE}:|[ ]error[: \n])" | \
757 632 egrep -v "Ignoring unknown host" | \
758 633 egrep -v warning >> $mail_msg_file
759 634 return $?
760 635 }
761 636
762 637 #
763 638 # Set up to use locally installed tools.
764 639 #
765 640 # usage: use_tools TOOLSROOT
766 641 #
767 642 function use_tools {
768 643 TOOLSROOT=$1
769 644
770 645 #
771 646 # If we're not building ON workspace, then the TOOLSROOT
772 647 # settings here are clearly ignored by the workspace
773 648 # makefiles, prepending nonexistent directories to PATH is
774 649 # harmless, and we clearly do not wish to override
775 650 # ONBLD_TOOLS.
776 651 #
777 652 # If we're building an ON workspace, then the prepended PATH
778 653 # elements should supercede the preexisting ONBLD_TOOLS paths,
779 654 # and we want to override ONBLD_TOOLS to catch the tools that
780 655 # don't have specific path env vars here.
781 656 #
782 657 # So the only conditional behavior is overriding ONBLD_TOOLS,
783 658 # and we check for "an ON workspace" by looking for
784 659 # ${TOOLSROOT}/opt/onbld.
785 660 #
786 661
787 662 STABS=${TOOLSROOT}/opt/onbld/bin/${MACH}/stabs
788 663 export STABS
789 664 CTFSTABS=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfstabs
790 665 export CTFSTABS
791 666 GENOFFSETS=${TOOLSROOT}/opt/onbld/bin/genoffsets
792 667 export GENOFFSETS
793 668
794 669 CTFCONVERT=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfconvert
795 670 export CTFCONVERT
796 671 CTFMERGE=${TOOLSROOT}/opt/onbld/bin/${MACH}/ctfmerge
797 672 export CTFMERGE
798 673
799 674 CTFCVTPTBL=${TOOLSROOT}/opt/onbld/bin/ctfcvtptbl
800 675 export CTFCVTPTBL
801 676 CTFFINDMOD=${TOOLSROOT}/opt/onbld/bin/ctffindmod
802 677 export CTFFINDMOD
803 678
804 679 if [ "$VERIFY_ELFSIGN" = "y" ]; then
805 680 ELFSIGN=${TOOLSROOT}/opt/onbld/bin/elfsigncmp
806 681 else
807 682 ELFSIGN=${TOOLSROOT}/opt/onbld/bin/${MACH}/elfsign
808 683 fi
809 684 export ELFSIGN
810 685
811 686 PATH="${TOOLSROOT}/opt/onbld/bin/${MACH}:${PATH}"
812 687 PATH="${TOOLSROOT}/opt/onbld/bin:${PATH}"
813 688 export PATH
814 689
815 690 if [ -d "${TOOLSROOT}/opt/onbld" ]; then
816 691 ONBLD_TOOLS=${TOOLSROOT}/opt/onbld
817 692 export ONBLD_TOOLS
818 693 fi
819 694
820 695 echo "\n==== New environment settings. ====\n" >> $LOGFILE
821 696 echo "STABS=${STABS}" >> $LOGFILE
822 697 echo "CTFSTABS=${CTFSTABS}" >> $LOGFILE
823 698 echo "CTFCONVERT=${CTFCONVERT}" >> $LOGFILE
824 699 echo "CTFMERGE=${CTFMERGE}" >> $LOGFILE
825 700 echo "CTFCVTPTBL=${CTFCVTPTBL}" >> $LOGFILE
826 701 echo "CTFFINDMOD=${CTFFINDMOD}" >> $LOGFILE
827 702 echo "ELFSIGN=${ELFSIGN}" >> $LOGFILE
828 703 echo "PATH=${PATH}" >> $LOGFILE
829 704 echo "ONBLD_TOOLS=${ONBLD_TOOLS}" >> $LOGFILE
830 705 }
831 706
832 707 function staffer {
833 708 if [ $ISUSER -ne 0 ]; then
834 709 "$@"
835 710 else
836 711 arg="\"$1\""
837 712 shift
838 713 for i
839 714 do
840 715 arg="$arg \"$i\""
841 716 done
842 717 eval su $STAFFER -c \'$arg\'
843 718 fi
844 719 }
845 720
846 721 #
847 722 # Verify that the closed tree is present if it needs to be.
848 723 #
849 724 function check_closed_tree {
850 725 if [[ ! -d "$ON_CLOSED_BINS" ]]; then
851 726 echo "ON_CLOSED_BINS must point to the closed binaries tree."
852 727 build_ok=n
853 728 exit 1
854 729 fi
855 730 }
856 731
857 732 function obsolete_build {
858 733 echo "WARNING: Obsolete $1 build requested; request will be ignored"
859 734 }
860 735
861 736 #
862 737 # wrapper over wsdiff.
863 738 # usage: do_wsdiff LABEL OLDPROTO NEWPROTO
864 739 #
865 740 function do_wsdiff {
866 741 label=$1
867 742 oldproto=$2
868 743 newproto=$3
869 744
870 745 wsdiff="wsdiff"
871 746 [ "$t_FLAG" = y ] && wsdiff="wsdiff -t"
872 747
873 748 echo "\n==== Getting object changes since last build at `date`" \
874 749 "($label) ====\n" | tee -a $LOGFILE >> $mail_msg_file
875 750 $wsdiff -s -r ${TMPDIR}/wsdiff.results $oldproto $newproto 2>&1 | \
876 751 tee -a $LOGFILE >> $mail_msg_file
877 752 echo "\n==== Object changes determined at `date` ($label) ====\n" | \
878 753 tee -a $LOGFILE >> $mail_msg_file
879 754 }
880 755
881 756 #
882 757 # Functions for setting build flags (DEBUG/non-DEBUG). Keep them
883 758 # together.
884 759 #
885 760
886 761 function set_non_debug_build_flags {
887 762 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD=
888 763 export RELEASE_BUILD ; RELEASE_BUILD=
889 764 unset EXTRA_OPTIONS
890 765 unset EXTRA_CFLAGS
891 766 }
892 767
893 768 function set_debug_build_flags {
894 769 export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD=
895 770 unset RELEASE_BUILD
896 771 unset EXTRA_OPTIONS
897 772 unset EXTRA_CFLAGS
898 773 }
899 774
900 775
901 776 MACH=`uname -p`
↓ open down ↓ |
502 lines elided |
↑ open up ↑ |
902 777
903 778 if [ "$OPTHOME" = "" ]; then
904 779 OPTHOME=/opt
905 780 export OPTHOME
906 781 fi
907 782 if [ "$TEAMWARE" = "" ]; then
908 783 TEAMWARE=$OPTHOME/teamware
909 784 export TEAMWARE
910 785 fi
911 786
912 -USAGE='Usage: nightly [-in] [+t] [-V VERS ] [ -S E|D|H|O ] <env_file>
787 +USAGE='Usage: nightly [-in] [+t] [-V VERS ] <env_file>
913 788
914 789 Where:
915 790 -i Fast incremental options (no clobber, lint, check)
916 791 -n Do not do a bringover
917 792 +t Use the build tools in $ONBLD_TOOLS/bin
918 793 -V VERS set the build version string to VERS
919 - -S Build a variant of the source product
920 - E - build exportable source
921 - D - build domestic source (exportable + crypt)
922 - H - build hybrid source (binaries + deleted source)
923 - O - build (only) open source
924 794
925 795 <env_file> file in Bourne shell syntax that sets and exports
926 796 variables that configure the operation of this script and many of
927 797 the scripts this one calls. If <env_file> does not exist,
928 798 it will be looked for in $OPTHOME/onbld/env.
929 799
930 800 non-DEBUG is the default build type. Build options can be set in the
931 801 NIGHTLY_OPTIONS variable in the <env_file> as follows:
932 802
933 803 -A check for ABI differences in .so files
934 804 -C check for cstyle/hdrchk errors
935 805 -D do a build with DEBUG on
936 806 -F do _not_ do a non-DEBUG build
937 807 -G gate keeper default group of options (-au)
938 808 -I integration engineer default group of options (-ampu)
939 809 -M do not run pmodes (safe file permission checker)
940 810 -N do not run protocmp
941 - -O generate OpenSolaris deliverables
942 811 -R default group of options for building a release (-mp)
943 812 -U update proto area in the parent
944 813 -V VERS set the build version string to VERS
945 814 -X copy x86 IHV proto area
946 815 -f find unreferenced files
947 816 -i do an incremental build (no "make clobber")
948 817 -l do "make lint" in $LINTDIRS (default: $SRC y)
949 818 -m send mail to $MAILTO at end of build
950 819 -n do not do a bringover
951 820 -o build using root privileges to set OWNER/GROUP (old style)
952 821 -p create packages
953 822 -r check ELF runtime attributes in the proto area
954 823 -t build and use the tools in $SRC/tools (default setting)
955 824 +t Use the build tools in $ONBLD_TOOLS/bin
956 825 -u update proto_list_$MACH and friends in the parent workspace;
957 826 when used with -f, also build an unrefmaster.out in the parent
958 827 -w report on differences between previous and current proto areas
959 828 -z compress cpio archives with gzip
960 829 -W Do not report warnings (freeware gate ONLY)
961 - -S Build a variant of the source product
962 - E - build exportable source
963 - D - build domestic source (exportable + crypt)
964 - H - build hybrid source (binaries + deleted source)
965 - O - build (only) open source
966 830 '
967 831 #
968 832 # A log file will be generated under the name $LOGFILE
969 833 # for partially completed build and log.`date '+%F'`
970 834 # in the same directory for fully completed builds.
971 835 #
972 836
973 837 # default values for low-level FLAGS; G I R are group FLAGS
974 838 A_FLAG=n
975 839 C_FLAG=n
976 840 D_FLAG=n
977 841 F_FLAG=n
978 842 f_FLAG=n
979 843 i_FLAG=n; i_CMD_LINE_FLAG=n
980 844 l_FLAG=n
981 845 M_FLAG=n
982 846 m_FLAG=n
983 847 N_FLAG=n
984 848 n_FLAG=n
985 -O_FLAG=n
986 849 o_FLAG=n
987 850 P_FLAG=n
988 851 p_FLAG=n
989 852 r_FLAG=n
990 853 T_FLAG=n
991 854 t_FLAG=y
992 855 U_FLAG=n
993 856 u_FLAG=n
994 857 V_FLAG=n
995 858 W_FLAG=n
996 859 w_FLAG=n
997 860 X_FLAG=n
998 -SD_FLAG=n
999 -SE_FLAG=n
1000 -SH_FLAG=n
1001 -SO_FLAG=n
1002 861 #
1003 862 XMOD_OPT=
1004 863 #
1005 864 build_ok=y
1006 865
1007 -function is_source_build {
1008 - [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o \
1009 - "$SH_FLAG" = "y" -o "$SO_FLAG" = "y" ]
1010 - return $?
1011 -}
1012 -
1013 866 #
1014 867 # examine arguments
1015 868 #
1016 869
1017 -#
1018 -# single function for setting -S flag and doing error checking.
1019 -# usage: set_S_flag <type>
1020 -# where <type> is the source build type ("E", "D", ...).
1021 -#
1022 -function set_S_flag {
1023 - if is_source_build; then
1024 - echo "Can only build one source variant at a time."
1025 - exit 1
1026 - fi
1027 - if [ "$1" = "E" ]; then
1028 - SE_FLAG=y
1029 - elif [ "$1" = "D" ]; then
1030 - SD_FLAG=y
1031 - elif [ "$1" = "H" ]; then
1032 - SH_FLAG=y
1033 - elif [ "$1" = "O" ]; then
1034 - SO_FLAG=y
1035 - else
1036 - echo "$USAGE"
1037 - exit 1
1038 - fi
1039 -}
1040 -
1041 870 OPTIND=1
1042 -while getopts +inS:tV: FLAG
871 +while getopts +intV: FLAG
1043 872 do
1044 873 case $FLAG in
1045 874 i ) i_FLAG=y; i_CMD_LINE_FLAG=y
1046 875 ;;
1047 876 n ) n_FLAG=y
1048 877 ;;
1049 - S )
1050 - set_S_flag $OPTARG
1051 - ;;
1052 878 +t ) t_FLAG=n
1053 879 ;;
1054 880 V ) V_FLAG=y
1055 881 V_ARG="$OPTARG"
1056 882 ;;
1057 883 \? ) echo "$USAGE"
1058 884 exit 1
1059 885 ;;
1060 886 esac
1061 887 done
1062 888
1063 889 # correct argument count after options
1064 890 shift `expr $OPTIND - 1`
1065 891
1066 892 # test that the path to the environment-setting file was given
1067 893 if [ $# -ne 1 ]; then
1068 894 echo "$USAGE"
1069 895 exit 1
1070 896 fi
1071 897
1072 898 # check if user is running nightly as root
1073 899 # ISUSER is set non-zero if an ordinary user runs nightly, or is zero
1074 900 # when root invokes nightly.
1075 901 /usr/bin/id | grep '^uid=0(' >/dev/null 2>&1
1076 902 ISUSER=$?; export ISUSER
1077 903
1078 904 #
1079 905 # force locale to C
1080 906 LC_COLLATE=C; export LC_COLLATE
1081 907 LC_CTYPE=C; export LC_CTYPE
1082 908 LC_MESSAGES=C; export LC_MESSAGES
1083 909 LC_MONETARY=C; export LC_MONETARY
1084 910 LC_NUMERIC=C; export LC_NUMERIC
1085 911 LC_TIME=C; export LC_TIME
1086 912
1087 913 # clear environment variables we know to be bad for the build
1088 914 unset LD_OPTIONS
1089 915 unset LD_AUDIT LD_AUDIT_32 LD_AUDIT_64
1090 916 unset LD_BIND_NOW LD_BIND_NOW_32 LD_BIND_NOW_64
1091 917 unset LD_BREADTH LD_BREADTH_32 LD_BREADTH_64
1092 918 unset LD_CONFIG LD_CONFIG_32 LD_CONFIG_64
1093 919 unset LD_DEBUG LD_DEBUG_32 LD_DEBUG_64
1094 920 unset LD_DEMANGLE LD_DEMANGLE_32 LD_DEMANGLE_64
1095 921 unset LD_FLAGS LD_FLAGS_32 LD_FLAGS_64
1096 922 unset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64
1097 923 unset LD_LOADFLTR LD_LOADFLTR_32 LD_LOADFLTR_64
1098 924 unset LD_NOAUDIT LD_NOAUDIT_32 LD_NOAUDIT_64
1099 925 unset LD_NOAUXFLTR LD_NOAUXFLTR_32 LD_NOAUXFLTR_64
1100 926 unset LD_NOCONFIG LD_NOCONFIG_32 LD_NOCONFIG_64
1101 927 unset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64
1102 928 unset LD_NODIRECT LD_NODIRECT_32 LD_NODIRECT_64
1103 929 unset LD_NOLAZYLOAD LD_NOLAZYLOAD_32 LD_NOLAZYLOAD_64
1104 930 unset LD_NOOBJALTER LD_NOOBJALTER_32 LD_NOOBJALTER_64
1105 931 unset LD_NOVERSION LD_NOVERSION_32 LD_NOVERSION_64
1106 932 unset LD_ORIGIN LD_ORIGIN_32 LD_ORIGIN_64
1107 933 unset LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64
1108 934 unset LD_PROFILE LD_PROFILE_32 LD_PROFILE_64
1109 935
1110 936 unset CONFIG
1111 937 unset GROUP
1112 938 unset OWNER
1113 939 unset REMOTE
1114 940 unset ENV
1115 941 unset ARCH
1116 942 unset CLASSPATH
1117 943 unset NAME
1118 944
1119 945 #
1120 946 # To get ONBLD_TOOLS from the environment, it must come from the env file.
1121 947 # If it comes interactively, it is generally TOOLS_PROTO, which will be
1122 948 # clobbered before the compiler version checks, which will therefore fail.
1123 949 #
1124 950 unset ONBLD_TOOLS
1125 951
1126 952 #
1127 953 # Setup environmental variables
1128 954 #
1129 955 if [ -f /etc/nightly.conf ]; then
1130 956 . /etc/nightly.conf
1131 957 fi
1132 958
1133 959 if [ -f $1 ]; then
1134 960 if [[ $1 = */* ]]; then
1135 961 . $1
1136 962 else
1137 963 . ./$1
1138 964 fi
1139 965 else
1140 966 if [ -f $OPTHOME/onbld/env/$1 ]; then
1141 967 . $OPTHOME/onbld/env/$1
1142 968 else
1143 969 echo "Cannot find env file as either $1 or $OPTHOME/onbld/env/$1"
1144 970 exit 1
1145 971 fi
1146 972 fi
1147 973
1148 974 # contents of stdenv.sh inserted after next line:
1149 975 # STDENV_START
1150 976 # STDENV_END
1151 977
1152 978 # Check if we have sufficient data to continue...
1153 979 [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
1154 980 if [[ "${NIGHTLY_OPTIONS}" == ~(F)n ]] ; then
1155 981 # Check if the gate data are valid if we don't do a "bringover" below
1156 982 [[ -d "${CODEMGR_WS}" ]] || \
1157 983 fatal_error "Error: ${CODEMGR_WS} is not a directory."
1158 984 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || \
1159 985 fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
1160 986 fi
1161 987
1162 988 #
1163 989 # place ourselves in a new task, respecting BUILD_PROJECT if set.
1164 990 #
1165 991 if [ -z "$BUILD_PROJECT" ]; then
1166 992 /usr/bin/newtask -c $$
1167 993 else
1168 994 /usr/bin/newtask -c $$ -p $BUILD_PROJECT
1169 995 fi
1170 996
1171 997 ps -o taskid= -p $$ | read build_taskid
1172 998 ps -o project= -p $$ | read build_project
1173 999
1174 1000 #
1175 1001 # See if NIGHTLY_OPTIONS is set
1176 1002 #
1177 1003 if [ "$NIGHTLY_OPTIONS" = "" ]; then
1178 1004 NIGHTLY_OPTIONS="-aBm"
1179 1005 fi
1180 1006
1181 1007 #
1182 1008 # If BRINGOVER_WS was not specified, let it default to CLONE_WS
1183 1009 #
1184 1010 if [ "$BRINGOVER_WS" = "" ]; then
1185 1011 BRINGOVER_WS=$CLONE_WS
1186 1012 fi
1187 1013
1188 1014 #
1189 1015 # If CLOSED_BRINGOVER_WS was not specified, let it default to CLOSED_CLONE_WS
1190 1016 #
1191 1017 if [ "$CLOSED_BRINGOVER_WS" = "" ]; then
1192 1018 CLOSED_BRINGOVER_WS=$CLOSED_CLONE_WS
1193 1019 fi
1194 1020
1195 1021 #
1196 1022 # If BRINGOVER_FILES was not specified, default to usr
1197 1023 #
1198 1024 if [ "$BRINGOVER_FILES" = "" ]; then
1199 1025 BRINGOVER_FILES="usr"
↓ open down ↓ |
138 lines elided |
↑ open up ↑ |
1200 1026 fi
1201 1027
1202 1028 check_closed_tree
1203 1029
1204 1030 #
1205 1031 # Note: changes to the option letters here should also be applied to the
1206 1032 # bldenv script. `d' is listed for backward compatibility.
1207 1033 #
1208 1034 NIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-}
1209 1035 OPTIND=1
1210 -while getopts +ABCDdFfGIilMmNnOoPpRrS:TtUuWwXxz FLAG $NIGHTLY_OPTIONS
1036 +while getopts +ABCDdFfGIilMmNnoPpRrTtUuWwXxz FLAG $NIGHTLY_OPTIONS
1211 1037 do
1212 1038 case $FLAG in
1213 1039 A ) A_FLAG=y
1214 1040 ;;
1215 1041 B ) D_FLAG=y
1216 1042 ;; # old version of D
1217 1043 C ) C_FLAG=y
1218 1044 ;;
1219 1045 D ) D_FLAG=y
1220 1046 ;;
1221 1047 F ) F_FLAG=y
1222 1048 ;;
1223 1049 f ) f_FLAG=y
1224 1050 ;;
1225 1051 G ) u_FLAG=y
1226 1052 ;;
1227 1053 I ) m_FLAG=y
1228 1054 p_FLAG=y
1229 1055 u_FLAG=y
1230 1056 ;;
1231 1057 i ) i_FLAG=y
1232 1058 ;;
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
1233 1059 l ) l_FLAG=y
1234 1060 ;;
1235 1061 M ) M_FLAG=y
1236 1062 ;;
1237 1063 m ) m_FLAG=y
1238 1064 ;;
1239 1065 N ) N_FLAG=y
1240 1066 ;;
1241 1067 n ) n_FLAG=y
1242 1068 ;;
1243 - O ) O_FLAG=y
1244 - ;;
1245 1069 o ) o_FLAG=y
1246 1070 ;;
1247 1071 P ) P_FLAG=y
1248 1072 ;; # obsolete
1249 1073 p ) p_FLAG=y
1250 1074 ;;
1251 1075 R ) m_FLAG=y
1252 1076 p_FLAG=y
1253 1077 ;;
1254 1078 r ) r_FLAG=y
1255 1079 ;;
1256 - S )
1257 - set_S_flag $OPTARG
1258 - ;;
1259 1080 T ) T_FLAG=y
1260 1081 ;; # obsolete
1261 1082 +t ) t_FLAG=n
1262 1083 ;;
1263 1084 U ) if [ -z "${PARENT_ROOT}" ]; then
1264 1085 echo "PARENT_ROOT must be set if the U flag is" \
1265 1086 "present in NIGHTLY_OPTIONS."
1266 1087 exit 1
1267 1088 fi
1268 1089 NIGHTLY_PARENT_ROOT=$PARENT_ROOT
1269 1090 if [ -n "${PARENT_TOOLS_ROOT}" ]; then
1270 1091 NIGHTLY_PARENT_TOOLS_ROOT=$PARENT_TOOLS_ROOT
1271 1092 fi
1272 1093 U_FLAG=y
1273 1094 ;;
1274 1095 u ) u_FLAG=y
1275 1096 ;;
1276 1097 W ) W_FLAG=y
1277 1098 ;;
1278 1099
1279 1100 w ) w_FLAG=y
1280 1101 ;;
1281 1102 X ) # now that we no longer need realmode builds, just
1282 1103 # copy IHV packages. only meaningful on x86.
1283 1104 if [ "$MACH" = "i386" ]; then
1284 1105 X_FLAG=y
1285 1106 fi
1286 1107 ;;
1287 1108 x ) XMOD_OPT="-x"
1288 1109 ;;
1289 1110 \? ) echo "$USAGE"
1290 1111 exit 1
1291 1112 ;;
1292 1113 esac
1293 1114 done
1294 1115
1295 1116 if [ $ISUSER -ne 0 ]; then
1296 1117 if [ "$o_FLAG" = "y" ]; then
1297 1118 echo "Old-style build requires root permission."
1298 1119 exit 1
1299 1120 fi
1300 1121
1301 1122 # Set default value for STAFFER, if needed.
1302 1123 if [ -z "$STAFFER" -o "$STAFFER" = "nobody" ]; then
1303 1124 STAFFER=`/usr/xpg4/bin/id -un`
1304 1125 export STAFFER
1305 1126 fi
1306 1127 fi
1307 1128
1308 1129 if [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then
1309 1130 MAILTO=$STAFFER
1310 1131 export MAILTO
1311 1132 fi
1312 1133
1313 1134 PATH="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin"
1314 1135 PATH="$PATH:$OPTHOME/SUNWspro/bin:$TEAMWARE/bin:/usr/bin:/usr/sbin:/usr/ucb"
1315 1136 PATH="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
1316 1137 export PATH
1317 1138
1318 1139 # roots of source trees, both relative to $SRC and absolute.
1319 1140 relsrcdirs="."
1320 1141 abssrcdirs="$SRC"
1321 1142
1322 1143 unset CH
1323 1144 if [ "$o_FLAG" = "y" ]; then
1324 1145 # root invoked old-style build -- make sure it works as it always has
1325 1146 # by exporting 'CH'. The current Makefile.master doesn't use this, but
1326 1147 # the old ones still do.
1327 1148 PROTOCMPTERSE="protocmp.terse"
1328 1149 CH=
1329 1150 export CH
1330 1151 else
1331 1152 PROTOCMPTERSE="protocmp.terse -gu"
1332 1153 fi
1333 1154 POUND_SIGN="#"
1334 1155 # have we set RELEASE_DATE in our env file?
1335 1156 if [ -z "$RELEASE_DATE" ]; then
1336 1157 RELEASE_DATE=$(LC_ALL=C date +"%B %Y")
1337 1158 fi
1338 1159 BUILD_DATE=$(LC_ALL=C date +%Y-%b-%d)
1339 1160 BASEWSDIR=$(basename $CODEMGR_WS)
1340 1161 DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
1341 1162
1342 1163 # we export POUND_SIGN, RELEASE_DATE and DEV_CM to speed up the build process
1343 1164 # by avoiding repeated shell invocations to evaluate Makefile.master definitions.
1344 1165 # we export o_FLAG and X_FLAG for use by makebfu, and by usr/src/pkg/Makefile
1345 1166 export o_FLAG X_FLAG POUND_SIGN RELEASE_DATE DEV_CM
1346 1167
1347 1168 maketype="distributed"
1348 1169 MAKE=dmake
1349 1170 # get the dmake version string alone
1350 1171 DMAKE_VERSION=$( $MAKE -v )
1351 1172 DMAKE_VERSION=${DMAKE_VERSION#*: }
1352 1173 # focus in on just the dotted version number alone
1353 1174 DMAKE_MAJOR=$( echo $DMAKE_VERSION | \
1354 1175 sed -e 's/.*\<\([^.]*\.[^ ]*\).*$/\1/' )
1355 1176 # extract the second (or final) integer
1356 1177 DMAKE_MINOR=${DMAKE_MAJOR#*.}
1357 1178 DMAKE_MINOR=${DMAKE_MINOR%%.*}
1358 1179 # extract the first integer
1359 1180 DMAKE_MAJOR=${DMAKE_MAJOR%%.*}
1360 1181 CHECK_DMAKE=${CHECK_DMAKE:-y}
1361 1182 # x86 was built on the 12th, sparc on the 13th.
1362 1183 if [ "$CHECK_DMAKE" = "y" -a \
1363 1184 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/12" -a \
1364 1185 "$DMAKE_VERSION" != "Sun Distributed Make 7.3 2003/03/13" -a \( \
1365 1186 "$DMAKE_MAJOR" -lt 7 -o \
1366 1187 "$DMAKE_MAJOR" -eq 7 -a "$DMAKE_MINOR" -lt 4 \) ]; then
1367 1188 if [ -z "$DMAKE_VERSION" ]; then
1368 1189 echo "$MAKE is missing."
1369 1190 exit 1
1370 1191 fi
1371 1192 echo `whence $MAKE`" version is:"
1372 1193 echo " ${DMAKE_VERSION}"
1373 1194 cat <<EOF
1374 1195
1375 1196 This version may not be safe for use. Either set TEAMWARE to a better
1376 1197 path or (if you really want to use this version of dmake anyway), add
1377 1198 the following to your environment to disable this check:
1378 1199
1379 1200 CHECK_DMAKE=n
1380 1201 EOF
1381 1202 exit 1
1382 1203 fi
1383 1204 export PATH
1384 1205 export MAKE
1385 1206
1386 1207 if [ "${SUNWSPRO}" != "" ]; then
1387 1208 PATH="${SUNWSPRO}/bin:$PATH"
1388 1209 export PATH
1389 1210 fi
1390 1211
1391 1212 hostname=$(uname -n)
1392 1213 if [[ $DMAKE_MAX_JOBS != +([0-9]) || $DMAKE_MAX_JOBS -eq 0 ]]
1393 1214 then
1394 1215 maxjobs=
1395 1216 if [[ -f $HOME/.make.machines ]]
1396 1217 then
1397 1218 # Note: there is a hard tab and space character in the []s
1398 1219 # below.
1399 1220 egrep -i "^[ ]*$hostname[ \.]" \
1400 1221 $HOME/.make.machines | read host jobs
1401 1222 maxjobs=${jobs##*=}
1402 1223 fi
1403 1224
1404 1225 if [[ $maxjobs != +([0-9]) || $maxjobs -eq 0 ]]
1405 1226 then
1406 1227 # default
1407 1228 maxjobs=4
1408 1229 fi
1409 1230
1410 1231 export DMAKE_MAX_JOBS=$maxjobs
1411 1232 fi
1412 1233
1413 1234 DMAKE_MODE=parallel;
1414 1235 export DMAKE_MODE
1415 1236
1416 1237 if [ -z "${ROOT}" ]; then
1417 1238 echo "ROOT must be set."
1418 1239 exit 1
1419 1240 fi
1420 1241
1421 1242 #
1422 1243 # if -V flag was given, reset VERSION to V_ARG
1423 1244 #
1424 1245 if [ "$V_FLAG" = "y" ]; then
1425 1246 VERSION=$V_ARG
1426 1247 fi
1427 1248
1428 1249 #
1429 1250 # Check for IHV root for copying ihv proto area
1430 1251 #
1431 1252 if [ "$X_FLAG" = "y" ]; then
1432 1253 if [ "$IA32_IHV_ROOT" = "" ]; then
1433 1254 echo "IA32_IHV_ROOT: must be set for copying ihv proto"
1434 1255 args_ok=n
1435 1256 fi
1436 1257 if [ ! -d "$IA32_IHV_ROOT" ]; then
1437 1258 echo "$IA32_IHV_ROOT: not found"
1438 1259 args_ok=n
1439 1260 fi
↓ open down ↓ |
171 lines elided |
↑ open up ↑ |
1440 1261 if [ "$IA32_IHV_WS" = "" ]; then
1441 1262 echo "IA32_IHV_WS: must be set for copying ihv proto"
1442 1263 args_ok=n
1443 1264 fi
1444 1265 if [ ! -d "$IA32_IHV_WS" ]; then
1445 1266 echo "$IA32_IHV_WS: not found"
1446 1267 args_ok=n
1447 1268 fi
1448 1269 fi
1449 1270
1450 -# Append source version
1451 -if [ "$SE_FLAG" = "y" ]; then
1452 - VERSION="${VERSION}:EXPORT"
1453 -fi
1454 -
1455 -if [ "$SD_FLAG" = "y" ]; then
1456 - VERSION="${VERSION}:DOMESTIC"
1457 -fi
1458 -
1459 -if [ "$SH_FLAG" = "y" ]; then
1460 - VERSION="${VERSION}:MODIFIED_SOURCE_PRODUCT"
1461 -fi
1462 -
1463 -if [ "$SO_FLAG" = "y" ]; then
1464 - VERSION="${VERSION}:OPEN_ONLY"
1465 -fi
1466 -
1467 1271 TMPDIR="/tmp/nightly.tmpdir.$$"
1468 1272 export TMPDIR
1469 1273 rm -rf ${TMPDIR}
1470 1274 mkdir -p $TMPDIR || exit 1
1471 1275 chmod 777 $TMPDIR
1472 1276
1473 1277 #
1474 1278 # Keep elfsign's use of pkcs11_softtoken from looking in the user home
1475 1279 # directory, which doesn't always work. Needed until all build machines
1476 1280 # have the fix for 6271754
1477 1281 #
1478 1282 SOFTTOKEN_DIR=$TMPDIR
1479 1283 export SOFTTOKEN_DIR
1480 1284
1481 1285 #
1482 1286 # Tools should only be built non-DEBUG. Keep track of the tools proto
1483 1287 # area path relative to $TOOLS, because the latter changes in an
1484 1288 # export build.
1485 1289 #
1486 1290 # TOOLS_PROTO is included below for builds other than usr/src/tools
1487 1291 # that look for this location. For usr/src/tools, this will be
1488 1292 # overridden on the $MAKE command line in build_tools().
1489 1293 #
1490 1294 TOOLS=${SRC}/tools
1491 1295 TOOLS_PROTO_REL=proto/root_${MACH}-nd
1492 1296 TOOLS_PROTO=${TOOLS}/${TOOLS_PROTO_REL}; export TOOLS_PROTO
1493 1297
1494 1298 unset CFLAGS LD_LIBRARY_PATH LDFLAGS
1495 1299
1496 1300 # create directories that are automatically removed if the nightly script
1497 1301 # fails to start correctly
1498 1302 function newdir {
1499 1303 dir=$1
1500 1304 toadd=
1501 1305 while [ ! -d $dir ]; do
1502 1306 toadd="$dir $toadd"
1503 1307 dir=`dirname $dir`
1504 1308 done
1505 1309 torm=
1506 1310 newlist=
1507 1311 for dir in $toadd; do
1508 1312 if staffer mkdir $dir; then
1509 1313 newlist="$ISUSER $dir $newlist"
1510 1314 torm="$dir $torm"
1511 1315 else
1512 1316 [ -z "$torm" ] || staffer rmdir $torm
1513 1317 return 1
1514 1318 fi
1515 1319 done
1516 1320 newdirlist="$newlist $newdirlist"
1517 1321 return 0
1518 1322 }
1519 1323 newdirlist=
1520 1324
1521 1325 [ -d $CODEMGR_WS ] || newdir $CODEMGR_WS || exit 1
1522 1326
1523 1327 # since this script assumes the build is from full source, it nullifies
1524 1328 # variables likely to have been set by a "ws" script; nullification
1525 1329 # confines the search space for headers and libraries to the proto area
1526 1330 # built from this immediate source.
1527 1331 ENVLDLIBS1=
1528 1332 ENVLDLIBS2=
1529 1333 ENVLDLIBS3=
1530 1334 ENVCPPFLAGS1=
1531 1335 ENVCPPFLAGS2=
1532 1336 ENVCPPFLAGS3=
1533 1337 ENVCPPFLAGS4=
1534 1338 PARENT_ROOT=
1535 1339
1536 1340 export ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \
1537 1341 ENVLDLIBS1 ENVLDLIBS2 PARENT_ROOT
1538 1342
1539 1343 PKGARCHIVE_ORIG=$PKGARCHIVE
1540 1344 IA32_IHV_PKGS_ORIG=$IA32_IHV_PKGS
1541 1345
1542 1346 #
1543 1347 # Juggle the logs and optionally send mail on completion.
1544 1348 #
1545 1349
1546 1350 function logshuffle {
1547 1351 LLOG="$ATLOG/log.`date '+%F.%H:%M'`"
1548 1352 if [ -f $LLOG -o -d $LLOG ]; then
1549 1353 LLOG=$LLOG.$$
1550 1354 fi
1551 1355 mkdir $LLOG
1552 1356 export LLOG
1553 1357
1554 1358 if [ "$build_ok" = "y" ]; then
1555 1359 mv $ATLOG/proto_list_${MACH} $LLOG
1556 1360
1557 1361 if [ -f $ATLOG/proto_list_tools_${MACH} ]; then
1558 1362 mv $ATLOG/proto_list_tools_${MACH} $LLOG
1559 1363 fi
1560 1364
1561 1365 if [ -f $TMPDIR/wsdiff.results ]; then
1562 1366 mv $TMPDIR/wsdiff.results $LLOG
1563 1367 fi
1564 1368
1565 1369 if [ -f $TMPDIR/wsdiff-nd.results ]; then
1566 1370 mv $TMPDIR/wsdiff-nd.results $LLOG
1567 1371 fi
1568 1372 fi
1569 1373
1570 1374 #
1571 1375 # Now that we're about to send mail, it's time to check the noise
1572 1376 # file. In the event that an error occurs beyond this point, it will
1573 1377 # be recorded in the nightly.log file, but nowhere else. This would
1574 1378 # include only errors that cause the copying of the noise log to fail
1575 1379 # or the mail itself not to be sent.
1576 1380 #
1577 1381
1578 1382 exec >>$LOGFILE 2>&1
1579 1383 if [ -s $build_noise_file ]; then
1580 1384 echo "\n==== Nightly build noise ====\n" |
1581 1385 tee -a $LOGFILE >>$mail_msg_file
1582 1386 cat $build_noise_file >>$LOGFILE
1583 1387 cat $build_noise_file >>$mail_msg_file
1584 1388 echo | tee -a $LOGFILE >>$mail_msg_file
1585 1389 fi
1586 1390 rm -f $build_noise_file
1587 1391
1588 1392 case "$build_ok" in
1589 1393 y)
1590 1394 state=Completed
1591 1395 ;;
1592 1396 i)
1593 1397 state=Interrupted
1594 1398 ;;
1595 1399 *)
1596 1400 state=Failed
1597 1401 ;;
1598 1402 esac
1599 1403 NIGHTLY_STATUS=$state
1600 1404 export NIGHTLY_STATUS
1601 1405
1602 1406 run_hook POST_NIGHTLY $state
1603 1407 run_hook SYS_POST_NIGHTLY $state
1604 1408
1605 1409 #
1606 1410 # mailx(1) sets From: based on the -r flag
1607 1411 # if it is given.
1608 1412 #
1609 1413 mailx_r=
1610 1414 if [[ -n "${MAILFROM}" ]]; then
1611 1415 mailx_r="-r ${MAILFROM}"
1612 1416 fi
1613 1417
1614 1418 cat $build_time_file $build_environ_file $mail_msg_file \
1615 1419 > ${LLOG}/mail_msg
1616 1420 if [ "$m_FLAG" = "y" ]; then
1617 1421 cat ${LLOG}/mail_msg | /usr/bin/mailx ${mailx_r} -s \
1618 1422 "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \
1619 1423 ${MAILTO}
1620 1424 fi
1621 1425
1622 1426 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
1623 1427 staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH}
1624 1428 staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log
1625 1429 fi
1626 1430
1627 1431 mv $LOGFILE $LLOG
1628 1432 }
1629 1433
1630 1434 #
1631 1435 # Remove the locks and temporary files on any exit
1632 1436 #
1633 1437 function cleanup {
1634 1438 logshuffle
1635 1439
1636 1440 [ -z "$lockfile" ] || staffer rm -f $lockfile
1637 1441 [ -z "$atloglockfile" ] || rm -f $atloglockfile
1638 1442 [ -z "$ulockfile" ] || staffer rm -f $ulockfile
1639 1443 [ -z "$Ulockfile" ] || rm -f $Ulockfile
1640 1444
1641 1445 set -- $newdirlist
1642 1446 while [ $# -gt 0 ]; do
1643 1447 ISUSER=$1 staffer rmdir $2
1644 1448 shift; shift
1645 1449 done
1646 1450 rm -rf $TMPDIR
1647 1451 }
1648 1452
1649 1453 function cleanup_signal {
1650 1454 build_ok=i
1651 1455 # this will trigger cleanup(), above.
1652 1456 exit 1
1653 1457 }
1654 1458
1655 1459 trap cleanup 0
1656 1460 trap cleanup_signal 1 2 3 15
1657 1461
1658 1462 #
1659 1463 # Generic lock file processing -- make sure that the lock file doesn't
1660 1464 # exist. If it does, it should name the build host and PID. If it
1661 1465 # doesn't, then make sure we can create it. Clean up locks that are
1662 1466 # known to be stale (assumes host name is unique among build systems
1663 1467 # for the workspace).
1664 1468 #
1665 1469 function create_lock {
1666 1470 lockf=$1
1667 1471 lockvar=$2
1668 1472
1669 1473 ldir=`dirname $lockf`
1670 1474 [ -d $ldir ] || newdir $ldir || exit 1
1671 1475 eval $lockvar=$lockf
1672 1476
1673 1477 while ! staffer ln -s $hostname.$STAFFER.$$ $lockf 2> /dev/null; do
1674 1478 basews=`basename $CODEMGR_WS`
1675 1479 ls -l $lockf | nawk '{print $NF}' | IFS=. read host user pid
1676 1480 if [ "$host" != "$hostname" ]; then
1677 1481 echo "$MACH build of $basews apparently" \
1678 1482 "already started by $user on $host as $pid."
1679 1483 exit 1
1680 1484 elif kill -s 0 $pid 2>/dev/null; then
1681 1485 echo "$MACH build of $basews already started" \
1682 1486 "by $user as $pid."
1683 1487 exit 1
1684 1488 else
1685 1489 # stale lock; clear it out and try again
1686 1490 rm -f $lockf
1687 1491 fi
1688 1492 done
1689 1493 }
1690 1494
1691 1495 #
↓ open down ↓ |
215 lines elided |
↑ open up ↑ |
1692 1496 # Return the list of interesting proto areas, depending on the current
1693 1497 # options.
1694 1498 #
1695 1499 function allprotos {
1696 1500 typeset roots="$ROOT"
1697 1501
1698 1502 if [[ "$F_FLAG" = n && "$MULTI_PROTO" = yes ]]; then
1699 1503 roots="$roots $ROOT-nd"
1700 1504 fi
1701 1505
1702 - if [[ $O_FLAG = y ]]; then
1703 - roots="$roots $ROOT-closed"
1704 - [ $MULTI_PROTO = yes ] && roots="$roots $ROOT-nd-closed"
1705 - fi
1706 -
1707 1506 echo $roots
1708 1507 }
1709 1508
1710 1509 # Ensure no other instance of this script is running on this host.
1711 1510 # LOCKNAME can be set in <env_file>, and is by default, but is not
1712 1511 # required due to the use of $ATLOG below.
1713 1512 if [ -n "$LOCKNAME" ]; then
1714 1513 create_lock /tmp/$LOCKNAME "lockfile"
1715 1514 fi
1716 1515 #
1717 1516 # Create from one, two, or three other locks:
1718 1517 # $ATLOG/nightly.lock
1719 1518 # - protects against multiple builds in same workspace
1720 1519 # $PARENT_WS/usr/src/nightly.$MACH.lock
1721 1520 # - protects against multiple 'u' copy-backs
1722 1521 # $NIGHTLY_PARENT_ROOT/nightly.lock
1723 1522 # - protects against multiple 'U' copy-backs
1724 1523 #
1725 1524 # Overriding ISUSER to 1 causes the lock to be created as root if the
1726 1525 # script is run as root. The default is to create it as $STAFFER.
1727 1526 ISUSER=1 create_lock $ATLOG/nightly.lock "atloglockfile"
1728 1527 if [ "$u_FLAG" = "y" ]; then
1729 1528 create_lock $PARENT_WS/usr/src/nightly.$MACH.lock "ulockfile"
1730 1529 fi
1731 1530 if [ "$U_FLAG" = "y" ]; then
1732 1531 # NIGHTLY_PARENT_ROOT is written as root if script invoked as root.
1733 1532 ISUSER=1 create_lock $NIGHTLY_PARENT_ROOT/nightly.lock "Ulockfile"
1734 1533 fi
1735 1534
1736 1535 # Locks have been taken, so we're doing a build and we're committed to
1737 1536 # the directories we may have created so far.
1738 1537 newdirlist=
1739 1538
1740 1539 #
1741 1540 # Create mail_msg_file
1742 1541 #
1743 1542 mail_msg_file="${TMPDIR}/mail_msg"
1744 1543 touch $mail_msg_file
1745 1544 build_time_file="${TMPDIR}/build_time"
1746 1545 build_environ_file="${TMPDIR}/build_environ"
1747 1546 touch $build_environ_file
1748 1547 #
1749 1548 # Move old LOGFILE aside
1750 1549 # ATLOG directory already made by 'create_lock' above
1751 1550 #
1752 1551 if [ -f $LOGFILE ]; then
1753 1552 mv -f $LOGFILE ${LOGFILE}-
1754 1553 fi
1755 1554 #
1756 1555 # Build OsNet source
1757 1556 #
1758 1557 START_DATE=`date`
1759 1558 SECONDS=0
1760 1559 echo "\n==== Nightly $maketype build started: $START_DATE ====" \
1761 1560 | tee -a $LOGFILE > $build_time_file
1762 1561
1763 1562 echo "\nBuild project: $build_project\nBuild taskid: $build_taskid" | \
1764 1563 tee -a $mail_msg_file >> $LOGFILE
1765 1564
1766 1565 # make sure we log only to the nightly build file
1767 1566 build_noise_file="${TMPDIR}/build_noise"
1768 1567 exec </dev/null >$build_noise_file 2>&1
1769 1568
1770 1569 run_hook SYS_PRE_NIGHTLY
1771 1570 run_hook PRE_NIGHTLY
1772 1571
1773 1572 echo "\n==== list of environment variables ====\n" >> $LOGFILE
1774 1573 env >> $LOGFILE
1775 1574
↓ open down ↓ |
59 lines elided |
↑ open up ↑ |
1776 1575 echo "\n==== Nightly argument issues ====\n" | tee -a $mail_msg_file >> $LOGFILE
1777 1576
1778 1577 if [ "$P_FLAG" = "y" ]; then
1779 1578 obsolete_build GPROF | tee -a $mail_msg_file >> $LOGFILE
1780 1579 fi
1781 1580
1782 1581 if [ "$T_FLAG" = "y" ]; then
1783 1582 obsolete_build TRACE | tee -a $mail_msg_file >> $LOGFILE
1784 1583 fi
1785 1584
1786 -if is_source_build; then
1787 - if [ "$i_FLAG" = "y" -o "$i_CMD_LINE_FLAG" = "y" ]; then
1788 - echo "WARNING: the -S flags do not support incremental" \
1789 - "builds; forcing clobber\n" | tee -a $mail_msg_file >> $LOGFILE
1790 - i_FLAG=n
1791 - i_CMD_LINE_FLAG=n
1792 - fi
1793 - if [ "$N_FLAG" = "n" ]; then
1794 - echo "WARNING: the -S flags do not support protocmp;" \
1795 - "protocmp disabled\n" | \
1796 - tee -a $mail_msg_file >> $LOGFILE
1797 - N_FLAG=y
1798 - fi
1799 - if [ "$l_FLAG" = "y" ]; then
1800 - echo "WARNING: the -S flags do not support lint;" \
1801 - "lint disabled\n" | tee -a $mail_msg_file >> $LOGFILE
1802 - l_FLAG=n
1803 - fi
1804 - if [ "$C_FLAG" = "y" ]; then
1805 - echo "WARNING: the -S flags do not support cstyle;" \
1806 - "cstyle check disabled\n" | tee -a $mail_msg_file >> $LOGFILE
1807 - C_FLAG=n
1808 - fi
1809 -else
1810 - if [ "$N_FLAG" = "y" ]; then
1811 - if [ "$p_FLAG" = "y" ]; then
1812 - cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
1585 +if [ "$N_FLAG" = "y" ]; then
1586 + if [ "$p_FLAG" = "y" ]; then
1587 + cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
1813 1588 WARNING: the p option (create packages) is set, but so is the N option (do
1814 1589 not run protocmp); this is dangerous; you should unset the N option
1815 1590 EOF
1816 - else
1817 - cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
1591 + else
1592 + cat <<EOF | tee -a $mail_msg_file >> $LOGFILE
1818 1593 Warning: the N option (do not run protocmp) is set; it probably shouldn't be
1819 1594 EOF
1820 - fi
1821 - echo "" | tee -a $mail_msg_file >> $LOGFILE
1822 1595 fi
1596 + echo "" | tee -a $mail_msg_file >> $LOGFILE
1823 1597 fi
1824 1598
1825 1599 if [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then
1826 1600 #
1827 1601 # In the past we just complained but went ahead with the lint
1828 1602 # pass, even though the proto area was built non-DEBUG. It's
1829 1603 # unlikely that non-DEBUG headers will make a difference, but
1830 1604 # rather than assuming it's a safe combination, force the user
1831 1605 # to specify a DEBUG build.
1832 1606 #
1833 1607 echo "WARNING: DEBUG build not requested; disabling lint.\n" \
1834 1608 | tee -a $mail_msg_file >> $LOGFILE
1835 1609 l_FLAG=n
1836 1610 fi
1837 1611
1838 1612 if [ "$f_FLAG" = "y" ]; then
1839 1613 if [ "$i_FLAG" = "y" ]; then
1840 1614 echo "WARNING: the -f flag cannot be used during incremental" \
1841 1615 "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE
1842 1616 f_FLAG=n
1843 1617 fi
1844 1618 if [ "${l_FLAG}${p_FLAG}" != "yy" ]; then
1845 1619 echo "WARNING: the -f flag requires -l, and -p;" \
1846 1620 "ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE
1847 1621 f_FLAG=n
1848 1622 fi
1849 1623 fi
1850 1624
1851 1625 if [ "$w_FLAG" = "y" -a ! -d $ROOT ]; then
1852 1626 echo "WARNING: -w specified, but $ROOT does not exist;" \
1853 1627 "ignoring -w\n" | tee -a $mail_msg_file >> $LOGFILE
1854 1628 w_FLAG=n
1855 1629 fi
1856 1630
1857 1631 if [ "$t_FLAG" = "n" ]; then
1858 1632 #
1859 1633 # We're not doing a tools build, so make sure elfsign(1) is
1860 1634 # new enough to safely sign non-crypto binaries. We test
1861 1635 # debugging output from elfsign to detect the old version.
1862 1636 #
1863 1637 newelfsigntest=`SUNW_CRYPTO_DEBUG=stderr /usr/bin/elfsign verify \
1864 1638 -e /usr/lib/security/pkcs11_softtoken.so.1 2>&1 \
1865 1639 | egrep algorithmOID`
1866 1640 if [ -z "$newelfsigntest" ]; then
1867 1641 echo "WARNING: /usr/bin/elfsign out of date;" \
↓ open down ↓ |
35 lines elided |
↑ open up ↑ |
1868 1642 "will only sign crypto modules\n" | \
1869 1643 tee -a $mail_msg_file >> $LOGFILE
1870 1644 export ELFSIGN_OBJECT=true
1871 1645 elif [ "$VERIFY_ELFSIGN" = "y" ]; then
1872 1646 echo "WARNING: VERIFY_ELFSIGN=y requires" \
1873 1647 "the -t flag; ignoring VERIFY_ELFSIGN\n" | \
1874 1648 tee -a $mail_msg_file >> $LOGFILE
1875 1649 fi
1876 1650 fi
1877 1651
1878 -[ "$O_FLAG" = y ] && MULTI_PROTO=yes
1879 -
1880 1652 case $MULTI_PROTO in
1881 1653 yes|no) ;;
1882 1654 *)
1883 1655 echo "WARNING: MULTI_PROTO is \"$MULTI_PROTO\"; " \
1884 1656 "should be \"yes\" or \"no\"." | tee -a $mail_msg_file >> $LOGFILE
1885 1657 echo "Setting MULTI_PROTO to \"no\".\n" | \
1886 1658 tee -a $mail_msg_file >> $LOGFILE
1887 1659 export MULTI_PROTO=no
1888 1660 ;;
1889 1661 esac
1890 1662
1891 1663 echo "\n==== Build version ====\n" | tee -a $mail_msg_file >> $LOGFILE
1892 1664 echo $VERSION | tee -a $mail_msg_file >> $LOGFILE
1893 1665
1894 1666 # Save the current proto area if we're comparing against the last build
1895 1667 if [ "$w_FLAG" = "y" -a -d "$ROOT" ]; then
1896 1668 if [ -d "$ROOT.prev" ]; then
1897 1669 rm -rf $ROOT.prev
1898 1670 fi
1899 1671 mv $ROOT $ROOT.prev
1900 1672 fi
1901 1673
1902 1674 # Same for non-DEBUG proto area
1903 1675 if [ "$w_FLAG" = "y" -a "$MULTI_PROTO" = yes -a -d "$ROOT-nd" ]; then
1904 1676 if [ -d "$ROOT-nd.prev" ]; then
1905 1677 rm -rf $ROOT-nd.prev
1906 1678 fi
1907 1679 mv $ROOT-nd $ROOT-nd.prev
1908 1680 fi
1909 1681
1910 1682 #
1911 1683 # Echo the SCM type of the parent workspace, this can't just be which_scm
1912 1684 # as that does not know how to identify various network repositories.
1913 1685 #
1914 1686 function parent_wstype {
1915 1687 typeset scm_type junk
1916 1688
1917 1689 CODEMGR_WS="$BRINGOVER_WS" "$WHICH_SCM" 2>/dev/null \
1918 1690 | read scm_type junk
1919 1691 if [[ -z "$scm_type" || "$scm_type" == unknown ]]; then
1920 1692 # Probe BRINGOVER_WS to determine its type
1921 1693 if [[ $BRINGOVER_WS == svn*://* ]]; then
1922 1694 scm_type="subversion"
1923 1695 elif [[ $BRINGOVER_WS == file://* ]] &&
1924 1696 egrep -s "This is a Subversion repository" \
1925 1697 ${BRINGOVER_WS#file://}/README.txt 2> /dev/null; then
1926 1698 scm_type="subversion"
1927 1699 elif [[ $BRINGOVER_WS == ssh://* ]]; then
1928 1700 scm_type="mercurial"
1929 1701 elif [[ $BRINGOVER_WS == http://* ]] && \
1930 1702 wget -q -O- --save-headers "$BRINGOVER_WS/?cmd=heads" | \
1931 1703 egrep -s "application/mercurial" 2> /dev/null; then
1932 1704 scm_type="mercurial"
1933 1705 elif svn info $BRINGOVER_WS > /dev/null 2>&1; then
1934 1706 scm_type="subversion"
1935 1707 else
1936 1708 scm_type="none"
1937 1709 fi
1938 1710 fi
1939 1711
1940 1712 # fold both unsupported and unrecognized results into "none"
1941 1713 case "$scm_type" in
1942 1714 none|subversion|teamware|mercurial)
1943 1715 ;;
1944 1716 *) scm_type=none
1945 1717 ;;
1946 1718 esac
1947 1719
1948 1720 echo $scm_type
1949 1721 }
1950 1722
1951 1723 # Echo the SCM types of $CODEMGR_WS and $BRINGOVER_WS
1952 1724 function child_wstype {
1953 1725 typeset scm_type junk
1954 1726
1955 1727 # Probe CODEMGR_WS to determine its type
1956 1728 if [[ -d $CODEMGR_WS ]]; then
1957 1729 $WHICH_SCM | read scm_type junk || exit 1
1958 1730 fi
1959 1731
1960 1732 case "$scm_type" in
1961 1733 none|subversion|git|teamware|mercurial)
1962 1734 ;;
1963 1735 *) scm_type=none
1964 1736 ;;
1965 1737 esac
1966 1738
1967 1739 echo $scm_type
1968 1740 }
1969 1741
1970 1742 SCM_TYPE=$(child_wstype)
1971 1743
1972 1744 #
1973 1745 # Decide whether to clobber
1974 1746 #
1975 1747 if [ "$i_FLAG" = "n" -a -d "$SRC" ]; then
1976 1748 echo "\n==== Make clobber at `date` ====\n" >> $LOGFILE
1977 1749
1978 1750 cd $SRC
1979 1751 # remove old clobber file
1980 1752 rm -f $SRC/clobber.out
1981 1753 rm -f $SRC/clobber-${MACH}.out
1982 1754
1983 1755 # Remove all .make.state* files, just in case we are restarting
1984 1756 # the build after having interrupted a previous 'make clobber'.
↓ open down ↓ |
95 lines elided |
↑ open up ↑ |
1985 1757 find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \
1986 1758 -o -name 'interfaces.*' \) -prune \
1987 1759 -o -name '.make.*' -print | xargs rm -f
1988 1760
1989 1761 $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE
1990 1762 echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file
1991 1763 grep "$MAKE:" $SRC/clobber-${MACH}.out |
1992 1764 egrep -v "Ignoring unknown host" \
1993 1765 >> $mail_msg_file
1994 1766
1995 - if [[ "$t_FLAG" = "y" || "$O_FLAG" = "y" ]]; then
1767 + if [[ "$t_FLAG" = "y" ]]; then
1996 1768 echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE
1997 1769 cd ${TOOLS}
1998 1770 rm -f ${TOOLS}/clobber-${MACH}.out
1999 1771 $MAKE TOOLS_PROTO=$TOOLS_PROTO -ek clobber 2>&1 | \
2000 1772 tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE
2001 1773 echo "\n==== Make tools clobber ERRORS ====\n" \
2002 1774 >> $mail_msg_file
2003 1775 grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \
2004 1776 >> $mail_msg_file
2005 1777 rm -rf ${TOOLS_PROTO}
2006 1778 mkdir -p ${TOOLS_PROTO}
2007 1779 fi
2008 1780
2009 1781 typeset roots=$(allprotos)
2010 1782 echo "\n\nClearing $roots" >> "$LOGFILE"
2011 1783 rm -rf $roots
2012 1784
2013 1785 # Get back to a clean workspace as much as possible to catch
2014 1786 # problems that only occur on fresh workspaces.
2015 1787 # Remove all .make.state* files, libraries, and .o's that may
2016 1788 # have been omitted from clobber. A couple of libraries are
2017 1789 # under source code control, so leave them alone.
2018 1790 # We should probably blow away temporary directories too.
2019 1791 cd $SRC
2020 1792 find $relsrcdirs \( -name SCCS -o -name .hg -o -name .svn \
2021 1793 -o -name .git -o -name 'interfaces.*' \) -prune -o \
2022 1794 \( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \
2023 1795 -name '*.o' \) -print | \
2024 1796 grep -v 'tools/ctf/dwarf/.*/libdwarf' | xargs rm -f
2025 1797 else
2026 1798 echo "\n==== No clobber at `date` ====\n" >> $LOGFILE
2027 1799 fi
2028 1800
2029 1801 type bringover_teamware > /dev/null 2>&1 || function bringover_teamware {
2030 1802 # sleep on the parent workspace's lock
2031 1803 while egrep -s write $BRINGOVER_WS/Codemgr_wsdata/locks
2032 1804 do
2033 1805 sleep 120
2034 1806 done
2035 1807
2036 1808 if [[ -z $BRINGOVER ]]; then
2037 1809 BRINGOVER=$TEAMWARE/bin/bringover
2038 1810 fi
2039 1811
2040 1812 staffer $BRINGOVER -c "nightly update" -p $BRINGOVER_WS \
2041 1813 -w $CODEMGR_WS $BRINGOVER_FILES < /dev/null 2>&1 ||
2042 1814 touch $TMPDIR/bringover_failed
2043 1815
2044 1816 staffer bringovercheck $CODEMGR_WS >$TMPDIR/bringovercheck.out 2>&1
2045 1817 if [ -s $TMPDIR/bringovercheck.out ]; then
2046 1818 echo "\n==== POST-BRINGOVER CLEANUP NOISE ====\n"
2047 1819 cat $TMPDIR/bringovercheck.out
2048 1820 fi
2049 1821 }
2050 1822
2051 1823 type bringover_mercurial > /dev/null 2>&1 || function bringover_mercurial {
2052 1824 typeset -x PATH=$PATH
2053 1825
2054 1826 # If the repository doesn't exist yet, then we want to populate it.
2055 1827 if [[ ! -d $CODEMGR_WS/.hg ]]; then
2056 1828 staffer hg init $CODEMGR_WS
2057 1829 staffer echo "[paths]" > $CODEMGR_WS/.hg/hgrc
2058 1830 staffer echo "default=$BRINGOVER_WS" >> $CODEMGR_WS/.hg/hgrc
2059 1831 touch $TMPDIR/new_repository
2060 1832 fi
2061 1833
2062 1834 typeset -x HGMERGE="/bin/false"
2063 1835
2064 1836 #
2065 1837 # If the user has changes, regardless of whether those changes are
2066 1838 # committed, and regardless of whether those changes conflict, then
2067 1839 # we'll attempt to merge them either implicitly (uncommitted) or
2068 1840 # explicitly (committed).
2069 1841 #
2070 1842 # These are the messages we'll use to help clarify mercurial output
2071 1843 # in those cases.
2072 1844 #
2073 1845 typeset mergefailmsg="\
2074 1846 ***\n\
2075 1847 *** nightly was unable to automatically merge your changes. You should\n\
2076 1848 *** redo the full merge manually, following the steps outlined by mercurial\n\
2077 1849 *** above, then restart nightly.\n\
2078 1850 ***\n"
2079 1851 typeset mergepassmsg="\
2080 1852 ***\n\
2081 1853 *** nightly successfully merged your changes. This means that your working\n\
2082 1854 *** directory has been updated, but those changes are not yet committed.\n\
2083 1855 *** After nightly completes, you should validate the results of the merge,\n\
2084 1856 *** then use hg commit manually.\n\
2085 1857 ***\n"
2086 1858
2087 1859 #
2088 1860 # For each repository in turn:
2089 1861 #
2090 1862 # 1. Do the pull. If this fails, dump the output and bail out.
2091 1863 #
2092 1864 # 2. If the pull resulted in an extra head, do an explicit merge.
2093 1865 # If this fails, dump the output and bail out.
2094 1866 #
2095 1867 # Because we can't rely on Mercurial to exit with a failure code
2096 1868 # when a merge fails (Mercurial issue #186), we must grep the
2097 1869 # output of pull/merge to check for attempted and/or failed merges.
2098 1870 #
2099 1871 # 3. If a merge failed, set the message and fail the bringover.
2100 1872 #
2101 1873 # 4. Otherwise, if a merge succeeded, set the message
2102 1874 #
2103 1875 # 5. Dump the output, and any message from step 3 or 4.
2104 1876 #
2105 1877
2106 1878 typeset HG_SOURCE=$BRINGOVER_WS
2107 1879 if [ ! -f $TMPDIR/new_repository ]; then
2108 1880 HG_SOURCE=$TMPDIR/open_bundle.hg
2109 1881 staffer hg --cwd $CODEMGR_WS incoming --bundle $HG_SOURCE \
2110 1882 -v $BRINGOVER_WS > $TMPDIR/incoming_open.out
2111 1883
2112 1884 #
2113 1885 # If there are no incoming changesets, then incoming will
2114 1886 # fail, and there will be no bundle file. Reset the source,
2115 1887 # to allow the remaining logic to complete with no false
2116 1888 # negatives. (Unlike incoming, pull will return success
2117 1889 # for the no-change case.)
2118 1890 #
2119 1891 if (( $? != 0 )); then
2120 1892 HG_SOURCE=$BRINGOVER_WS
2121 1893 fi
2122 1894 fi
2123 1895
2124 1896 staffer hg --cwd $CODEMGR_WS pull -u $HG_SOURCE \
2125 1897 > $TMPDIR/pull_open.out 2>&1
2126 1898 if (( $? != 0 )); then
2127 1899 printf "%s: pull failed as follows:\n\n" "$CODEMGR_WS"
2128 1900 cat $TMPDIR/pull_open.out
2129 1901 if grep "^merging.*failed" $TMPDIR/pull_open.out > /dev/null 2>&1; then
2130 1902 printf "$mergefailmsg"
2131 1903 fi
2132 1904 touch $TMPDIR/bringover_failed
2133 1905 return
2134 1906 fi
2135 1907
2136 1908 if grep "not updating" $TMPDIR/pull_open.out > /dev/null 2>&1; then
2137 1909 staffer hg --cwd $CODEMGR_WS merge \
2138 1910 >> $TMPDIR/pull_open.out 2>&1
2139 1911 if (( $? != 0 )); then
2140 1912 printf "%s: merge failed as follows:\n\n" \
2141 1913 "$CODEMGR_WS"
2142 1914 cat $TMPDIR/pull_open.out
2143 1915 if grep "^merging.*failed" $TMPDIR/pull_open.out \
2144 1916 > /dev/null 2>&1; then
2145 1917 printf "$mergefailmsg"
2146 1918 fi
2147 1919 touch $TMPDIR/bringover_failed
2148 1920 return
2149 1921 fi
2150 1922 fi
2151 1923
2152 1924 printf "updated %s with the following results:\n" "$CODEMGR_WS"
2153 1925 cat $TMPDIR/pull_open.out
2154 1926 if grep "^merging" $TMPDIR/pull_open.out >/dev/null 2>&1; then
2155 1927 printf "$mergepassmsg"
2156 1928 fi
2157 1929 printf "\n"
2158 1930
2159 1931 #
2160 1932 # Per-changeset output is neither useful nor manageable for a
2161 1933 # newly-created repository.
2162 1934 #
2163 1935 if [ -f $TMPDIR/new_repository ]; then
2164 1936 return
2165 1937 fi
2166 1938
2167 1939 printf "\nadded the following changesets to open repository:\n"
2168 1940 cat $TMPDIR/incoming_open.out
2169 1941
2170 1942 #
2171 1943 # The closed repository could have been newly created, even though
2172 1944 # the open one previously existed...
2173 1945 #
2174 1946 if [ -f $TMPDIR/new_closed ]; then
2175 1947 return
2176 1948 fi
2177 1949
2178 1950 if [ -f $TMPDIR/incoming_closed.out ]; then
2179 1951 printf "\nadded the following changesets to closed repository:\n"
2180 1952 cat $TMPDIR/incoming_closed.out
2181 1953 fi
2182 1954 }
2183 1955
2184 1956 type bringover_subversion > /dev/null 2>&1 || function bringover_subversion {
2185 1957 typeset -x PATH=$PATH
2186 1958
2187 1959 if [[ ! -d $CODEMGR_WS/.svn ]]; then
2188 1960 staffer svn checkout $BRINGOVER_WS $CODEMGR_WS ||
2189 1961 touch $TMPDIR/bringover_failed
2190 1962 else
2191 1963 typeset root
2192 1964 root=$(staffer svn info $CODEMGR_WS |
2193 1965 nawk '/^Repository Root:/ {print $NF}')
2194 1966 if [[ $root != $BRINGOVER_WS ]]; then
2195 1967 # We fail here because there's no way to update
2196 1968 # from a named repo.
2197 1969 cat <<-EOF
2198 1970 \$BRINGOVER_WS doesn't match repository root:
2199 1971 \$BRINGOVER_WS: $BRINGOVER_WS
2200 1972 Repository root: $root
2201 1973 EOF
2202 1974 touch $TMPDIR/bringover_failed
2203 1975 else
2204 1976 # If a conflict happens, svn still exits 0.
2205 1977 staffer svn update $CODEMGR_WS | tee $TMPDIR/pull.out ||
2206 1978 touch $TMPDIR/bringover_failed
2207 1979 if grep "^C" $TMPDIR/pull.out > /dev/null 2>&1; then
2208 1980 touch $TMPDIR/bringover_failed
2209 1981 fi
2210 1982 fi
2211 1983 fi
2212 1984 }
2213 1985
2214 1986 type bringover_none > /dev/null 2>&1 || function bringover_none {
2215 1987 echo "Couldn't figure out what kind of SCM to use for $BRINGOVER_WS."
2216 1988 touch $TMPDIR/bringover_failed
2217 1989 }
2218 1990
2219 1991 #
2220 1992 # Decide whether to bringover to the codemgr workspace
2221 1993 #
2222 1994 if [ "$n_FLAG" = "n" ]; then
2223 1995 PARENT_SCM_TYPE=$(parent_wstype)
2224 1996
2225 1997 if [[ $SCM_TYPE != none && $SCM_TYPE != $PARENT_SCM_TYPE ]]; then
2226 1998 echo "cannot bringover from $PARENT_SCM_TYPE to $SCM_TYPE, " \
2227 1999 "quitting at `date`." | tee -a $mail_msg_file >> $LOGFILE
2228 2000 exit 1
2229 2001 fi
2230 2002
2231 2003 run_hook PRE_BRINGOVER
2232 2004
2233 2005 echo "\n==== bringover to $CODEMGR_WS at `date` ====\n" >> $LOGFILE
2234 2006 echo "\n==== BRINGOVER LOG ====\n" >> $mail_msg_file
2235 2007
2236 2008 eval "bringover_${PARENT_SCM_TYPE}" 2>&1 |
2237 2009 tee -a $mail_msg_file >> $LOGFILE
2238 2010
2239 2011 if [ -f $TMPDIR/bringover_failed ]; then
2240 2012 rm -f $TMPDIR/bringover_failed
2241 2013 build_ok=n
2242 2014 echo "trouble with bringover, quitting at `date`." |
2243 2015 tee -a $mail_msg_file >> $LOGFILE
2244 2016 exit 1
2245 2017 fi
2246 2018
2247 2019 #
2248 2020 # It's possible that we used the bringover above to create
2249 2021 # $CODEMGR_WS. If so, then SCM_TYPE was previously "none,"
2250 2022 # but should now be the same as $BRINGOVER_WS.
2251 2023 #
↓ open down ↓ |
246 lines elided |
↑ open up ↑ |
2252 2024 [[ $SCM_TYPE = none ]] && SCM_TYPE=$PARENT_SCM_TYPE
2253 2025
2254 2026 run_hook POST_BRINGOVER
2255 2027
2256 2028 check_closed_tree
2257 2029
2258 2030 else
2259 2031 echo "\n==== No bringover to $CODEMGR_WS ====\n" >> $LOGFILE
2260 2032 fi
2261 2033
2262 -if [[ "$O_FLAG" = y ]]; then
2263 - build_ok=n
2264 - echo "OpenSolaris binary deliverables need usr/closed." \
2265 - | tee -a "$mail_msg_file" >> $LOGFILE
2266 - exit 1
2267 -fi
2268 -
2269 2034 # Safeguards
2270 2035 [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
2271 2036 [[ -d "${CODEMGR_WS}" ]] || fatal_error "Error: ${CODEMGR_WS} is not a directory."
2272 2037 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
2273 2038
2274 2039 echo "\n==== Build environment ====\n" | tee -a $build_environ_file >> $LOGFILE
2275 2040
2276 2041 # System
2277 2042 whence uname | tee -a $build_environ_file >> $LOGFILE
2278 2043 uname -a 2>&1 | tee -a $build_environ_file >> $LOGFILE
2279 2044 echo | tee -a $build_environ_file >> $LOGFILE
2280 2045
2281 2046 # make
2282 2047 whence $MAKE | tee -a $build_environ_file >> $LOGFILE
2283 2048 $MAKE -v | tee -a $build_environ_file >> $LOGFILE
2284 2049 echo "number of concurrent jobs = $DMAKE_MAX_JOBS" |
2285 2050 tee -a $build_environ_file >> $LOGFILE
2286 2051
2287 2052 #
2288 2053 # Report the compiler versions.
2289 2054 #
2290 2055
2291 2056 if [[ ! -f $SRC/Makefile ]]; then
2292 2057 build_ok=n
2293 2058 echo "\nUnable to find \"Makefile\" in $SRC." | \
2294 2059 tee -a $build_environ_file >> $LOGFILE
2295 2060 exit 1
2296 2061 fi
2297 2062
2298 2063 ( cd $SRC
2299 2064 for target in cc-version cc64-version java-version; do
2300 2065 echo
2301 2066 #
2302 2067 # Put statefile somewhere we know we can write to rather than trip
2303 2068 # over a read-only $srcroot.
2304 2069 #
2305 2070 rm -f $TMPDIR/make-state
2306 2071 export SRC
2307 2072 if $MAKE -K $TMPDIR/make-state -e $target 2>/dev/null; then
2308 2073 continue
2309 2074 fi
2310 2075 touch $TMPDIR/nocompiler
2311 2076 done
2312 2077 echo
2313 2078 ) | tee -a $build_environ_file >> $LOGFILE
2314 2079
2315 2080 if [ -f $TMPDIR/nocompiler ]; then
2316 2081 rm -f $TMPDIR/nocompiler
2317 2082 build_ok=n
2318 2083 echo "Aborting due to missing compiler." |
2319 2084 tee -a $build_environ_file >> $LOGFILE
2320 2085 exit 1
2321 2086 fi
2322 2087
2323 2088 # as
2324 2089 whence as | tee -a $build_environ_file >> $LOGFILE
2325 2090 as -V 2>&1 | head -1 | tee -a $build_environ_file >> $LOGFILE
2326 2091 echo | tee -a $build_environ_file >> $LOGFILE
2327 2092
2328 2093 # Check that we're running a capable link-editor
2329 2094 whence ld | tee -a $build_environ_file >> $LOGFILE
2330 2095 LDVER=`ld -V 2>&1`
2331 2096 echo $LDVER | tee -a $build_environ_file >> $LOGFILE
2332 2097 LDVER=`echo $LDVER | sed -e "s/.*-1\.\([0-9]*\).*/\1/"`
↓ open down ↓ |
54 lines elided |
↑ open up ↑ |
2333 2098 if [ `expr $LDVER \< 422` -eq 1 ]; then
2334 2099 echo "The link-editor needs to be at version 422 or higher to build" | \
2335 2100 tee -a $build_environ_file >> $LOGFILE
2336 2101 echo "the latest stuff. Hope your build works." | \
2337 2102 tee -a $build_environ_file >> $LOGFILE
2338 2103 fi
2339 2104
2340 2105 #
2341 2106 # Build and use the workspace's tools if requested
2342 2107 #
2343 -if [[ "$t_FLAG" = "y" || "$O_FLAG" = y ]]; then
2108 +if [[ "$t_FLAG" = "y" ]]; then
2344 2109 set_non_debug_build_flags
2345 2110
2346 2111 build_tools ${TOOLS_PROTO}
2347 2112 if [[ $? != 0 && "$t_FLAG" = y ]]; then
2348 2113 use_tools $TOOLS_PROTO
2349 2114 fi
2350 2115 fi
2351 2116
2352 2117 #
2353 2118 # copy ihv proto area in addition to the build itself
2354 2119 #
2355 2120 if [ "$X_FLAG" = "y" ]; then
2356 2121 copy_ihv_proto
2357 2122 fi
2358 2123
2359 -if [ "$i_FLAG" = "y" -a "$SH_FLAG" = "y" ]; then
2360 - echo "\n==== NOT Building base OS-Net source ====\n" | \
2361 - tee -a $LOGFILE >> $mail_msg_file
2362 -else
2363 - # timestamp the start of the normal build; the findunref tool uses it.
2364 - touch $SRC/.build.tstamp
2124 +# timestamp the start of the normal build; the findunref tool uses it.
2125 +touch $SRC/.build.tstamp
2365 2126
2366 - normal_build
2367 -fi
2368 -
2369 -#
2370 -# Generate the THIRDPARTYLICENSE files if needed. This is done after
2371 -# the build, so that dynamically-created license files are there.
2372 -# It's done before findunref to help identify license files that need
2373 -# to be added to tools/opensolaris/license-list.
2374 -#
2375 -if [ "$O_FLAG" = y -a "$build_ok" = y ]; then
2376 - echo "\n==== Generating THIRDPARTYLICENSE files ====\n" |
2377 - tee -a "$mail_msg_file" >> "$LOGFILE"
2378 -
2379 - if [ -d $ROOT/licenses/usr ]; then
2380 - ( cd $ROOT/licenses ; \
2381 - mktpl $SRC/pkg/license-list ) >> "$LOGFILE" 2>&1
2382 - if (( $? != 0 )) ; then
2383 - echo "Couldn't create THIRDPARTYLICENSE files" |
2384 - tee -a "$mail_msg_file" >> "$LOGFILE"
2385 - fi
2386 - else
2387 - echo "No licenses found under $ROOT/licenses" |
2388 - tee -a "$mail_msg_file" >> "$LOGFILE"
2389 - fi
2390 -fi
2127 +normal_build
2391 2128
2392 2129 ORIG_SRC=$SRC
2393 2130 BINARCHIVE=${CODEMGR_WS}/bin-${MACH}.cpio.Z
2394 2131
2395 -if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then
2396 - save_binaries
2397 -fi
2398 -
2399 -
2400 -# EXPORT_SRC comes after CRYPT_SRC since a domestic build will need
2401 -# $SRC pointing to the export_source usr/src.
2402 -
2403 -if [ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o "$SH_FLAG" = "y" ]; then
2404 - if [ "$SD_FLAG" = "y" -a $build_ok = y ]; then
2405 - set_up_source_build ${CODEMGR_WS} ${CRYPT_SRC} CRYPT_SRC
2406 - fi
2407 -
2408 - if [ $build_ok = y ]; then
2409 - set_up_source_build ${CODEMGR_WS} ${EXPORT_SRC} EXPORT_SRC
2410 - fi
2411 -fi
2412 -
2413 -if [ "$SD_FLAG" = "y" -a $build_ok = y ]; then
2414 - # drop the crypt files in place.
2415 - cd ${EXPORT_SRC}
2416 - echo "\nextracting crypt_files.cpio.Z onto export_source.\n" \
2417 - >> ${LOGFILE}
2418 - zcat ${CODEMGR_WS}/crypt_files.cpio.Z | \
2419 - cpio -idmucvB 2>/dev/null >> ${LOGFILE}
2420 - if [ "$?" = "0" ]; then
2421 - echo "\n==== DOMESTIC extraction succeeded ====\n" \
2422 - >> $mail_msg_file
2423 - else
2424 - echo "\n==== DOMESTIC extraction failed ====\n" \
2425 - >> $mail_msg_file
2426 - fi
2427 -
2428 -fi
2429 -
2430 -if [ "$SO_FLAG" = "y" -a "$build_ok" = y ]; then
2431 - #
2432 - # Copy the open sources into their own tree.
2433 - # If copy_source fails, it will have already generated an
2434 - # error message and set build_ok=n, so we don't need to worry
2435 - # about that here.
2436 - #
2437 - copy_source $CODEMGR_WS $OPEN_SRCDIR OPEN_SOURCE usr/src
2438 -fi
2439 -
2440 -if [ "$SO_FLAG" = "y" -a "$build_ok" = y ]; then
2441 - SRC=$OPEN_SRCDIR/usr/src
2442 -fi
2443 -
2444 -if is_source_build && [ $build_ok = y ] ; then
2445 - # remove proto area(s) here, since we don't clobber
2446 - rm -rf `allprotos`
2447 - if [ "$t_FLAG" = "y" ]; then
2448 - set_non_debug_build_flags
2449 - ORIG_TOOLS=$TOOLS
2450 - #
2451 - # SRC was set earlier to point to the source build
2452 - # source tree (e.g., $EXPORT_SRC).
2453 - #
2454 - TOOLS=${SRC}/tools
2455 - TOOLS_PROTO=${TOOLS}/${TOOLS_PROTO_REL}; export TOOLS_PROTO
2456 - build_tools ${TOOLS_PROTO}
2457 - if [[ $? != 0 ]]; then
2458 - use_tools ${TOOLS_PROTO}
2459 - fi
2460 - fi
2461 -
2462 - normal_build
2463 -fi
2464 2132
2465 2133 #
2466 2134 # There are several checks that need to look at the proto area, but
2467 2135 # they only need to look at one, and they don't care whether it's
2468 2136 # DEBUG or non-DEBUG.
2469 2137 #
2470 2138 if [[ "$MULTI_PROTO" = yes && "$D_FLAG" = n ]]; then
2471 2139 checkroot=$ROOT-nd
2472 2140 else
2473 2141 checkroot=$ROOT
2474 2142 fi
2475 2143
2476 2144 if [ "$build_ok" = "y" ]; then
2477 2145 echo "\n==== Creating protolist system file at `date` ====" \
2478 2146 >> $LOGFILE
2479 2147 protolist $checkroot > $ATLOG/proto_list_${MACH}
2480 2148 echo "==== protolist system file created at `date` ====\n" \
2481 2149 >> $LOGFILE
2482 2150
2483 2151 if [ "$N_FLAG" != "y" ]; then
2484 2152
2485 2153 E1=
2486 2154 f1=
2487 2155 if [ -d "$SRC/pkgdefs" ]; then
2488 2156 f1="$SRC/pkgdefs/etc/exception_list_$MACH"
2489 2157 if [ "$X_FLAG" = "y" ]; then
2490 2158 f1="$f1 $IA32_IHV_WS/usr/src/pkgdefs/etc/exception_list_$MACH"
2491 2159 fi
2492 2160 fi
2493 2161
2494 2162 for f in $f1; do
2495 2163 if [ -f "$f" ]; then
2496 2164 E1="$E1 -e $f"
2497 2165 fi
2498 2166 done
2499 2167
2500 2168 E2=
2501 2169 f2=
2502 2170 if [ -d "$SRC/pkg" ]; then
2503 2171 f2="$f2 exceptions/packaging"
2504 2172 fi
2505 2173
2506 2174 for f in $f2; do
2507 2175 if [ -f "$f" ]; then
2508 2176 E2="$E2 -e $f"
2509 2177 fi
2510 2178 done
2511 2179
2512 2180 if [ -f "$REF_PROTO_LIST" ]; then
2513 2181 #
2514 2182 # For builds that copy the IHV proto area (-X), add the
2515 2183 # IHV proto list to the reference list if the reference
2516 2184 # was built without -X.
2517 2185 #
2518 2186 # For builds that don't copy the IHV proto area, add the
2519 2187 # IHV proto list to the build's proto list if the
2520 2188 # reference was built with -X.
2521 2189 #
2522 2190 # Use the presence of the first file entry of the cached
2523 2191 # IHV proto list in the reference list to determine
2524 2192 # whether it was built with -X or not.
2525 2193 #
2526 2194 IHV_REF_PROTO_LIST=$SRC/pkg/proto_list_ihv_$MACH
2527 2195 grepfor=$(nawk '$1 == "f" { print $2; exit }' \
2528 2196 $IHV_REF_PROTO_LIST 2> /dev/null)
2529 2197 if [ $? = 0 -a -n "$grepfor" ]; then
2530 2198 if [ "$X_FLAG" = "y" ]; then
2531 2199 grep -w "$grepfor" \
2532 2200 $REF_PROTO_LIST > /dev/null
2533 2201 if [ ! "$?" = "0" ]; then
2534 2202 REF_IHV_PROTO="-d $IHV_REF_PROTO_LIST"
2535 2203 fi
2536 2204 else
2537 2205 grep -w "$grepfor" \
2538 2206 $REF_PROTO_LIST > /dev/null
2539 2207 if [ "$?" = "0" ]; then
2540 2208 IHV_PROTO_LIST="$IHV_REF_PROTO_LIST"
2541 2209 fi
2542 2210 fi
2543 2211 fi
2544 2212 fi
2545 2213 fi
2546 2214
2547 2215 if [ "$N_FLAG" != "y" -a -f $SRC/pkgdefs/Makefile ]; then
2548 2216 echo "\n==== Impact on SVr4 packages ====\n" >> $mail_msg_file
2549 2217 #
2550 2218 # Compare the build's proto list with current package
2551 2219 # definitions to audit the quality of package
2552 2220 # definitions and makefile install targets. Use the
2553 2221 # current exception list.
2554 2222 #
2555 2223 PKGDEFS_LIST=""
2556 2224 for d in $abssrcdirs; do
2557 2225 if [ -d $d/pkgdefs ]; then
2558 2226 PKGDEFS_LIST="$PKGDEFS_LIST -d $d/pkgdefs"
2559 2227 fi
2560 2228 done
2561 2229 if [ "$X_FLAG" = "y" -a \
2562 2230 -d $IA32_IHV_WS/usr/src/pkgdefs ]; then
2563 2231 PKGDEFS_LIST="$PKGDEFS_LIST -d $IA32_IHV_WS/usr/src/pkgdefs"
2564 2232 fi
2565 2233 $PROTOCMPTERSE \
2566 2234 "Files missing from the proto area:" \
2567 2235 "Files missing from packages:" \
2568 2236 "Inconsistencies between pkgdefs and proto area:" \
2569 2237 ${E1} \
2570 2238 ${PKGDEFS_LIST} \
2571 2239 $ATLOG/proto_list_${MACH} \
2572 2240 >> $mail_msg_file
2573 2241 fi
2574 2242
2575 2243 if [ "$N_FLAG" != "y" -a -d $SRC/pkg ]; then
2576 2244 echo "\n==== Validating manifests against proto area ====\n" \
2577 2245 >> $mail_msg_file
2578 2246 ( cd $SRC/pkg ; $MAKE -e protocmp ROOT="$checkroot" ) \
2579 2247 >> $mail_msg_file
2580 2248
2581 2249 fi
2582 2250
2583 2251 if [ "$N_FLAG" != "y" -a -f "$REF_PROTO_LIST" ]; then
2584 2252 echo "\n==== Impact on proto area ====\n" >> $mail_msg_file
2585 2253 if [ -n "$E2" ]; then
2586 2254 ELIST=$E2
2587 2255 else
2588 2256 ELIST=$E1
2589 2257 fi
2590 2258 $PROTOCMPTERSE \
2591 2259 "Files in yesterday's proto area, but not today's:" \
2592 2260 "Files in today's proto area, but not yesterday's:" \
2593 2261 "Files that changed between yesterday and today:" \
2594 2262 ${ELIST} \
2595 2263 -d $REF_PROTO_LIST \
2596 2264 $REF_IHV_PROTO \
2597 2265 $ATLOG/proto_list_${MACH} \
2598 2266 $IHV_PROTO_LIST \
2599 2267 >> $mail_msg_file
2600 2268 fi
2601 2269 fi
2602 2270
2603 2271 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
2604 2272 staffer cp $ATLOG/proto_list_${MACH} \
2605 2273 $PARENT_WS/usr/src/proto_list_${MACH}
2606 2274 fi
2607 2275
2608 2276 # Update parent proto area if necessary. This is done now
2609 2277 # so that the proto area has either DEBUG or non-DEBUG kernels.
2610 2278 # Note that this clears out the lock file, so we can dispense with
2611 2279 # the variable now.
2612 2280 if [ "$U_FLAG" = "y" -a "$build_ok" = "y" ]; then
2613 2281 echo "\n==== Copying proto area to $NIGHTLY_PARENT_ROOT ====\n" | \
2614 2282 tee -a $LOGFILE >> $mail_msg_file
2615 2283 rm -rf $NIGHTLY_PARENT_ROOT/*
2616 2284 unset Ulockfile
2617 2285 mkdir -p $NIGHTLY_PARENT_ROOT
2618 2286 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
2619 2287 ( cd $ROOT; tar cf - . |
2620 2288 ( cd $NIGHTLY_PARENT_ROOT; umask 0; tar xpf - ) ) 2>&1 |
2621 2289 tee -a $mail_msg_file >> $LOGFILE
2622 2290 fi
2623 2291 if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n ]]; then
2624 2292 rm -rf $NIGHTLY_PARENT_ROOT-nd/*
2625 2293 mkdir -p $NIGHTLY_PARENT_ROOT-nd
2626 2294 cd $ROOT-nd
2627 2295 ( tar cf - . |
2628 2296 ( cd $NIGHTLY_PARENT_ROOT-nd; umask 0; tar xpf - ) ) 2>&1 |
2629 2297 tee -a $mail_msg_file >> $LOGFILE
2630 2298 fi
2631 2299 if [ -n "${NIGHTLY_PARENT_TOOLS_ROOT}" ]; then
2632 2300 echo "\n==== Copying tools proto area to $NIGHTLY_PARENT_TOOLS_ROOT ====\n" | \
2633 2301 tee -a $LOGFILE >> $mail_msg_file
2634 2302 rm -rf $NIGHTLY_PARENT_TOOLS_ROOT/*
2635 2303 mkdir -p $NIGHTLY_PARENT_TOOLS_ROOT
2636 2304 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
2637 2305 ( cd $TOOLS_PROTO; tar cf - . |
2638 2306 ( cd $NIGHTLY_PARENT_TOOLS_ROOT;
2639 2307 umask 0; tar xpf - ) ) 2>&1 |
2640 2308 tee -a $mail_msg_file >> $LOGFILE
2641 2309 fi
2642 2310 fi
2643 2311 fi
2644 2312
2645 2313 #
2646 2314 # ELF verification: ABI (-A) and runtime (-r) checks
2647 2315 #
2648 2316 if [[ ($build_ok = y) && ( ($A_FLAG = y) || ($r_FLAG = y) ) ]]; then
2649 2317 # Directory ELF-data.$MACH holds the files produced by these tests.
2650 2318 elf_ddir=$SRC/ELF-data.$MACH
2651 2319
2652 2320 # If there is a previous ELF-data backup directory, remove it. Then,
2653 2321 # rotate current ELF-data directory into its place and create a new
2654 2322 # empty directory
2655 2323 rm -rf $elf_ddir.ref
2656 2324 if [[ -d $elf_ddir ]]; then
2657 2325 mv $elf_ddir $elf_ddir.ref
2658 2326 fi
2659 2327 mkdir -p $elf_ddir
2660 2328
2661 2329 # Call find_elf to produce a list of the ELF objects in the proto area.
2662 2330 # This list is passed to check_rtime and interface_check, preventing
2663 2331 # them from separately calling find_elf to do the same work twice.
2664 2332 find_elf -fr $checkroot > $elf_ddir/object_list
2665 2333
2666 2334 if [[ $A_FLAG = y ]]; then
2667 2335 echo "\n==== Check versioning and ABI information ====\n" | \
2668 2336 tee -a $LOGFILE >> $mail_msg_file
2669 2337
2670 2338 # Produce interface description for the proto. Report errors.
2671 2339 interface_check -o -w $elf_ddir -f object_list \
2672 2340 -i interface -E interface.err
2673 2341 if [[ -s $elf_ddir/interface.err ]]; then
2674 2342 tee -a $LOGFILE < $elf_ddir/interface.err \
2675 2343 >> $mail_msg_file
2676 2344 fi
2677 2345
2678 2346 # If ELF_DATA_BASELINE_DIR is defined, compare the new interface
2679 2347 # description file to that from the baseline gate. Issue a
2680 2348 # warning if the baseline is not present, and keep going.
2681 2349 if [[ "$ELF_DATA_BASELINE_DIR" != '' ]]; then
2682 2350 base_ifile="$ELF_DATA_BASELINE_DIR/interface"
2683 2351
2684 2352 echo "\n==== Compare versioning and ABI information" \
2685 2353 "to baseline ====\n" | \
2686 2354 tee -a $LOGFILE >> $mail_msg_file
2687 2355 echo "Baseline: $base_ifile\n" >> $LOGFILE
2688 2356
2689 2357 if [[ -f $base_ifile ]]; then
2690 2358 interface_cmp -d -o $base_ifile \
2691 2359 $elf_ddir/interface > $elf_ddir/interface.cmp
2692 2360 if [[ -s $elf_ddir/interface.cmp ]]; then
2693 2361 echo | tee -a $LOGFILE >> $mail_msg_file
2694 2362 tee -a $LOGFILE < \
2695 2363 $elf_ddir/interface.cmp \
2696 2364 >> $mail_msg_file
2697 2365 fi
2698 2366 else
2699 2367 echo "baseline not available. comparison" \
2700 2368 "skipped" | \
2701 2369 tee -a $LOGFILE >> $mail_msg_file
2702 2370 fi
2703 2371
2704 2372 fi
2705 2373 fi
2706 2374
2707 2375 if [[ $r_FLAG = y ]]; then
2708 2376 echo "\n==== Check ELF runtime attributes ====\n" | \
2709 2377 tee -a $LOGFILE >> $mail_msg_file
2710 2378
2711 2379 # If we're doing a DEBUG build the proto area will be left
2712 2380 # with debuggable objects, thus don't assert -s.
2713 2381 if [[ $D_FLAG = y ]]; then
2714 2382 rtime_sflag=""
2715 2383 else
2716 2384 rtime_sflag="-s"
2717 2385 fi
2718 2386 check_rtime -i -m -v $rtime_sflag -o -w $elf_ddir \
2719 2387 -D object_list -f object_list -E runtime.err \
2720 2388 -I runtime.attr.raw
2721 2389
2722 2390 # check_rtime -I output needs to be sorted in order to
2723 2391 # compare it to that from previous builds.
2724 2392 sort $elf_ddir/runtime.attr.raw > $elf_ddir/runtime.attr
2725 2393 rm $elf_ddir/runtime.attr.raw
2726 2394
2727 2395 # Report errors
2728 2396 if [[ -s $elf_ddir/runtime.err ]]; then
2729 2397 tee -a $LOGFILE < $elf_ddir/runtime.err \
2730 2398 >> $mail_msg_file
2731 2399 fi
2732 2400
2733 2401 # If there is an ELF-data directory from a previous build,
2734 2402 # then diff the attr files. These files contain information
2735 2403 # about dependencies, versioning, and runpaths. There is some
2736 2404 # overlap with the ABI checking done above, but this also
2737 2405 # flushes out non-ABI interface differences along with the
2738 2406 # other information.
2739 2407 echo "\n==== Diff ELF runtime attributes" \
2740 2408 "(since last build) ====\n" | \
2741 2409 tee -a $LOGFILE >> $mail_msg_file >> $mail_msg_file
2742 2410
2743 2411 if [[ -f $elf_ddir.ref/runtime.attr ]]; then
2744 2412 diff $elf_ddir.ref/runtime.attr \
2745 2413 $elf_ddir/runtime.attr \
2746 2414 >> $mail_msg_file
2747 2415 fi
2748 2416 fi
2749 2417
2750 2418 # If -u set, copy contents of ELF-data.$MACH to the parent workspace.
2751 2419 if [[ "$u_FLAG" = "y" ]]; then
2752 2420 p_elf_ddir=$PARENT_WS/usr/src/ELF-data.$MACH
2753 2421
2754 2422 # If parent lacks the ELF-data.$MACH directory, create it
2755 2423 if [[ ! -d $p_elf_ddir ]]; then
2756 2424 staffer mkdir -p $p_elf_ddir
2757 2425 fi
2758 2426
2759 2427 # These files are used asynchronously by other builds for ABI
2760 2428 # verification, as above for the -A option. As such, we require
2761 2429 # the file replacement to be atomic. Copy the data to a temp
2762 2430 # file in the same filesystem and then rename into place.
2763 2431 (
2764 2432 cd $elf_ddir
2765 2433 for elf_dfile in *; do
2766 2434 staffer cp $elf_dfile \
2767 2435 ${p_elf_ddir}/${elf_dfile}.new
2768 2436 staffer mv -f ${p_elf_ddir}/${elf_dfile}.new \
2769 2437 ${p_elf_ddir}/${elf_dfile}
2770 2438 done
2771 2439 )
2772 2440 fi
2773 2441 fi
2774 2442
2775 2443 # DEBUG lint of kernel begins
2776 2444
2777 2445 if [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then
2778 2446 if [ "$LINTDIRS" = "" ]; then
2779 2447 # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y"
2780 2448 LINTDIRS="$SRC y"
2781 2449 fi
2782 2450 set $LINTDIRS
2783 2451 while [ $# -gt 0 ]; do
2784 2452 dolint $1 $2; shift; shift
2785 2453 done
2786 2454 else
2787 2455 echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE
2788 2456 fi
2789 2457
2790 2458 # "make check" begins
2791 2459
2792 2460 if [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then
2793 2461 # remove old check.out
2794 2462 rm -f $SRC/check.out
2795 2463
2796 2464 rm -f $SRC/check-${MACH}.out
2797 2465 cd $SRC
2798 2466 $MAKE -ek check ROOT="$checkroot" 2>&1 | tee -a $SRC/check-${MACH}.out \
2799 2467 >> $LOGFILE
2800 2468 echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file
2801 2469
2802 2470 grep ":" $SRC/check-${MACH}.out |
2803 2471 egrep -v "Ignoring unknown host" | \
2804 2472 sort | uniq >> $mail_msg_file
2805 2473 else
2806 2474 echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE
2807 2475 fi
2808 2476
2809 2477 echo "\n==== Find core files ====\n" | \
2810 2478 tee -a $LOGFILE >> $mail_msg_file
2811 2479
2812 2480 find $abssrcdirs -name core -a -type f -exec file {} \; | \
2813 2481 tee -a $LOGFILE >> $mail_msg_file
2814 2482
2815 2483 if [ "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then
2816 2484 echo "\n==== Diff unreferenced files (since last build) ====\n" \
2817 2485 | tee -a $LOGFILE >>$mail_msg_file
2818 2486 rm -f $SRC/unref-${MACH}.ref
2819 2487 if [ -f $SRC/unref-${MACH}.out ]; then
2820 2488 mv $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref
2821 2489 fi
2822 2490
2823 2491 findunref -S $SCM_TYPE -t $SRC/.build.tstamp -s usr $CODEMGR_WS \
2824 2492 ${TOOLS}/findunref/exception_list 2>> $mail_msg_file | \
2825 2493 sort > $SRC/unref-${MACH}.out
2826 2494
2827 2495 if [ ! -f $SRC/unref-${MACH}.ref ]; then
2828 2496 cp $SRC/unref-${MACH}.out $SRC/unref-${MACH}.ref
↓ open down ↓ |
355 lines elided |
↑ open up ↑ |
2829 2497 fi
2830 2498
2831 2499 diff $SRC/unref-${MACH}.ref $SRC/unref-${MACH}.out >>$mail_msg_file
2832 2500 fi
2833 2501
2834 2502 #
2835 2503 # Generate the OpenSolaris deliverables if requested. Some of these
2836 2504 # steps need to come after findunref and are commented below.
2837 2505 #
2838 2506
2839 -# If we are doing an OpenSolaris _source_ build (-S O) then we do
2840 -# not have usr/closed available to us to generate closedbins from,
2841 -# so skip this part.
2842 -if [ "$SO_FLAG" = n -a "$O_FLAG" = y -a "$build_ok" = y ]; then
2843 - echo "\n==== Generating OpenSolaris tarballs ====\n" | \
2844 - tee -a $mail_msg_file >> $LOGFILE
2845 -
2846 - cd $CODEMGR_WS
2847 -
2848 - #
2849 - # This step grovels through the package manifests, so it
2850 - # must come after findunref.
2851 - #
2852 - # We assume no DEBUG vs non-DEBUG package content variation
2853 - # here; if that changes, then the "make all" in $SRC/pkg will
2854 - # need to be moved into the conditionals and repeated for each
2855 - # different build.
2856 - #
2857 - echo "Generating closed binaries tarball(s)..." >> $LOGFILE
2858 - closed_basename=on-closed-bins
2859 - if [ "$D_FLAG" = y ]; then
2860 - bindrop "$closed_basename" >>"$LOGFILE" 2>&1
2861 - if (( $? != 0 )) ; then
2862 - echo "Couldn't create DEBUG closed binaries." |
2863 - tee -a $mail_msg_file >> $LOGFILE
2864 - build_ok=n
2865 - fi
2866 - fi
2867 - if [ "$F_FLAG" = n ]; then
2868 - bindrop -n "$closed_basename-nd" >>"$LOGFILE" 2>&1
2869 - if (( $? != 0 )) ; then
2870 - echo "Couldn't create non-DEBUG closed binaries." |
2871 - tee -a $mail_msg_file >> $LOGFILE
2872 - build_ok=n
2873 - fi
2874 - fi
2875 -
2876 - echo "Generating README.opensolaris..." >> $LOGFILE
2877 - cat $SRC/tools/opensolaris/README.opensolaris.tmpl | \
2878 - mkreadme_osol $CODEMGR_WS/README.opensolaris >> $LOGFILE 2>&1
2879 - if (( $? != 0 )) ; then
2880 - echo "Couldn't create README.opensolaris." |
2881 - tee -a $mail_msg_file >> $LOGFILE
2882 - build_ok=n
2883 - fi
2884 -fi
2885 -
2886 2507 # Verify that the usual lists of files, such as exception lists,
2887 2508 # contain only valid references to files. If the build has failed,
2888 2509 # then don't check the proto area.
2889 2510 CHECK_PATHS=${CHECK_PATHS:-y}
2890 2511 if [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then
2891 2512 echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \
2892 2513 >>$mail_msg_file
2893 2514 arg=-b
2894 2515 [ "$build_ok" = y ] && arg=
2895 2516 checkpaths $arg $checkroot 2>&1 | tee -a $LOGFILE >>$mail_msg_file
2896 2517 fi
2897 2518
2898 2519 if [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then
2899 2520 echo "\n==== Impact on file permissions ====\n" \
2900 2521 >> $mail_msg_file
2901 2522
2902 2523 abspkgdefs=
2903 2524 abspkg=
2904 2525 for d in $abssrcdirs; do
2905 2526 if [ -d "$d/pkgdefs" ]; then
2906 2527 abspkgdefs="$abspkgdefs $d"
2907 2528 fi
2908 2529 if [ -d "$d/pkg" ]; then
2909 2530 abspkg="$abspkg $d"
2910 2531 fi
2911 2532 done
2912 2533
2913 2534 if [ -n "$abspkgdefs" ]; then
2914 2535 pmodes -qvdP \
2915 2536 `find $abspkgdefs -name pkginfo.tmpl -print -o \
2916 2537 -name .del\* -prune | sed -e 's:/pkginfo.tmpl$::' | \
2917 2538 sort -u` >> $mail_msg_file
2918 2539 fi
2919 2540
2920 2541 if [ -n "$abspkg" ]; then
2921 2542 for d in "$abspkg"; do
2922 2543 ( cd $d/pkg ; $MAKE -e pmodes ) >> $mail_msg_file
2923 2544 done
2924 2545 fi
2925 2546 fi
2926 2547
2927 2548 if [ "$w_FLAG" = "y" -a "$build_ok" = "y" ]; then
2928 2549 if [[ "$MULTI_PROTO" = no || "$D_FLAG" = y ]]; then
2929 2550 do_wsdiff DEBUG $ROOT.prev $ROOT
2930 2551 fi
2931 2552
2932 2553 if [[ "$MULTI_PROTO" = yes && "$F_FLAG" = n ]]; then
2933 2554 do_wsdiff non-DEBUG $ROOT-nd.prev $ROOT-nd
2934 2555 fi
2935 2556 fi
2936 2557
2937 2558 END_DATE=`date`
2938 2559 echo "==== Nightly $maketype build completed: $END_DATE ====" | \
2939 2560 tee -a $LOGFILE >> $build_time_file
2940 2561
2941 2562 typeset -i10 hours
2942 2563 typeset -Z2 minutes
2943 2564 typeset -Z2 seconds
2944 2565
2945 2566 elapsed_time=$SECONDS
2946 2567 ((hours = elapsed_time / 3600 ))
2947 2568 ((minutes = elapsed_time / 60 % 60))
2948 2569 ((seconds = elapsed_time % 60))
2949 2570
2950 2571 echo "\n==== Total build time ====" | \
2951 2572 tee -a $LOGFILE >> $build_time_file
2952 2573 echo "\nreal ${hours}:${minutes}:${seconds}" | \
2953 2574 tee -a $LOGFILE >> $build_time_file
2954 2575
2955 2576 if [ "$u_FLAG" = "y" -a "$f_FLAG" = "y" -a "$build_ok" = "y" ]; then
2956 2577 staffer cp ${SRC}/unref-${MACH}.out $PARENT_WS/usr/src/
2957 2578
2958 2579 #
2959 2580 # Produce a master list of unreferenced files -- ideally, we'd
2960 2581 # generate the master just once after all of the nightlies
2961 2582 # have finished, but there's no simple way to know when that
2962 2583 # will be. Instead, we assume that we're the last nightly to
2963 2584 # finish and merge all of the unref-${MACH}.out files in
2964 2585 # $PARENT_WS/usr/src/. If we are in fact the final ${MACH} to
2965 2586 # finish, then this file will be the authoritative master
2966 2587 # list. Otherwise, another ${MACH}'s nightly will eventually
2967 2588 # overwrite ours with its own master, but in the meantime our
2968 2589 # temporary "master" will be no worse than any older master
2969 2590 # which was already on the parent.
2970 2591 #
2971 2592
2972 2593 set -- $PARENT_WS/usr/src/unref-*.out
2973 2594 cp "$1" ${TMPDIR}/unref.merge
2974 2595 shift
2975 2596
2976 2597 for unreffile; do
2977 2598 comm -12 ${TMPDIR}/unref.merge "$unreffile" > ${TMPDIR}/unref.$$
2978 2599 mv ${TMPDIR}/unref.$$ ${TMPDIR}/unref.merge
2979 2600 done
2980 2601
2981 2602 staffer cp ${TMPDIR}/unref.merge $PARENT_WS/usr/src/unrefmaster.out
2982 2603 fi
2983 2604
2984 2605 #
2985 2606 # All done save for the sweeping up.
2986 2607 # (whichever exit we hit here will trigger the "cleanup" trap which
2987 2608 # optionally sends mail on completion).
2988 2609 #
2989 2610 if [ "$build_ok" = "y" ]; then
2990 2611 exit 0
2991 2612 fi
2992 2613 exit 1
↓ open down ↓ |
97 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX