6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 # Copyright 2008, 2010, Richard Lowe
26 # Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27 # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
28 # Copyright (c) 2017 by Delphix. All rights reserved.
29 #
30 # Based on the nightly script from the integration folks,
31 # Mostly modified and owned by mike_s.
32 # Changes also by kjc, dmk.
33 #
34 # BRINGOVER_WS may be specified in the env file.
35 # The default is the old behavior of CLONE_WS
36 #
37 # -i on the command line, means fast options, so when it's on the
38 # command line (only), lint and check builds are skipped no matter what
39 # the setting of their individual flags are in NIGHTLY_OPTIONS.
40 #
41 # LINTDIRS can be set in the env file, format is a list of:
42 #
43 # /dirname-to-run-lint-on flag
44 #
45 # Where flag is: y - enable lint noise diff output
46 # n - disable lint noise diff output
47 #
89 typeset orig_p_FLAG="$p_FLAG"
90 typeset crypto_signer="$CODESIGN_USER"
91
92 suffix=""
93
94 # non-DEBUG build begins
95
96 if [ "$F_FLAG" = "n" ]; then
97 set_non_debug_build_flags
98 CODESIGN_USER="$crypto_signer" \
99 build "non-DEBUG" "$suffix-nd" "-nd" "$MULTI_PROTO"
100 else
101 echo "\n==== No non-DEBUG $open_only build ====\n" >> "$LOGFILE"
102 fi
103
104 # non-DEBUG build ends
105
106 # DEBUG build begins
107
108 if [ "$D_FLAG" = "y" ]; then
109 set_debug_build_flags
110 CODESIGN_USER="$crypto_signer" \
111 build "DEBUG" "$suffix" "" "$MULTI_PROTO"
112 else
113 echo "\n==== No DEBUG $open_only build ====\n" >> "$LOGFILE"
114 fi
115
116 # DEBUG build ends
117
118 p_FLAG="$orig_p_FLAG"
119 }
120
121 #
122 # usage: run_hook HOOKNAME ARGS...
123 #
124 # If variable "$HOOKNAME" is defined, insert a section header into
125 # our logs and then run the command with ARGS
126 #
127 function run_hook {
128 HOOKNAME=$1
1062
1063 case "$build_ok" in
1064 y)
1065 state=Completed
1066 ;;
1067 i)
1068 state=Interrupted
1069 ;;
1070 *)
1071 state=Failed
1072 ;;
1073 esac
1074
1075 if [[ $state != "Interrupted" && $build_extras_ok != "y" ]]; then
1076 state=Failed
1077 fi
1078
1079 NIGHTLY_STATUS=$state
1080 export NIGHTLY_STATUS
1081
1082 run_hook POST_NIGHTLY $state
1083 run_hook SYS_POST_NIGHTLY $state
1084
1085 #
1086 # mailx(1) sets From: based on the -r flag
1087 # if it is given.
1088 #
1089 mailx_r=
1090 if [[ -n "${MAILFROM}" ]]; then
1091 mailx_r="-r ${MAILFROM}"
1092 fi
1093
1094 cat $build_time_file $build_environ_file $mail_msg_file \
1095 > ${LLOG}/mail_msg
1096 if [ "$m_FLAG" = "y" ]; then
1097 cat ${LLOG}/mail_msg | /usr/bin/mailx ${mailx_r} -s \
1098 "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \
1099 ${MAILTO}
1100 fi
1101
1102 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
1103 staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH}
1104 staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log
1105 fi
1106
1107 mv $LOGFILE $LLOG
1108 }
1109
1110 #
1111 # Remove the locks and temporary files on any exit
1112 #
1113 function cleanup {
1114 logshuffle
1115
|
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 # Copyright 2008, 2010, Richard Lowe
26 # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
27 # Copyright 2014 Nexenta Systems, Inc. All rights reserved.
28 # Copyright (c) 2017 by Delphix. All rights reserved.
29 #
30 # Based on the nightly script from the integration folks,
31 # Mostly modified and owned by mike_s.
32 # Changes also by kjc, dmk.
33 #
34 # BRINGOVER_WS may be specified in the env file.
35 # The default is the old behavior of CLONE_WS
36 #
37 # -i on the command line, means fast options, so when it's on the
38 # command line (only), lint and check builds are skipped no matter what
39 # the setting of their individual flags are in NIGHTLY_OPTIONS.
40 #
41 # LINTDIRS can be set in the env file, format is a list of:
42 #
43 # /dirname-to-run-lint-on flag
44 #
45 # Where flag is: y - enable lint noise diff output
46 # n - disable lint noise diff output
47 #
89 typeset orig_p_FLAG="$p_FLAG"
90 typeset crypto_signer="$CODESIGN_USER"
91
92 suffix=""
93
94 # non-DEBUG build begins
95
96 if [ "$F_FLAG" = "n" ]; then
97 set_non_debug_build_flags
98 CODESIGN_USER="$crypto_signer" \
99 build "non-DEBUG" "$suffix-nd" "-nd" "$MULTI_PROTO"
100 else
101 echo "\n==== No non-DEBUG $open_only build ====\n" >> "$LOGFILE"
102 fi
103
104 # non-DEBUG build ends
105
106 # DEBUG build begins
107
108 if [ "$D_FLAG" = "y" ]; then
109 VERSION=$VERSION":debug"
110 set_debug_build_flags
111 CODESIGN_USER="$crypto_signer" \
112 build "DEBUG" "$suffix" "" "$MULTI_PROTO"
113 else
114 echo "\n==== No DEBUG $open_only build ====\n" >> "$LOGFILE"
115 fi
116
117 # DEBUG build ends
118
119 p_FLAG="$orig_p_FLAG"
120 }
121
122 #
123 # usage: run_hook HOOKNAME ARGS...
124 #
125 # If variable "$HOOKNAME" is defined, insert a section header into
126 # our logs and then run the command with ARGS
127 #
128 function run_hook {
129 HOOKNAME=$1
1063
1064 case "$build_ok" in
1065 y)
1066 state=Completed
1067 ;;
1068 i)
1069 state=Interrupted
1070 ;;
1071 *)
1072 state=Failed
1073 ;;
1074 esac
1075
1076 if [[ $state != "Interrupted" && $build_extras_ok != "y" ]]; then
1077 state=Failed
1078 fi
1079
1080 NIGHTLY_STATUS=$state
1081 export NIGHTLY_STATUS
1082
1083 # Want ${LLOG}/mail_msg available to POST_NIGHTLY
1084 cat $build_time_file $build_environ_file $mail_msg_file \
1085 > ${LLOG}/mail_msg
1086
1087 run_hook POST_NIGHTLY $state
1088 run_hook SYS_POST_NIGHTLY $state
1089
1090 #
1091 # mailx(1) sets From: based on the -r flag
1092 # if it is given.
1093 #
1094 mailx_r=
1095 if [[ -n "${MAILFROM}" ]]; then
1096 mailx_r="-r ${MAILFROM}"
1097 fi
1098
1099 if [ "$m_FLAG" = "y" ]; then
1100 cat ${LLOG}/mail_msg | /usr/bin/mailx ${mailx_r} -s \
1101 "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \
1102 ${MAILTO}
1103 fi
1104
1105 if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
1106 staffer cp ${LLOG}/mail_msg $PARENT_WS/usr/src/mail_msg-${MACH}
1107 staffer cp $LOGFILE $PARENT_WS/usr/src/nightly-${MACH}.log
1108 fi
1109
1110 mv $LOGFILE $LLOG
1111 }
1112
1113 #
1114 # Remove the locks and temporary files on any exit
1115 #
1116 function cleanup {
1117 logshuffle
1118
|