-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhelper.mac.fish
294 lines (247 loc) · 7.11 KB
/
helper.mac.fish
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
set -gx SCRIPTSDIR $WORKDIR/scripts
set -gx PLATFORM darwin
set -gx UID (id -u)
set -gx GID (id -g)
set -gx INNERWORKDIR $WORKDIR/work
set -gx THIRDPARTY_BIN $INNERWORKDIR/third_party/bin
set -gx CCACHEBINPATH /usr/local/opt/ccache/libexec
set -gx CMAKE_INSTALL_PREFIX /opt/arangodb
# disable strange TAR feature from MacOSX
set -xg COPYFILE_DISABLE 1
function runLocal
if test -z "$SSH_AUTH_SOCK"
eval (ssh-agent -c) > /dev/null
ssh-add ~/.ssh/id_rsa
set -l agentstarted 1
else
set -l agentstarted ""
end
set -xg GIT_SSH_COMMAND "ssh -o StrictHostKeyChecking=no"
eval $argv
set -l s $status
if test -n "$agentstarted"
ssh-agent -k > /dev/null
set -e SSH_AUTH_SOCK
set -e SSH_AGENT_PID
end
return $s
end
function checkoutArangoDB
runLocal $SCRIPTSDIR/checkoutArangoDB.fish
or return $status
community
end
function checkoutEnterprise
runLocal $SCRIPTSDIR/checkoutEnterprise.fish
or return $status
enterprise
end
function switchBranches
checkoutIfNeeded
runLocal $SCRIPTSDIR/switchBranches.fish $argv
end
function clearWorkdir
runLocal $SCRIPTSDIR/clearWorkdir.fish
end
function buildArangoDB
checkoutIfNeeded
runLocal $SCRIPTSDIR/buildMacOs.fish $argv
set -l s $status
if test $s -ne 0
echo Build error!
return $s
end
end
function makeArangoDB
runLocal $SCRIPTSDIR/makeArangoDB.fish $argv
set -l s $status
if test $s -ne 0
echo Build error!
return $s
end
end
function buildStaticArangoDB
checkoutIfNeeded
runLocal $SCRIPTSDIR/buildMacOs.fish $argv
set -l s $status
if test $s -ne 0
echo Build error!
return $s
end
end
function makeStaticArangoDB
runLocal $SCRIPTSDIR/makeArangoDB.fish $argv
set -l s $status
if test $s -ne 0
echo Build error!
return $s
end
end
function oskar
checkoutIfNeeded
runLocal $SCRIPTSDIR/runTests.fish
end
function oskarFull
checkoutIfNeeded
runLocal $SCRIPTSDIR/runFullTests.fish
end
function pushOskar
cd $WORKDIR
source helper.fish
git push
end
function updateOskar
cd $WORKDIR
and git checkout -- .
and git pull
and source helper.fish
end
function downloadStarter
runLocal $SCRIPTSDIR/downloadStarter.fish $THIRDPARTY_BIN $argv
end
function downloadSyncer
runLocal $SCRIPTSDIR/downloadSyncer.fish $THIRDPARTY_BIN $argv
end
function buildPackage
# This assumes that a build has already happened
# Must have set ARANGODB_DARWIN_UPSTREAM and ARANGODB_DARWIN_REVISION,
# for example by running findArangoDBVersion.
if test -z "$ARANGODB_DARWIN_REVISION"
set v "$ARANGODB_DARWIN_UPSTREAM"
else
set v "$ARANGODB_DARWIN_UPSTREAM-$ARANGODB_DARWIN_REVISION"
end
if test "$ENTERPRISEEDITION" = "On"
echo Building enterprise edition MacOs bundle...
else
echo Building community edition MacOs bundle...
end
and runLocal $SCRIPTSDIR/buildMacOsPackage.fish
and buildTarGzPackage
end
function cleanupThirdParty
rm -rf $THIRDPARTY_BIN
end
function buildEnterprisePackage
if test "$DOWNLOAD_SYNC_USER" = ""
echo "Need to set environment variable DOWNLOAD_SYNC_USER."
return 1
end
# Must have set ARANGODB_VERSION and ARANGODB_PACKAGE_REVISION and
# ARANGODB_FULL_VERSION, for example by running findArangoDBVersion.
maintainerOff
releaseMode
enterprise
set -xg NOSTRIP dont
cleanupThirdParty
and downloadStarter
and downloadSyncer
and buildStaticArangoDB \
-DTARGET_ARCHITECTURE=nehalem \
-DPACKAGING=Bundle \
-DPACKAGE_TARGET_DIR=$INNERWORKDIR \
-DTHIRDPARTY_SBIN=$THIRDPARTY_BIN/arangosync \
-DTHIRDPARTY_BIN=$THIRDPARTY_BIN/arangodb \
-DCMAKE_INSTALL_PREFIX=$CMAKE_INSTALL_PREFIX
and buildPackage
if test $status != 0
echo Building enterprise release failed, stopping.
return 1
end
end
function buildCommunityPackage
# Must have set ARANGODB_VERSION and ARANGODB_PACKAGE_REVISION and
# ARANGODB_FULL_VERSION, for example by running findArangoDBVersion.
maintainerOff
releaseMode
community
set -xg NOSTRIP dont
cleanupThirdParty
and downloadStarter
and buildStaticArangoDB \
-DTARGET_ARCHITECTURE=nehalem \
-DPACKAGING=Bundle \
-DPACKAGE_TARGET_DIR=$INNERWORKDIR \
-DTHIRDPARTY_BIN=$THIRDPARTY_BIN/arangodb \
-DCMAKE_INSTALL_PREFIX=$CMAKE_INSTALL_PREFIX
and buildPackage
if test $status != 0
echo Building community release failed.
return 1
end
end
function buildTarGzPackage
cd $INNERWORKDIR/ArangoDB/build
and rm -rf install
and make install DESTDIR=install
and mkdir install/usr
and mv install/opt/arangodb/bin install/usr
and mv install/opt/arangodb/sbin install/usr
and mv install/opt/arangodb/share install/usr
and mv install/opt/arangodb/etc install
and rm -rf install/opt
and buildTarGzPackageHelper "macosx"
end
function transformBundleSniplet
cd $WORKDIR
set -l BUNDLE_NAME_SERVER "$argv[1]-$argv[2].x86_64.dmg"
set -l DOWNLOAD_LINK "$argv[4]"
if test "$ENTERPRISEEDITION" = "On"
set DOWNLOAD_EDITION "Enterprise"
else
set DOWNLOAD_EDITION "Community"
end
if test ! -f "work/$BUNDLE_NAME_SERVER"; echo "DMG package '$BUNDLE_NAME_SERVER' is missing"; return 1; end
set -l BUNDLE_SIZE_SERVER (expr (wc -c < work/$BUNDLE_NAME_SERVER | tr -d " ") / 1024 / 1024)
set -l TARGZ_NAME_SERVER "$argv[1]-macosx-$argv[3].tar.gz"
if test ! -f "work/$TARGZ_NAME_SERVER"; echo "TAR.GZ '$TARGZ_NAME_SERVER' is missing"; return 1; end
set -l TARGZ_SIZE_SERVER (expr (wc -c < work/$TARGZ_NAME_SERVER | tr -d " ") / 1024 / 1024)
set -l n "work/download-$argv[1]-macosx.html"
sed -e "s|@BUNDLE_NAME_SERVER@|$BUNDLE_NAME_SERVER|" \
-e "s|@BUNDLE_SIZE_SERVER@|$BUNDLE_SIZE_SERVER|" \
-e "s|@TARGZ_NAME_SERVER@|$TARGZ_NAME_SERVER|" \
-e "s|@TARGZ_SIZE_SERVER@|$TARGZ_SIZE_SERVER|" \
-e "s|@DOWNLOAD_LINK@|$DOWNLOAD_LINK|" \
-e "s|@DOWNLOAD_EDITION@|$DOWNLOAD_EDITION|" \
< sniplets/$ARANGODB_SNIPLETS/macosx.html.in > $n
echo "MacOSX Bundle Sniplet: $n"
end
function buildBundleSniplet
# Must have set ARANGODB_VERSION and ARANGODB_PACKAGE_REVISION and
# ARANGODB_SNIPLETS, for example by running findArangoDBVersion.
if test -z "$ARANGODB_DARWIN_REVISION"
set n "$ARANGODB_DARWIN_UPSTREAM"
else
set n "$ARANGODB_DARWIN_UPSTREAM-$ARANGODB_DARWIN_REVISION"
end
if test "$ENTERPRISEEDITION" = "On"
if test -z "$ENTERPRISE_DOWNLOAD_LINK"
echo "you need to set the variable ENTERPRISE_DOWNLOAD_LINK"
return 1
end
transformBundleSniplet "arangodb3e" "$n" "$ARANGODB_TGZ_UPSTREAM" "$ENTERPRISE_DOWNLOAD_LINK"
or return 1
else
if test -z "$COMMUNITY_DOWNLOAD_LINK"
echo "you need to set the variable COMMUNITY_DOWNLOAD_LINK"
return 1
end
transformBundleSniplet "arangodb3" "$n" "$ARANGODB_TGZ_UPSTREAM" "$COMMUNITY_DOWNLOAD_LINK"
or return 1
end
end
function makeSniplets
if test -z "$ENTERPRISE_DOWNLOAD_LINK"
echo "you need to set the variable ENTERPRISE_DOWNLOAD_LINK"
return 1
end
if test -z "$COMMUNITY_DOWNLOAD_LINK"
echo "you need to set the variable COMMUNITY_DOWNLOAD_LINK"
return 1
end
community
and buildBundleSniplet
and enterprise
and buildBundleSniplet
end
parallelism 8