Print this page
Support for PREBUILT_ILLUMOS, and optional /tmp/debug.$$ output.
| Split |
Close |
| Expand all |
| Collapse all |
--- old/build/illumos/build.sh
+++ new/build/illumos/build.sh
1 1 #!/usr/bin/bash
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, Version 1.0 only
7 7 # (the "License"). You may not use this file except in compliance
8 8 # with the License.
9 9 #
10 10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 11 # or http://www.opensolaris.org/os/licensing.
12 12 # See the License for the specific language governing permissions
13 13 # and limitations under the License.
14 14 #
15 15 # When distributing Covered Code, include this CDDL HEADER in each
16 16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 17 # If applicable, add the following below this CDDL HEADER, with the
18 18 # fields enclosed by brackets "[]" replaced with your own identifying
19 19 # information: Portions Copyright [yyyy] [name of copyright owner]
20 20 #
21 21 # CDDL HEADER END
22 22 #
23 23 #
24 24 # Copyright 2011-2012 OmniTI Computer Consulting, Inc. All rights reserved.
25 25 # Use is subject to license terms.
26 26 #
27 27
28 28 SHELL=/usr/bin/bash
29 29 export SHELL
30 30
31 31 RELEASE_DATE=nightly # This is overridden by the checkout
32 32
33 33 # Load support functions
34 34 . ../../lib/functions.sh
35 35
36 36 PROG=omnios # App name
37 37 VER=$RELVER # App version
38 38 PVER=1 # Package Version (numeric only)
39 39
40 40 PKG=illumos-gate # Package name (without prefix)
41 41 SUMMARY="$PROG" # A short summary of what the app is, starting with its name
42 42 DESC="$SUMMARY -- Illumos and some special sauce." # Longer description
43 43
44 44 #all of the ips depends should be available from OmniTI repos
45 45
46 46 BUILD_DEPENDS_IPS="developer/astdev developer/build/make developer/build/onbld developer/gcc44 developer/java/jdk developer/lexer/flex developer/object-file developer/parser/bison library/glib2 library/libxml2 library/libxslt library/nspr/header-nspr library/perl-5/xml-parser library/security/trousers runtime/perl runtime/perl-64 runtime/perl/manual system/library/math/header-math system/library/install system/library/dbus system/library/libdbus system/library/libdbus-glib system/library/mozilla-nss/header-nss system/management/snmp/net-snmp text/gnu-gettext sunstudio12.1"
47 47
48 48 GIT=git
49 49
50 50 USE_SYSTEM_SSL_HEADERS="TRUE"
51 51
52 52 PKGPREFIX=""
53 53 PREFIX=""
54 54 TMPDIR=/code # This directory must be writable as your non-root user
55 55 BUILDDIR=$USER-$PROG-$VER
56 56 CODEMGR_WS=$TMPDIR/$BUILDDIR/illumos-omnios
57 57
58 58 #Since these variables are used in a sed statment make sure to escape properly
59 59 ILLUMOS_NO="NIGHTLY\_OPTIONS=\'\-nDCmpr\'"
60 60 ILLUMOS_CODEMGR_WS="CODEMGR\_WS=\/code\/$BUILDDIR\/illumos\-omnios"
61 61 #ILLUMOS_CLONE_WS="CLONE\_WS=\'ssh:\/\/anonhg@hg.illumos.org\/illumos\-gate\'"
62 62 ILLUMOS_CLONE_WS="CLONE\_WS=\'anon@src.omniti.com:~omnios\/core\/illumos\-omnios\'"
63 63
64 64 ILLUMOS_PKG_REDIST="PKGPUBLISHER\_REDIST=\'omnios\'"
65 65
66 66 #these variables are appended to the end of the script so no need to escape
67 67 ILLUMOS_GNUC="export __GNUC=''"
68 68 ILLUMOS_GNUC4="export __GNUC4=''"
69 69 ILLUMOS_NO_SHADOW="export CW_NO_SHADOW=1"
70 70 ILLUMOS_GCC_ROOT='export GCC_ROOT="/opt/gcc-4.4.4"'
71 71 ILLUMOS_CW_GCC_DIR='export CW_GCC_DIR="$GCC_ROOT/bin"'
72 72 ILLUMOS_BUILDNUM="ONNV_BUILDNUM=$VER; export ONNV_BUILDNUM;"
73 73 ILLUMOS_MULTI_PROTO="export MULTI_PROTO=yes"
74 74
75 75 sunstudio_location() {
76 76 logmsg "Ensuring that Sun Studio is where Illumos thinks it is..."
77 77 if [[ -L /opt/SUNWspro ]]; then
78 78 logmsg "--- fake SUNWspro link exists, good"
79 79 else
80 80 logmsg "--- making fake SUNWspro directory"
81 81 logcmd sudo ln -s /opt/sunstudio12.1 /opt/SUNWspro || \
82 82 logerr "--- Error: failed to make link"
83 83 fi
84 84 }
85 85
86 86 #In order for the clone to work while running as root, you must have ssh'ed into the box with agent forwarding turned on. Also the sudo'er file must either have the default, group, or user set to allow SSL_AUTH_SOCK.
87 87
88 88 clone_source(){
89 89 logmsg "Creating build dir $TMPDIR/$BUILDDIR"
90 90 logcmd mkdir -p $TMPDIR/$BUILDDIR || \
91 91 logerr "--- Failed to create build dir $TMPDIR/$BUILDDIR"
92 92 logmsg "Entering $TMPDIR/$BUILDDIR"
93 93 pushd $TMPDIR/$BUILDDIR > /dev/null
94 94 if [ -d illumos-omnios ]; then
95 95 logmsg "OMNI Illumos Source in place. Using existing workspace."
96 96 else
97 97 logmsg "Cloning OMNI Illumos Source..."
98 98 logcmd $GIT clone anon@src.omniti.com:~omnios/core/illumos-omnios || \
99 99 logerr "--- Failed to clone source"
100 100 fi
101 101 pushd illumos-omnios
102 102 ILLUMOS_VERSION="VERSION=\'omnios\-`$GIT log --pretty=format:'%h' -n 1`'"
103 103 RELEASE_DATE=`$GIT show --format=format:%ai | awk '{print $1; exit;}' | tr - .`
104 104 echo $ILLUMOS_VERSION
105 105 popd > /dev/null
106 106 logmsg "Leaving $TMPDIR/$BUILDDIR"
107 107 popd > /dev/null
108 108 }
109 109
110 110 build_tools(){
111 111 logmsg "Entering $CODEMGR_WS"
112 112 pushd $CODEMGR_WS > /dev/null
113 113 logmsg "Building extra tools needed for illumos pkgs..."
114 114 logcmd ln -s usr/src/tools/scripts/bldenv.sh .
115 115 logcmd ksh93 bldenv.sh -d illumos.sh -c "cd usr/src && dmake setup"
116 116 logmsg "Leaving $CODEMGR_WS"
117 117 popd > /dev/null
118 118 }
119 119
120 120 modify_build_script() {
121 121 logmsg "Entering $CODEMGR_WS"
122 122 pushd $CODEMGR_WS > /dev/null
123 123 logmsg "Changing illumos.sh variables to what we want them to be..."
124 124 logcmd cp usr/src/tools/env/illumos.sh .
125 125 logcmd /usr/bin/gsed -i -e 's/^.*export NIGHTLY_OPTIONS.*/export '$ILLUMOS_NO'/g;s/^.*export CODEMGR_WS=.*/export '$ILLUMOS_CODEMGR_WS'/g;s/^.*export CLONE_WS=.*/export '$ILLUMOS_CLONE_WS'/g;s/^.*export PKGPUBLISHER_REDIST=.*/export '$ILLUMOS_PKG_REDIST'/g;s/^.*export VERSION=.*/export '$ILLUMOS_VERSION'/g;/^.*GNUC=.*/d;/^.*CW_NO_SHADOW=.*/d;/^.*ONNV_BUILDNUM=.*/d' illumos.sh || \
126 126 logerr "/usr/bin/gsed failed"
127 127 logcmd `echo $ILLUMOS_GNUC >> illumos.sh`
128 128 logcmd `echo $ILLUMOS_GNUC4 >> illumos.sh`
129 129 logcmd `echo $ILLUMOS_GCC_ROOT >> illumos.sh`
130 130 logcmd `echo $ILLUMOS_CW_GCC_DIR >> illumos.sh`
131 131 logcmd `echo $ILLUMOS_NO_SHADOW >> illumos.sh`
132 132 logcmd `echo $ILLUMOS_BUILDNUM >> illumos.sh`
133 133 logcmd `echo $ILLUMOS_MULTI_PROTO >> illumos.sh`
134 134 logcmd `echo RELEASE_DATE=$RELEASE_DATE >> illumos.sh`
135 135 logmsg "Leaving $CODEMGR_WS"
136 136 popd > /dev/null
137 137
138 138 }
139 139
140 140 closed_bins() {
141 141 logmsg "Entering $CODEMGR_WS"
142 142 pushd $CODEMGR_WS > /dev/null
143 143 logmsg "Getting Closed Source Bins..."
144 144 for bin in on-closed-bins.i386.tar.bz2 on-closed-bins-nd.i386.tar.bz2 ; do
145 145 if [[ ! -f $bin ]]; then
146 146 logcmd curl -s -O http://mirrors.omniti.com/illumos-gate/$bin
147 147 fi
148 148 logcmd tar xvpf $bin
149 149 done
150 150 logmsg "Leaving $CODEMGR_WS"
151 151 popd > /dev/null
152 152 }
153 153
154 154 build_pkgs() {
155 155 logmsg "Entering $CODEMGR_WS"
156 156 pushd $CODEMGR_WS > /dev/null
157 157 logmsg "Building illumos pkgs..."
|
↓ open down ↓ |
157 lines elided |
↑ open up ↑ |
158 158 logcmd cp usr/src/tools/scripts/nightly.sh .
159 159 logcmd chmod +x nightly.sh
160 160 logcmd ./nightly.sh illumos.sh || logerr "Nightly failed"
161 161 logmsg "Leaving $CODEMGR_WS"
162 162 popd > /dev/null
163 163 }
164 164
165 165 push_pkgs() {
166 166 logmsg "Entering $CODEMGR_WS"
167 167 pushd $CODEMGR_WS > /dev/null
168 - logmsg "Intentional pause: Last chance to sanity-check before publication!"
169 168 logmsg "Pushing illumos pkgs to $PKGSRVR..."
170 - ask_to_continue
169 + if [[ -z $BATCH ]]; then
170 + logmsg "Intentional pause: Last chance to sanity-check before publication!"
171 + ask_to_continue
172 + fi
171 173 logcmd pkgrecv -s packages/i386/nightly-nd/repo.redist/ -d $PKGSRVR 'pkg:/*'
172 174 logmsg "Leaving $CODEMGR_WS"
173 175 popd > /dev/null
174 176 }
175 177
176 178 init
177 179 prep_build
178 -sunstudio_location
179 -clone_source
180 -modify_build_script
181 -closed_bins
182 -build_tools
183 -build_pkgs
184 -push_pkgs
180 +if [ -d ${PREBUILT_ILLUMOS:-/dev/null} ]; then
181 + wait_for_prebuilt
182 + # Check for existing packages, or for freshly built ones if we pwaited.
183 + if [ -d $PREBUILT_ILLUMOS/packages/i386/nightly-nd/repo.redist ]; then
184 + logmsg "Using illumos-omnios pre-compiled at $PREBUILT_ILLUMOS"
185 + CODEMGR_WS=$PREBUILT_ILLUMOS
186 + push_pkgs
187 + else
188 + logmsg "No $PREBUILT_ILLUMOS/packages/i386/nightly-nd/repo.redist"
189 + if [[ -z $BATCH ]]; then
190 + ask_to_continue
191 + fi
192 + fi
193 +else
194 + sunstudio_location
195 + clone_source
196 + modify_build_script
197 + closed_bins
198 + build_tools
199 + build_pkgs
200 + push_pkgs
201 +fi
185 202 clean_up
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX