-
Notifications
You must be signed in to change notification settings - Fork 0
/
cassandra_build.sh
executable file
·165 lines (154 loc) · 6.14 KB
/
cassandra_build.sh
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
#!/bin/bash
#############################################################################
# Script to build Cassandra SCL (Software Collection) #
# #
# Description: - Get specs/patches from github #
# - Download sources from Fedora lookaside cache #
# - Create SRPM through rpmbuild #
# - Build through CBS (CentOS Build System) #
# #
# Author: Augusto Caringi (acaringi@redhat.com) - Date: 8/2017 #
#############################################################################
# list of cassandra dependencies
dep_list=(jamm janino slf4j logback snakeyaml bean-validation-api metrics metrics-reporter-config
treelayout stringtemplate antlr3 stringtemplate4 antlr4 hppc stream-lib high-scale-lib
concurrent-trees concurrentlinkedhashmap-lru json_simple compress-lzf guava airline mvel
cpptasks lz4-java cglib assertj-core powermock compile-command-annotations sigar jBCrypt
apache-commons-math jopt-simple jmh snowball-java objectweb-asm byteman HdrHistogram
javapoet caffeine jsr-311 jackson fasterxml-oss-parent replacer jackson-parent
jackson-core jackson-annotations jflex snappy-java jackson-databind
jackson-module-jaxb-annotations jackson-dataformat-xml jackson-dataformat-yaml
apache-commons-csv jeromq jboss-jms-1.1-api hibernate-jpa-2.1-api disruptor log4j ohc
glassfish-jax-rs-api jsonp jctools jzlib netty jffi jnr-x86asm jnr-constants jnr-ffi
jnr-posix cassandra-java-driver python-futures python-blist python-simplejson
python-scales python-sure python-pretend python-packaging libsodium zeromq Cython
python-zmq python-eventlet python-cassandra-driver cassandra)
cassandra=cassandra35
github_repo_org=https://github.com/devexp-db
fedora_sources_repo=https://src.fedoraproject.org/repo/pkgs
##############################################################################
# clone repositories through git #############################################
##############################################################################
function get_from_git()
{
i=1
for f in ${dep_list[@]}
do
echo Clonning $f "("$i of ${#dep_list[@]}")"
git clone $github_repo_org/sclo-$cassandra-$f.git
let i++
done
}
##############################################################################
# download sources from fedora lookaside cache ###############################
##############################################################################
function download_sources()
{
i=1
for f in ${dep_list[@]}
do
echo Getting sources for $f "("$i of ${#dep_list[@]}")"
pushd sclo-$cassandra-$f
s=$(ls *spec | head -n 1)
c=${s%.spec}
cat sources | sed -e 's/^\([a-f0-9]*\)\s*\(.*\)$/\1 \2/' -e 's/SHA512 (\(.*\)) = \(.*\)/\2 \1/' | while read h f ; do
[ -z "$h" -o -z "$f" ] && continue
t=md5
[ ${#h} -gt 32 ] && t=sha512
# If file was already downloaded, skip it...
[ -f $f ] && echo "File $f already exists" || wget $fedora_sources_repo/$c/$f/$t/$h/$f
done
popd
let i++
done
}
##############################################################################
# create SRPM ################################################################
##############################################################################
function create_srpm()
{
i=1
for f in ${dep_list[@]}
do
echo Creating SRPM for $f "("$i of ${#dep_list[@]}")"
pushd sclo-$cassandra-$f
rpmbuild -bs -D "_with_bootstrap 1" -D "_sourcedir ." -D "_srcrpmdir ." -D "dist .el7" -D "scl sclo-cassandra3" *.spec
popd
let i++
done
}
##############################################################################
# add package to cbs tag #####################################################
##############################################################################
function cbs_pkg_add()
{
i=1
for f in ${dep_list[@]}
do
echo Adding package $f to CBS tag "("$i of ${#dep_list[@]}")"
cbs add-pkg sclo7-sclo-cassandra3-sclo-candidate --owner=sclo sclo-cassandra3-$f
let i++
done
}
##############################################################################
# build package in cbs tag ###################################################
##############################################################################
function cbs_build_pkg()
{
i=1
for f in ${dep_list[@]}
do
echo Building package $f in CBS "("$i of ${#dep_list[@]}")"
pushd sclo-$cassandra-$f
cbs build sclo7-sclo-cassandra3-sclo-el7 sclo-cassandra3-$f-*.el7.src.rpm
popd
let i++
done
}
##############################################################################
# print usage ################################################################
##############################################################################
function usage()
{
echo "Script to help in the process of building Cassandra SCL (Software Collection)"
echo ""
echo "Commands:"
echo ""
echo " gitget git clone repositories"
echo " download download sources from fedora lookaside cache"
echo " srpm create source rpms"
echo " pkgadd add packages to cbs tag"
echo " pkgbuild build packages on cbs"
echo " all do all steps in correct order (gitget, download, srpm, pkgadd, pkgbuild)"
echo ""
}
if [ "$#" -ne 1 ]; then
usage
exit
fi
case $1 in
gitget)
get_from_git
;;
download)
download_sources
;;
srpm)
create_srpm
;;
pkgadd)
cbs_pkg_add
;;
pkgbuild)
cbs_build_pkg
;;
all)
get_from_git
download_sources
create_srpm
cbs_pkg_add
cbs_build_pkg
;;
*)
usage
esac