-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_hpcc.sh
executable file
·171 lines (145 loc) · 4.41 KB
/
build_hpcc.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
166
167
168
169
#!/bin/bash
usage() {
cat << EOF
Usage $(basename $0) options
Options:
-b|--branch: HPCC component branch or tag.
It can be multiple branches separated by ','.
For example, LN build -b <Platform branch>,<LN branch>
Docs build -b <Platform branch>,<Configurator branch>
-p|--project: HPCC componet ids seperated by comma.
1: Platform community (rpm only)
2: Platform community with plugin
3: Platform enterprise (rpm only)
4: Platform enterprise with plugin
5: Platform internal (rpm only)
6: Platform internal with plugin
7: Clienttools
8: Graphcontrol (deb only)
9: Ganglia-monitoring
10: Nagios-monitoring
11: Docs (Ubuntu 12.04 or 14.04 only)
-r|--release: HPCC release version. Example, 5.0.0-1
-u|--user: github user. Default is hpcc-systems
It can be multiple users for multiple branches separated by ','.
For example, LN build -u <Platform github user>,<LN github user>
LN build -u <Platform github user>,<Configurator github user>
-h|--help: Help message
EOF
exit 1
}
###################################################################
#
# MAIN
#
###################################################################
binDir=$(dirname $0)
cd $binDir/..
rootDir=$(pwd)
branch=
projects=all
release=
reset=0
github_user=hpcc-systems
project_config_file=(
'Project configuration'
'community.conf'
'community_with_plugins.conf'
'enterprise.conf'
'enterprise_with_plugins.conf'
'internal.conf'
'internal_with_plugins.conf'
'clienttools.conf'
'graphcontrol.conf'
'gangliamonitoring.conf'
'nagiosmonitoring.conf'
'docs.conf'
)
TEMP=$(/usr/bin/getopt -o b:hp:Rr:u: --long branch:,help,project:,release:,reset,user -n 'build_hpcc' -- "$@")
if [ $? != 0 ]; then echo "Failure to parse commandline." >&2 ; end 1 ; fi
eval set -- "$TEMP"
while true ; do
case "$1" in
-b|--branch) branch="$2"
shift 2;;
-h|--help) usage
shift ;;
-p|--project) projects="$2"
shift 2;;
-R|--reset) reset=1
shift ;;
-r|--release) release="$2"
shift 2;;
-u|--user) github_user="$2"
shift 2;;
--) shift ; break ;;
*) usage ;;
esac
done
[ -z "$branch" ] && usage
[ -z "$release" ] && release=${branch%%,*}
#echo $rootDir
. ${rootDir}/bin/common
check_distro
echo "$DISTRO $CODENAME $PKG_TYPE $ARCH"
export PKG_TYPE
export CODENAME
export github_user
if [ ! -e ${rootDir}/bin/config/os/${CODENAME}-${ARCH}.conf ]
then
echo ""
echo "Build HPCC on $DISTRO $CODENAME is not supported"
echo ""
exit 1
fi
[ ! -d $rootDir/workspace ] && mkdir $rootDir/workspace
cd $rootDir/workspace
export workDir=$(pwd)
[ ! -d ${workDir}/$release ] && mkdir -p ${workDir}/$release
export releaseDir=${workDir}/$release
cd $releaseDir
[ ! -d output ] && mkdir output
export outputDir=${workDir}/$release/output
supported_projects=$(grep "projects_all=" ${rootDir}/bin/config/os/${CODENAME}-${ARCH}.conf | cut -d'=' -f2)
[ "$projects" == "all" ] && projects=${supported_projects}
echo $projects | tr [','] ['\n '] | while read project
do
cd $releaseDir
echo ",${supported_projects}," | grep -e ",${project}," > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "Build ${display_name} on ${CODENAME} is not supported."
continue
fi
. ${rootDir}/bin/config/${project_config_file[$project]}
echo
if [ ! -e ${rootDir}/bin/build/${CODENAME}/${build_script}_cmake_options ]
then
echo "Build ${display_name} on ${CODENAME} is not supported."
continue
fi
echo "Build ${display_name} ..."
[ ! -d $project_directory ] && mkdir $project_directory
cd $project_directory
echo -n "Get git repository $branch ... "
${rootDir}/bin/github/${github_script} $branch > git.log 2>&1
if [ $? -ne 0 ]
then
echo "FAILED"
continue
fi
echo "OK"
[ -d build ] && rm -rf build
mkdir build
cd build
echo -n "build ... "
export package_directory
export package_name_prefix
${rootDir}/bin/build/${build_script} > build.log 2>&1
if [ $? -ne 0 ]
then
echo "FAILED"
continue
fi
echo "OK"
done