-
Notifications
You must be signed in to change notification settings - Fork 7
/
helper.fish
executable file
·2456 lines (2032 loc) · 89.6 KB
/
helper.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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
set -gx KEYNAME 86FEC04D
set -gx KEYNAME_OLD 115E1684
function lockDirectory
# Now grab the lock ourselves:
set -l pid (echo %self)
if test ! -f LOCK.$pid
echo $pid > LOCK.$pid
and while true
# Remove a stale lock if it is found:
if set -l pidfound (cat LOCK > /dev/null)
if not ps ax -o pid | grep '^ *'"$pidfound"'$' > /dev/null
rm LOCK LOCK.$pidfound
and echo Have removed stale lock.
end
end
and if ln LOCK.$pid LOCK > /dev/null
break
end
and echo -n Directory is locked, waiting...
and date
and sleep 15
end
end
end
function unlockDirectory
set -l pid (echo %self)
if test -f LOCK.$pid
rm -rf LOCK LOCK.$pid
end
end
if test -f config/environment.fish
source config/environment.fish
end
function convertSItoJSON
if test -f $WORKDIR/work/sourceInfo.log
set -l fields ""
and begin
cat $WORKDIR/work/sourceInfo.log | while read -l line
set -l var (echo $line | cut -f1 -d ':')
switch "$var"
case "oskar" "VERSION" "Community" "Starter" "Enterprise" "Syncer" "Rclone"
set -l val (echo $line | cut -f2 -d ' ')
if test -n $val
set fields "$fields \"$var\":\""(echo $line | cut -f2 -d ' ')\"\n""
end
end
end
if test -n "$fields"
echo "convert $WORKDIR/work/sourceInfo.log to $WORKDIR/work/sourceInfo.json"
printf "{\n"(printf $fields | string join ",\n")"\n}" > $WORKDIR/work/sourceInfo.json
end
end
end
end
function initSourceInfo
set -l oskarCommit (git rev-parse HEAD)
pushd $WORKDIR
if test -f work/sourceInfo.log
rm -rf work/sourceInfo.log
end
not test -z "$oskarCommit"
and echo "oskar: $oskarCommit" > work/sourceInfo.log
or echo "oskar: N/A" > work/sourceInfo.log
echo "VERSION: N/A" >> work/sourceInfo.log
echo "Community: N/A" >> work/sourceInfo.log
echo "Starter: N/A" >> work/sourceInfo.log
echo "Enterprise: N/A" >> work/sourceInfo.log
echo "Syncer: N/A" >> work/sourceInfo.log
echo "Rclone: N/A" >> work/sourceInfo.log
popd
convertSItoJSON
end
function setupSourceInfo
set -l field $argv[1]
set -l value $argv[2]
set -l suffix ""
test $PLATFORM = "darwin"; and set suffix ".bak"
sed -i$suffix -E 's/^'"$field"':.*$/'"$field"': '"$value"'/g' $WORKDIR/work/sourceInfo.log
convertSItoJSON
end
## #############################################################################
## config
## #############################################################################
function arangodbGitHost ; set -gx ARANGODB_GIT_HOST $argv[1] ; end
function arangodbGitOrga ; set -gx ARANGODB_GIT_ORGA $argv[1] ; end
function helperGitOrga ; set -gx HELPER_GIT_ORGA $argv[1] ; end
function enterpriseGitHost ; set -gx ENTERPRISE_GIT_HOST $argv[1] ; end
function enterpriseGitOrga ; set -gx ENTERPRISE_GIT_ORGA $argv[1] ; end
if test -z "$ARANGODB_GIT_HOST"; arangodbGitHost "github.com"
else ; set -gx ARANGODB_GIT_HOST $ARANGODB_GIT_HOST ; end
if test -z "$ARANGODB_GIT_ORGA"; arangodbGitOrga "arangodb"
else ; set -gx ARANGODB_GIT_ORGA $ARANGODB_GIT_ORGA ; end
if test -z "$HELPER_GIT_ORGA"; helperGitOrga "arangodb-helper"
else ; set -gx HELPER_GIT_ORGA $HELPER_GIT_ORGA ; end
if test -z "$ENTERPRISE_GIT_HOST"; enterpriseGitHost "github.com"
else ; set -gx ENTERPRISE_GIT_HOST $ENTERPRISE_GIT_HOST; end
if test -z "$ENTERPRISE_GIT_ORGA"; enterpriseGitOrga "arangodb"
else ; set -gx ENTERPRISE_GIT_ORGA $ENTERPRISE_GIT_ORGA; end
function single ; set -gx TESTSUITE single ; end
function cluster ; set -gx TESTSUITE cluster ; end
function single_cluster ; set -gx TESTSUITE single_cluster ; end
function resilience ; set -gx TESTSUITE resilience ; end
function catchtest ; set -gx TESTSUITE gtest ; end
function gtest ; set -gx TESTSUITE gtest ; end
if test -z "$TESTSUITE" ; cluster
else ; set -gx TESTSUITE $TESTSUITE ; end
function maintainerOn ; set -gx MAINTAINER On ; end
function maintainerOff ; set -gx MAINTAINER Off ; end
if test -z "$MAINTAINER" ; maintainerOn
else ; set -gx MAINTAINER $MAINTAINER ; end
function sanOn ; set -gx SAN On ; end
function sanOff ; set -gx SAN Off ; end
if test -z "$SAN" ; sanOff
else ; set -gx SAN $SAN ; end
function sanModeAULSan ; set -gx SAN_MODE AULSan ; end
function sanModeTSan ; set -gx SAN_MODE TSan ; end
if test -z "$SAN_MODE" ; sanModeAULSan
else ; set -gx SAN_MODE $SAN_MODE ; end
function jemallocOn; set -gx JEMALLOC_OSKAR On ; end
function jemallocOff; set -gx JEMALLOC_OSKAR Off ; end
if test -z "$JEMALLOC_OSKAR" ; jemallocOn
else ; set -gx JEMALLOC_OSKAR $JEMALLOC_OSKAR ; end
function debugMode ; set -gx BUILDMODE Debug ; end
function releaseMode ; set -gx BUILDMODE RelWithDebInfo ; end
if test -z "$BUILDMODE" ; releaseMode
else ; set -gx BUILDMODE $BUILDMODE ; end
function makeOff ; set -gx SKIP_MAKE On ; end
function makeOn ; set -gx SKIP_MAKE Off ; end
makeOn
function packBuildFilesOff ; set -gx PACK_BUILD_FILES Off ; end
function packBuildFilesOn ; set -gx PACK_BUILD_FILES On ; end
if test -z "$PACK_BUILD_FILES" ; packBuildFilesOn
else ; set -xg PACK_BUILD_FILES $PACK_BUILD_FILES ; end
function unpackBuildFilesOff ; set -gx UNPACK_BUILD_FILES Off ; end
function unpackBuildFilesOn ; set -gx UNPACK_BUILD_FILES On ; end
if test -z "$UNPACK_BUILD_FILES" ; unpackBuildFilesOff
else ; set -xg UNPACK_BUILD_FILES $UNPACK_BUILD_FILES ; end
function setBuildFilesArchive ; set -xg BUILD_FILES_ARCHIVE $argv[1] ; end
function unsetBuildFilesArchive ; set -xg BUILD_FILES_ARCHIVE "" ; end
if test -z "$BUILD_FILES_ARCHIVE"; unsetBuildFilesArchive
else ; setBuildFilesArchive "$BUILD_FILES_ARCHIVE" ; end
set -xg GCR_REG_PREFIX "gcr.io/gcr-for-testing/"
function gcrRegOff ; set -gx GCR_REG "Off" ; end
function gcrRegOn ; set -gx GCR_REG "On" ; end
gcrRegOn
function packageStripNone ; set -gx PACKAGE_STRIP None ; end
function packageStripExceptArangod ; set -gx PACKAGE_STRIP ExceptArangod ; end
function packageStripAll ; set -gx PACKAGE_STRIP All ; end
packageStripAll
function findMinimalDebugInfo
set -l f "$WORKDIR/work/ArangoDB/VERSIONS"
set -l MINIMAL_DEBUG_INFO "Off"
test -f $f
and begin
set -l v (fgrep MINIMAL_DEBUG_INFO $f | awk '{print $2}' | tr -d '"' | tr -d "'")
if test "$v" = "On"
set MINIMAL_DEBUG_INFO On
end
end
echo $MINIMAL_DEBUG_INFO
end
function minimalDebugInfoOn ; set -gx MINIMAL_DEBUG_INFO On ; end
function minimalDebugInfoOff ; set -gx MINIMAL_DEBUG_INFO Off ; end
if test -z "$MINIMAL_DEBUG_INFO"
set -gx MINIMAL_DEBUG_INFO (findMinimalDebugInfo)
end
function defaultArchitecture
if test (count $argv) -lt 1
set -gx DEFAULT_ARCHITECTURE "westmere"
else
set -gx DEFAULT_ARCHITECTURE $argv[1]
end
return 0
end
function findDefaultArchitecture
set -l f "$WORKDIR/work/ArangoDB/VERSIONS"
set -l v ""
test -f $f
and begin
set v (fgrep DEFAULT_ARCHITECTURE $f | awk '{print $2}' | tr -d '"' | tr -d "'")
end
defaultArchitecture $v
end
test -z "$DEFAULT_ARCHITECTURE"; and findDefaultArchitecture
function findUseARM
set -l f "$WORKDIR/work/ArangoDB/VERSIONS"
test -f $f
or begin
#echo "Cannot find $f; make sure source is checked out"
set -gx USE_ARM "Off"
return 0
end
set -l v (fgrep USE_ARM $f | awk '{print $2}' | tr -d '"' | tr -d "'")
if test "$v" != "On"
#echo "$f: no USE_ARM specified, using false"
set -gx USE_ARM "Off"
else
#echo "Using ARM '$v' from '$f'"
set -gx USE_ARM "$v"
end
return 0
end
if test -z "$USE_ARM" ; findUseARM ; end
function isGCE
switch (hostname)
case 'gce-*'
set -gx IS_GCE "true"
case '*'
set -gx IS_GCE "false"
end
end
if test -z "$IS_GCE" ; isGCE
else ; set -gx IS_GCE "false" ; end
function defineSccacheGCE
if test -z "$SCCACHE_GCS_BUCKET"
set -gx SCCACHE_GCS_BUCKET "arangodbbuildcache"
end
# No S3 for GCE atm
set -gx SCCACHE_BUCKET ""
# No redis servers for GCE atm
set -gx SCCACHE_REDIS ""
# No memcached servers for GCE atm
set -gx SCCACHE_MEMCACHED ""
end
function ccacheOn
set -gx USE_CCACHE On
end
function sccacheOn
set -gx USE_CCACHE sccache
if test $IS_GCE = "true"
defineSccacheGCE
end
end
function ccacheOff ; set -gx USE_CCACHE Off ; end
if test -z "$USE_CCACHE"
if test $IS_GCE = "false"
ccacheOn
else
sccacheOn
end
else if test $USE_CCACHE = "sccache" -a $IS_GCE = "true"
defineSccacheGCE
else
set -gx USE_CCACHE $USE_CCACHE
end
function coverageOn ; set -gx COVERAGE On ; debugMode ; end
function coverageOff ; set -gx COVERAGE Off ; end
if test -z "$COVERAGE" ; coverageOff
else ; set -gx COVERAGE $COVERAGE ; end
function community ; set -gx ENTERPRISEEDITION Off ; end
function enterprise ; set -gx ENTERPRISEEDITION On ; end
if test -z "$ENTERPRISEEDITION" ; enterprise
else ; set -gx ENTERPRISEEDITION $ENTERPRISEEDITION ; end
function mmfiles ; set -gx STORAGEENGINE mmfiles ; end
function rocksdb ; set -gx STORAGEENGINE rocksdb ; end
if test -z "$STORAGEENGINE" ; rocksdb
else ; set -gx STORAGEENGINE $STORAGEENGINE ; end
function parallelism ; set -gx PARALLELISM $argv[1] ; end
function verbose ; set -gx VERBOSEOSKAR On ; end
function silent ; set -gx VERBOSEOSKAR Off ; end
if test -z "$VERBOSEOSKAR" ; verbose
else ; set -gx VERBOSEOSKAR $VERBOSEOSKAR ; end
function verboseBuild ; set -gx VERBOSEBUILD On ; end
function silentBuild ; set -gx VERBOSEBUILD Off ; end
if test -z "$VERBOSEBUILD"; silentBuild
else ; set -gx VERBOSEBUILD $VERBOSEBUILD ; end
function buildSeppOn ; set -gx BUILD_SEPP On ; end
function buildSeppOff ; set -gx BUILD_SEPP Off ; end
if test -z "$BUILD_SEPP" ; buildSeppOff
else ; set -gx BUILD_SEPP $BUILD_SEPP ; end
function showDetails ; set -gx SHOW_DETAILS On ; end
function hideDetails ; set -gx SHOW_DETAILS Off ; end
function pingDetails ; set -gx SHOW_DETAILS Ping ; end
if test -z "$PROMTOOL_PATH" ; set -gx PROMTOOL_PATH "/usr/bin/"
else ; set -gx PROMTOOL_PATH $PROMTOOL_PATH ; end
if test -z "$SHOW_DETAILS"
if isatty 1
showDetails
else
hideDetails
end
else
set -gx SHOW_DETAILS $SHOW_DETAILS
end
function ubiDockerImage ; set -gx DOCKER_DISTRO ubi ; end
function alpineDockerImage ; set -gx DOCKER_DISTRO alpine ; end
function debDockerImage; set -gx DOCKER_DISTRO deb ; end
if test -z "$DOCKER_DISTRO"; alpineDockerImage
else ; set -gx DOCKER_DISTRO $DOCKER_DISTRO ; end
function skipNondeterministic ; set -gx SKIPNONDETERMINISTIC true ; end
function includeNondeterministic ; set -gx SKIPNONDETERMINISTIC false ; end
if test -z "$SKIPNONDETERMINISTIC"; skipNondeterministic
else ; set -gx SKIPNONDETERMINISTIC $SKIPNONDETERMINISTIC ; end
function skipTimeCritical ; set -gx SKIPTIMECRITICAL true ; end
function includeTimeCritical ; set -gx SKIPTIMECRITICAL false ; end
if test -z "$SKIPTIMECRITICAL"; skipTimeCritical
else ; set -gx SKIPTIMECRITICAL $SKIPTIMECRITICAL ; end
function skipGrey ; set -gx SKIPGREY true ; end
function includeGrey ; set -gx SKIPGREY false ; end
if test -z "$SKIPGREY"; includeGrey
else ; set -gx SKIPGREY $SKIPGREY ; end
function onlyGreyOn ; set -gx ONLYGREY true ; end
function onlyGreyOff ; set -gx ONLYGREY false ; end
if test -z "$ONLYGREY"; onlyGreyOff
else ; set -gx ONLYGREY $ONLYGREY ; end
function stable ; set -gx RELEASE_TYPE stable ; end
function preview ; set -gx RELEASE_TYPE preview ; end
if test -z "$RELEASE_TYPE"; preview
else ; set -gx RELEASE_TYPE $RELEASE_TYPE ; end
function keepBuild ; set -gx NO_RM_BUILD 1 ; end
function clearBuild ; set -gx NO_RM_BUILD ; end
function githubMirror ; set -gx GITHUB_MIRROR $argv[1] ; end
function noGithubMirror ; set -e GITHUB_MIRROR ; end
function setAllLogsToWorkspace ; set -gx WORKSPACE_LOGS "all" ; end
function setOnlyFailLogsToWorkspace ; set -gx WORKSPACE_LOGS "fail"; end
if test -z "$WORKSPACE_LOGS"; setOnlyFailLogsToWorkspace
else ; set -gx WORKSPACE_LOGS $WORKSPACE_LOGS ; end
function addLogLevel ; set -gx LOG_LEVELS $LOG_LEVELS $argv ; end
function clearLogLevel ; set -ge LOG_LEVEL ; end
function notarizeApp ; set -gx NOTARIZE_APP On ; end
function noNotarizeAppp ; set -gx NOTARIZE_APP Off ; end
if test -z "$NOTARIZE_APP"; noNotarizeAppp
else ; set -gx NOTARIZE_APP $NOTARIZE_APP ; end
function strictOpenSSL; set -gx USE_STRICT_OPENSSL On ; end
function nonStrictOpenSSL ; set -gx USE_STRICT_OPENSSL Off ; end
if test -z "$USE_STRICT_OPENSSL"; and test "$IS_JENKINS" = "true"
strictOpenSSL
else; set -gx USE_STRICT_OPENSSL $USE_STRICT_OPENSSL; end
# main code between function definitions
# WORDIR IS pwd - at least check if ./scripts and something
# else is available before proceeding
set -gx WORKDIR (pwd)
if test ! -d scripts ; echo "cannot find scripts directory" ; exit 1 ; end
if test ! -d work ; mkdir work ; end
if test -z "$ARANGODB_DOCS_BRANCH" ; set -gx ARANGODB_DOCS_BRANCH "main"
else ; set -gx ARANGODB_DOCS_BRANCH $ARANGODB_DOCS_BRANCH ; end
function findRcloneVersion
set -l f "$WORKDIR/work/ArangoDB/VERSIONS"
set -xg RCLONE_VERSION "1.59.0"
test -f $f
and begin
set -l v (fgrep RCLONE_VERSION $f | awk '{print $2}' | tr -d '"' | tr -d "'")
if test "$v" != ""
set -xg RCLONE_VERSION "$v"
end
setupSourceInfo "Rclone" "$RCLONE_VERSION"
end
end
function findUseRclone
set -l f "$WORKDIR/work/ArangoDB/VERSIONS"
test -f $f
or begin
#echo "Cannot find $f; make sure source is checked out"
set -gx USE_RCLONE "false"
return 1
end
set -l v (fgrep USE_RCLONE $f | awk '{print $2}' | tr -d '"' | tr -d "'")
if test "$v" = ""
#echo "$f: no USE_RCLONE specified, using false"
set -gx USE_RCLONE "false"
else
#echo "Using rclone '$v' from '$f'"
set -gx USE_RCLONE "$v"
end
end
if test -z "$USE_RCLONE" ; findUseRclone ; end
function copyRclone
findUseRclone
if test "$USE_RCLONE" = "false"
echo "Not copying rclone since it's not used!"
return
end
set -l os "$argv[1]"
if test -z "$os"
echo "need operating system as first argument"
return 1
end
set -l arch ""
switch "$ARCH"
case "x86_64"
set arch "amd64"
case '*'
if string match --quiet --regex '^arm64$|^aarch64$' $ARCH >/dev/null
set arch "arm64"
else
echo "fatal, unknown architecture $ARCH for rclone"
exit 1
end
end
findRcloneVersion
echo Copying rclone from rclone/v$RCLONE_VERSION/rclone-arangodb-$os-$arch to $WORKDIR/work/$THIRDPARTY_SBIN/rclone-arangodb ...
mkdir -p $WORKDIR/work/$THIRDPARTY_SBIN
cp -L $WORKDIR/rclone/v$RCLONE_VERSION/rclone-arangodb-$os-$arch $WORKDIR/work/$THIRDPARTY_SBIN/rclone-arangodb
end
function defaultBuildRepoInfo
set -gx BUILD_REPO_INFO "default"
end
function releaseBuildRepoInfo
set -gx BUILD_REPO_INFO "release"
end
function nightlyBuildRepoInfo
set -gx BUILD_REPO_INFO "nightly"
end
if test -z "$BUILD_REPO_INFO"
defaultBuildRepoInfo
else
set -gx BUILD_REPO_INFO "$BUILD_REPO_INFO"
end
## #############################################################################
## test
## #############################################################################
function createLogLevelsOverride
for i in arangod-agency arangod-agent arangod-common arangod-coordinator arangod-dbserver arangod-single arangod
begin
echo "[log]"
for log in $LOG_LEVELS
echo "level = $log"
end
end > $WORKDIR/work/ArangoDB/etc/testing/$i.conf.local
end
end
function oskarCompile
showConfig
showRepository
set -x NOSTRIP 1
if test "$SAN" = "On"
buildArangoDB -DUSE_FAILURE_TESTS=On ; or return $status
else
buildStaticArangoDB -DUSE_FAILURE_TESTS=On ; or return $status
end
end
function rlogCompile
showConfig
showRepository
set -x NOSTRIP 1
buildStaticArangoDB \
-DUSE_FAILURE_TESTS=On \
-DUSE_SEPARATE_REPLICATION2_TESTS_BINARY=On \
; or return $status
end
function oskar1
oskarCompile
and oskar
end
function oskar1Full
oskarCompile
and oskarFull
end
function oskar2
set -l testsuite $TESTSUITE
oskarCompile
and begin
cluster ; oskar ; or return $status
single ; oskar ; or return $status
end
set -xg TESTSUITE $testsuite
end
function oskar4
set -l testsuite $TESTSUITE ; set -l storageengine $STORAGEENGINE
oskarCompile
and begin
rocksdb
cluster ; oskar ; or return $status
single ; oskar ; or return $status
mmfiles
cluster ; oskar ; or return $status
single ; oskar ; or return $status
cluster ; rocksdb
end
set -xg TESTSUITE $testsuite ; set -xg STORAGEENGINE $storageengine
end
function oskar8
set -l testsuite $TESTSUITE ; set -l storageengine $STORAGEENGINE ; set -l enterpriseedition $ENTERPRISEEDITION
enterprise
and oskarCompile
and begin
rocksdb
cluster ; oskar ; or return $status
single ; oskar ; or return $status
mmfiles
cluster ; oskar ; or return $status
single ; oskar ; or return $status
end
and community
and oskarCompile
and begin
rocksdb
cluster ; oskar ; or return $status
single ; oskar ; or return $status
mmfiles
cluster ; oskar ; or return $status
single ; oskar ; or return $status
end
set -xg TESTSUITE $testsuite ; set -xg STORAGEENGINE $storageengine ; set -l ENTERPRISEEDITION $enterpriseedition
end
## #############################################################################
## set release version variables in CMakeLists.txt
## #############################################################################
function setNightlyVersion
checkoutIfNeeded
set -l suffix ""
test $PLATFORM = "darwin"; and set suffix ".bak"
sed -i$suffix -E "s/set\(ARANGODB_VERSION_RELEASE_TYPE .*/set(ARANGODB_VERSION_RELEASE_TYPE \"nightly\")/" $WORKDIR/work/ArangoDB/CMakeLists.txt
sed -i$suffix -E "s/set\(ARANGODB_VERSION_RELEASE_NUMBER .*/set(ARANGODB_VERSION_RELEASE_NUMBER \""(date +%Y%m%d)"\")/" $WORKDIR/work/ArangoDB/CMakeLists.txt
findArangoDBVersion
and set -l ARANGODB_FULL_VERSION "$ARANGODB_VERSION_MAJOR.$ARANGODB_VERSION_MINOR.$ARANGODB_VERSION_PATCH"
and if test -n "$ARANGODB_VERSION_RELEASE_TYPE"; set ARANGODB_FULL_VERSION "$ARANGODB_FULL_VERSION-$ARANGODB_VERSION_RELEASE_TYPE"; end
and if test -n "$ARANGODB_VERSION_RELEASE_NUMBER"; set ARANGODB_FULL_VERSION "$ARANGODB_FULL_VERSION.$ARANGODB_VERSION_RELEASE_NUMBER"; end
and echo "$ARANGODB_FULL_VERSION" > $WORKDIR/work/ArangoDB/ARANGO-VERSION
and test (find $WORKDIR/work -name 'sourceInfo.*' | wc -l) -gt 0
and setupSourceInfo "VERSION" "$ARANGODB_FULL_VERSION"
and nightlyBuildRepoInfo
end
## #############################################################################
## release
## #############################################################################
function makeRelease
makeEnterpriseRelease "$argv[1]"
and makeCommunityRelease "$argv[1]"
end
function makeCommunityRelease
set -l packages "ALL"
if test (count $argv) -lt 3
findArangoDBVersion ; or return 1
test -n "$argv[1]" ; and set packages "$argv[1]"
else
set -xg ARANGODB_VERSION "$argv[1]"
set -xg ARANGODB_PACKAGE_REVISION "$argv[2]"
set -xg ARANGODB_FULL_VERSION "$argv[1]-$argv[2]"
test -n "$argv[3]" ; and set packages "$argv[3]"
end
test (findMinimalDebugInfo) = "On"
and begin
packageStripExceptArangod
minimalDebugInfoOn
end
or begin
packageStripAll
minimalDebugInfoOff
end
echo ""
buildCommunityPackage $packages
end
function makeEnterpriseRelease
if test "$DOWNLOAD_SYNC_USER" = ""
echo "Need to set environment variable DOWNLOAD_SYNC_USER."
return 1
end
set -l packages "ALL"
if test (count $argv) -lt 3
findArangoDBVersion ; or return 1
test -n "$argv[1]" ; and set packages "$argv[1]"
else
set -xg ARANGODB_VERSION "$argv[1]"
set -xg ARANGODB_PACKAGE_REVISION "$argv[2]"
set -xg ARANGODB_FULL_VERSION "$argv[1]-$argv[2]"
test -n "$argv[3]" ; and set packages "$argv[3]"
end
test (findMinimalDebugInfo) = "On"
and begin
packageStripExceptArangod
minimalDebugInfoOn
end
or begin
packageStripAll
minimalDebugInfoOff
end
echo ""
buildEnterprisePackage $packages
end
function makeJsSha1Sum
if test (count $argv) -lt 1
set jsdir $WORKDIR/work/ArangoDB/build/install/usr/share/arangodb3/js
else
set jsdir $argv[1]
end
if test -d $jsdir
pushd $jsdir
and rm -f JS_FILES.txt JS_SHA1SUM.txt
and begin
find . -type f | sort | xargs sha1sum > JS_FILES.txt
end
and sha1sum JS_FILES.txt > JS_SHA1SUM.txt
and rm -f JS_FILES.txt
end
or begin popd ; return 1 ; end
popd
end
## #############################################################################
## source release
## #############################################################################
function makeSourceRelease
set -l SOURCE_TAG "unknown"
if test (count $argv) -lt 1
findArangoDBVersion ; or return 1
set SOURCE_TAG $ARANGODB_VERSION
else
set SOURCE_TAG $argv[1]
end
buildSourcePackage $SOURCE_TAG
and signSourcePackage $SOURCE_TAG
end
function buildSourcePackage
if test (count $argv) -lt 1
echo "Need source tag as parameter"
exit 1
end
set -l SOURCE_TAG $argv[1]
pushd $WORKDIR/work
and rm -rf ArangoDB-$SOURCE_TAG
and cp -a ArangoDB ArangoDB-$SOURCE_TAG
and pushd ArangoDB-$SOURCE_TAG
and find . -maxdepth 1 -name "arangodb-tmp.sock*" -delete
and rm -rf enterprise mini-chaos
and git clean -f -d -x
and rm -rf .git
and popd
and echo "creating tar.gz"
and rm -f ArangoDB-$SOURCE_TAG.tar.gz
and tar -c -z -f ArangoDB-$SOURCE_TAG.tar.gz ArangoDB-$SOURCE_TAG
and echo "creating tar.bz2"
and rm -f ArangoDB-$SOURCE_TAG.tar.bz2
and tar -c -j -f ArangoDB-$SOURCE_TAG.tar.bz2 ArangoDB-$SOURCE_TAG
and echo "creating zip"
and rm -f ArangoDB-$SOURCE_TAG.zip
and zip -q -r ArangoDB-$SOURCE_TAG.zip ArangoDB-$SOURCE_TAG
and popd
or begin ; popd ; return 1 ; end
end
## #############################################################################
## PREPARE binaries
## #############################################################################
function prepareInstall
set -l path "$argv[1]"
if test -z "$path" -o ! -d "$path"
echo "need valid path as first argument"
return 1
end
pushd $path
and if test $PACKAGE_STRIP = All
strip usr/bin/{arangobench,arangodump,arangoexport,arangoimport,arangorestore,arangosh,arangovpack}
if test "$ARANGODB_VERSION_MAJOR" -eq 3; and test "$ARANGODB_VERSION_MINOR" -le 10; and test $PLATFORM = "darwin"; or test $PLATFORM = "linux"
strip usr/sbin/arangod
end
else if test $PACKAGE_STRIP = ExceptArangod
strip usr/bin/{arangobench,arangodump,arangoexport,arangoimport,arangorestore,arangosh,arangovpack}
end
and if test "$ENTERPRISEEDITION" != "On"
rm -f "bin/arangosync" "usr/bin/arangosync" "usr/sbin/arangosync"
rm -f "bin/arangobackup" "usr/bin/arangobackup" "usr/sbin/arangobackup"
else
if test -f usr/bin/arangobackup -a $PACKAGE_STRIP != None
strip usr/bin/arangobackup
if test "$ARANGODB_VERSION_MAJOR" -eq 3; and test "$ARANGODB_VERSION_MINOR" -ge 11; and test $PLATFORM = "darwin"
rm -f "bin/arangosync" "usr/bin/arangosync" "usr/sbin/arangosync"
end
end
end
set s $status
popd
and return $s
or begin ; popd ; return 1 ; end
end
## #############################################################################
## TAR release
## #############################################################################
function buildTarGzPackageHelper
set -l os "$argv[1]"
if test -z "$os"
echo "need operating system as first argument"
return 1
end
# This assumes that a static build has already happened
# Must have set ARANGODB_TGZ_UPSTREAM
# for example by running findArangoDBVersion.
set -l v "$ARANGODB_TGZ_UPSTREAM"
set -l name
if test "$ENTERPRISEEDITION" = "On"
set name arangodb3e
else
set name arangodb3
end
set -l arch ""
if test "$USE_ARM" = "On"
switch "$ARCH"
case "x86_64"
set arch "_$ARCH"
case '*'
if string match --quiet --regex '^arm64$|^aarch64$' $ARCH >/dev/null
set arch "_arm64"
else
echo "fatal, unknown architecture $ARCH for TGZ"
exit 1
end
end
end
set -l suffix ""
test $PLATFORM = "darwin"; and set suffix ".bak"
pushd $WORKDIR/work
and rm -rf targz
and mkdir targz
and cd $WORKDIR/work/ArangoDB/build/install
and cp -a * $WORKDIR/work/targz
and cd $WORKDIR/work/targz
and rm -rf bin
and cp -a $WORKDIR/binForTarGz bin
and if test "$ARANGODB_VERSION_MAJOR" -eq 3; and test "$ARANGODB_VERSION_MINOR" -ge 12
rm -f bin/arangosync
end
and find bin "(" -name "*.bak" -o -name "*~" ")" -delete
and cp bin/README.$os.server ./README
and sed -i$suffix -E "s/@ARANGODB_PACKAGE_NAME@/$name-$os-$v$arch/g" README
and if test "$ARANGODB_VERSION_MAJOR" -eq 3; and test "$ARANGODB_VERSION_MINOR" -ge 12
if test "$PLATFORM" = "linux"
sed -i$suffix -E '/^Active Failover/,/^\Cluster/{{/^\Cluster$/!d}}' README
else if test "$PLATFORM" = "darwin"
sed -i$suffix -E '/^Active Failover/,/^\Cluster/{{/^\Cluster$/!d;};}' README
end
end
and rm -rf ./README.bak
and prepareInstall $WORKDIR/work/targz
and rm -rf "$WORKDIR/work/$name-$v$arch"
and cp -a $WORKDIR/work/targz "$WORKDIR/work/$name-$v$arch"
and cd $WORKDIR/work
or begin ; popd ; return 1 ; end
if test "$ARANGODB_VERSION_MAJOR" -eq 3; and test "$ARANGODB_VERSION_MINOR" -le 10; and test "$PLATFORM" = "darwin"; or test "$PLATFORM" = "linux"
rm -rf "$name-$os-$v$arch"
and cp -a "$name-$v$arch" "$name-$os-$v$arch"
and tar czvf "$WORKDIR/work/$name-$os-$v$arch.tar.gz" --exclude "usr/local" --exclude "etc" --exclude "bin/README*" --exclude "var" "$name-$os-$v$arch"
and rm -rf "$name-$os-$v$arch"
else
rm -rf "$name-$os-$v$arch" "$WORKDIR/work/$name-$os-$v$arch.tar.gz"
end
set s $status
if test "$s" -eq 0
rm -rf "$name-client-$os-$v$arch"
and cp -a "$name-$v$arch" "$name-client-$os-$v$arch"
and cp "$name-client-$os-$v$arch/bin/README.$os.client" "$name-client-$os-$v$arch/README"
and sed -i$suffix -E "s/@ARANGODB_PACKAGE_NAME@/$name-client-$os-$v$arch/g" "$name-client-$os-$v$arch/README"
and rm -rf "$name-client-$os-$v$arch/README.bak"
and tar czvf "$WORKDIR/work/$name-client-$os-$v$arch.tar.gz" \
--exclude "usr/local" \
--exclude "bin/README*" \
--exclude "etc" \
--exclude "var" \
--exclude "*.initd" \
--exclude "*.services" \
--exclude "*.logrotate" \
--exclude "arangodb.8" \
--exclude "arangod.8" \
--exclude "arango-dfdb.8" \
--exclude "rcarangod.8" \
--exclude "$name-client-$os-$v$arch/sbin" \
--exclude "$name-client-$os-$v$arch/bin/arangod" \
--exclude "$name-client-$os-$v$arch/bin/arangodb" \
--exclude "$name-client-$os-$v$arch/bin/arangosync" \
--exclude "$name-client-$os-$v$arch/usr/sbin" \
--exclude "$name-client-$os-$v$arch/usr/bin/arangodb" \
--exclude "$name-client-$os-$v$arch/usr/bin/arangosync" \
--exclude "$name-client-$os-$v$arch/usr/share/arangodb3/arangodb-update-db" \
--exclude "$name-client-$os-$v$arch/usr/share/arangodb3/js/server" \
"$name-client-$os-$v$arch"
and rm -rf "$name-client-$os-$v$arch"
set s $status
end
popd
and return $s
or begin ; popd ; return 1 ; end
end
## #############################################################################
## release snippets
## #############################################################################
function makeSnippets
if test (count $argv) -lt 2
echo "usage: makeSnippets <stage2> <stage1>"
return 1
end
findArangoDBVersion
set IN $argv[1]
set OUT $argv[2]
set archSnippets "X86"
if test "$USE_ARM" = "On"
set archSnippets "X86" "ARM"
end
community
and buildSourceSnippet $IN $OUT
if test "$ARANGODB_VERSION_MAJOR" -eq 3
if test "$ARANGODB_VERSION_MINOR" -ge 12; or begin; test "$ARANGODB_VERSION_MINOR" -eq 11; and test "$ARANGODB_VERSION_PATCH" -ge 10; end
enterprise
and for arch in $archSnippets
switch "$arch"
case "X86"
buildObjectfilesSnippet $IN $OUT "x86_64"
case "ARM"
buildObjectfilesSnippet $IN $OUT "aarch64"
end
end
end
end
for edition in "community" "enterprise"
eval "$edition"
and buildDockerSnippet $OUT
and for arch in $archSnippets
switch "$arch"
case "X86"
buildDebianSnippet $IN $OUT "amd64" "x86_64"
and buildRPMSnippet $IN $OUT "x86_64" "x86_64"
and buildTarGzSnippet $IN $OUT "x86_64"
and if test "$ARANGODB_VERSION_MAJOR" -eq 3; and test "$ARANGODB_VERSION_MINOR" -lt 12
buildBundleSnippet $IN $OUT "x86_64"
buildWindowsSnippet $IN $OUT "win64"
end
case "ARM"
buildDebianSnippet $IN $OUT "arm64" "arm64"
and buildRPMSnippet $IN $OUT "aarch64" "arm64"
and buildTarGzSnippet $IN $OUT "arm64"
and if test "$ARANGODB_VERSION_MAJOR" -eq 3; and test "$ARANGODB_VERSION_MINOR" -lt 12