summaryrefslogtreecommitdiffstats
path: root/ci/ceph_build.sh
diff options
context:
space:
mode:
authorQiaowei Ren <qiaowei.ren@intel.com>2018-01-18 12:39:37 +0800
committerQiaowei Ren <qiaowei.ren@intel.com>2018-01-19 09:52:21 +0800
commitc032cadb1e645bf60cfd9276ed2660cc602a0e25 (patch)
treeaee97c7129fbd1d19d9df1d8953ef131cf4ebee4 /ci/ceph_build.sh
parent64df7bc3bc70d49153409436b411fb327691a4d5 (diff)
build package
This patch is to build debian/centos package. Currently it only can build ceph package and only support debian package building from ceph official repo. Change-Id: I702a1d28dd0101156bc3267d93510133db122613 Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Diffstat (limited to 'ci/ceph_build.sh')
-rwxr-xr-xci/ceph_build.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/ci/ceph_build.sh b/ci/ceph_build.sh
new file mode 100755
index 0000000..1e16b2c
--- /dev/null
+++ b/ci/ceph_build.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+workspace=/root
+build_dir=$workspace/stor4nfv
+ceph_src_dir=$build_dir/src/ceph
+
+function show_stage {
+ echo
+ echo $1
+ echo
+}
+
+function ceph_build_validate {
+ show_stage "validate"
+ if [[ -z "$@" ]]; then
+ echo "usage: ${0} output_dir pkgtype"
+ exit 1
+ fi
+ output_dir="$1"
+ pkgtype="$2"
+ if [ ! -d ${output_dir} -o ! -w ${output_dir} ] ; then
+ echo "${0}: Output directory '${output_dir}' does not exist or cannot be written"
+ exit 1
+ fi
+ if [ ! -d ${ceph_src_dir} ] ; then
+ echo "${0}: Directory '${ceph_src_dir}' does not exist, run this script from the root of stor4nfv source tree"
+ exit 1
+ fi
+ echo
+ echo "Build"
+ echo
+}
+
+# Build ceph
+show_stage "compile"
+# TODO: use code inside stor4nfv
+cd $workspace
+git clone https://github.com/ceph/ceph.git
+cd ceph
+git reset --hard v12.2.2
+git submodule update --init --recursive
+./install-deps.sh
+./do_cmake.sh
+cd build
+make
+
+ceph_rpm_build() {
+ show_stage "ceph rpm build"
+}
+
+ceph_deb_build() {
+ cd $workspace/ceph
+ dpkg-buildpackage
+ if [ ${?} -ne 0 ] ; then
+ echo "${0}: ceph build failed"
+ exit 1
+ fi
+}
+
+if [ $pkgtype == "centos" ];then
+ ceph_rpm_build
+elif [ $pkgtype == "ubuntu" ];then
+ ceph_deb_build
+ latest_ceph_build=`ls -rt $workspace | tail -1`
+ cp $workspace/$latest_ceph_build $build_dir/build_output
+fi