blob: f80dc9cfc6dba8cbb6d46ad2dcc666869e07bf04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
#!/bin/bash
#------------------------------------------------------------------
# Copyright (c) 2006-2011 Gluster, Inc. <http://www.gluster.com>
# This file is part of Gluster Management Console.
#
# Gluster Management Console is free software; you can redistribute
# it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# Gluster Management Console is distributed in the hope that it
# will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------
USAGE_ERR=1
BUCKMINSTER_URL=http://download.eclipse.org/tools/buckminster/headless-3.7/
BUCKMINSTER_PRODUCT_NAME=org.eclipse.buckminster.cmdline.product
GMC_WEBSTART_PROJECT=org.gluster.storage.management.console.feature.webstart
GMC_CORE_PROJECT=org.gluster.storage.management.core
GMG_PROJECT=org.gluster.storage.management.gateway
TYPE_ALL="a"
TYPE_SETUP="s"
TYPE_BUILD="b"
startBold() {
tput bold
}
stopBold() {
tput sgr0
}
# Shows given text in bold
showBold() {
startBold
echo ${1}
stopBold
}
# Get the director that can be used to install headless buckminster
get_director()
{
rm -rf ${TOOLS_DIR}
mkdir -p ${TOOLS_DIR}
cd ${TOOLS_DIR}
echo "Downloading `startBold`director`stopBold`..."
wget http://ftp.daum.net/eclipse//tools/buckminster/products/director_latest.zip
echo "Installing director..."
unzip director_latest.zip
}
install_buckminster()
{
rm -rf ${BUCKMINSTER_HOME}
mkdir -p ${BUCKMINSTER_HOME}
echo "Installing `startBold`Buckminster`stopBold`..."
cd ${TOOLS_DIR}/director
./director -r ${BUCKMINSTER_URL} -d ${BUCKMINSTER_HOME} -p Buckminster -i ${BUCKMINSTER_PRODUCT_NAME}
echo "Setting up Buckminster..."
cd ${BUCKMINSTER_HOME}
echo " => core"
./buckminster install ${BUCKMINSTER_URL} org.eclipse.buckminster.core.headless.feature
echo " => pde"
./buckminster install ${BUCKMINSTER_URL} org.eclipse.buckminster.pde.headless.feature
echo " => git"
./buckminster install ${BUCKMINSTER_URL} org.eclipse.buckminster.git.headless.feature
echo " => emma"
./buckminster install ${BUCKMINSTER_URL} org.eclipse.buckminster.emma.headless.feature
}
# Create keystore for jar signing (self signed)
setup_keys()
{
mkdir -p ${KEYS_DIR}
cd ${KEYS_DIR}
keytool -genkeypair -keystore gluster.keystore -storepass gluster -alias gluster -keyalg RSA << EOF
Gluster
Gluster
Gluster
Dummy
Dummy
US
yes
EOF
keytool -selfcert -alias gluster -keystore gluster.keystore << EOF
gluster
EOF
cd -
}
configure_workspace()
{
echo "Configuring the workspace..."
rm -rf ${WORKSPACE_DIR}
mkdir -p ${WORKSPACE_DIR}
cd ${WORKSPACE_DIR}
cp -R ${BASE_DIR}/gmc/* . 2>/dev/null
ln -fs ${BASE_DIR}/gmc-target .
echo "Importing target platform..."
${BUCKMINSTER_HOME}/buckminster importtarget -data ${WORKSPACE_DIR} --active gmc-target/org.gluster.storage.management.console.target/gmc.target
cd -
}
build_gmc()
{
os=${1}
ws=${2}
arch=${3}
cd ${WORKSPACE_DIR}
DIST_DIR=${DIST_BASE}/gmc/${os}.${ws}.${arch}
if [ ! -d ${DIST_DIR} ]; then
mkdir -p ${DIST_DIR}
fi
echo "Importing component query for glustermc..."
${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/org.gluster.storage.management.console.feature.webstart.cquery
echo "Building GMC for [${os}.${ws}.${arch}]"
${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} -Dtarget.os=${os} -Dtarget.ws=${ws} -Dtarget.arch=${arch} -Dcbi.include.source=false --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#create.eclipse.jnlp.product
${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#copy.root.files
# buckminster signs the jars using eclipse certificate - hence unsign and sign them again
echo "Signing product jars..."
${BUCKMINSTER_HOME}/buckminster perform -data ${WORKSPACE_DIR} -Dbuckminster.output.root=${DIST_DIR} --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#unsign.jars
${BUCKMINSTER_HOME}/buckminster perform -data ${WORKSPACE_DIR} -Dbuckminster.output.root=${DIST_DIR} -Djar.signing.keystore=${KEYS_DIR}/gluster.keystore --properties ${PROPERTIES_FILE} ${GMC_WEBSTART_PROJECT}#sign.jars
}
build_gmg()
{
cd ${WORKSPACE_DIR}
export DIST_DIR=${DIST_BASE}/gmg
if [ ! -d ${DIST_DIR} ]; then
mkdir -p ${DIST_DIR}
fi
echo "Importing component query for glustermg..."
${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/org.gluster.storage.management.core.cquery
${BUCKMINSTER_HOME}/buckminster import -data ${WORKSPACE_DIR} build/org.gluster.storage.management.gateway.cquery
echo "Building CORE..."
${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} -Dcbi.include.source=false --properties ${PROPERTIES_FILE} ${GMC_CORE_PROJECT}#bundle.jar
echo "Building Gateway..."
${BUCKMINSTER_HOME}/buckminster perform -Dbuckminster.output.root=${DIST_DIR} -data ${WORKSPACE_DIR} -Dcbi.include.source=false --properties ${PROPERTIES_FILE} ${GMG_PROJECT}#archive
echo "Packaging Gateway..."
${SCRIPT_DIR}/package-gateway.sh ${DIST_DIR} ${DIST_BASE}/gmc
}
package_backend()
{
cd ${WORKSPACE_DIR}
echo "Packaging backend scripts"
export DIST_DIR=${DIST_BASE}/gmg-backend
if [ ! -d ${DIST_DIR} ]; then
mkdir -p ${DIST_DIR}
fi
${SCRIPT_DIR}/package-backend.sh ${DIST_DIR}
}
build_gmc_all()
{
build_gmc linux gtk x86
build_gmc linux gtk x86_64
build_gmc win32 win32 x86
build_gmc win32 win32 x86_64
build_gmc macosx cocoa x86
build_gmc macosx cocoa x86_64
}
build()
{
export VERSION=1.0.0
build_gmc_all
build_gmg
package_backend
}
#-----------------------------------
# Main Action Body
#-----------------------------------
echo
if [ $# -ne 1 ]; then
echo "Usage: ${0} <build-type>"
echo "build-type value can be one of:"
echo " `startBold` ${TYPE_ALL}`stopBold` - Sets up the build directory and then triggers a full build"
echo " `startBold` ${TYPE_SETUP}`stopBold` - Sets up the build directory; doesn't trigger build"
echo " `startBold` ${TYPE_BUILD}`stopBold` - Assumes that build directory is set up and simply triggers the build"
echo
exit ${USAGE_ERR}
fi
BUILD_MODE=${1}
BASE_DIR=${PWD}/../..
TOOLS_DIR=${BASE_DIR}/tools
DIST_BASE=${BASE_DIR}/dist
KEYS_DIR=${TOOLS_DIR}/keys
BUCKMINSTER_HOME=${TOOLS_DIR}/buckminster
WORKSPACE_DIR=${BUCKMINSTER_HOME}/workspace
PROPERTIES_FILE=${WORKSPACE_DIR}/build/glustermc_build.properties
SCRIPT_DIR=${PWD}
if [ "${BUILD_MODE}" == "${TYPE_ALL}" -o "${BUILD_MODE}" == "${TYPE_SETUP}" ]; then
get_director
install_buckminster
setup_keys
fi
if [ "${BUILD_MODE}" == "${TYPE_ALL}" -o "${BUILD_MODE}" == "${TYPE_BUILD}" ]; then
configure_workspace
build
fi
|