From 58fe64a61578282d9740dae1349bfc44db61dbce Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 2 Sep 2015 22:17:27 -0400 Subject: [PATCH] build-ceph-cmake.sh: build with cmake No make check for the time being. Signed-off-by: Sage Weil --- build-auto.sh | 3 ++ build-ceph-cmake.sh | 90 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100755 build-ceph-cmake.sh diff --git a/build-auto.sh b/build-auto.sh index dae20f7..586cdbd 100755 --- a/build-auto.sh +++ b/build-auto.sh @@ -29,6 +29,9 @@ if hostname | grep -q -- ceph-deb- ; then exec $mydir/build-ceph-deb-native.sh fi if hostname | grep -q -- ceph-tarball- ; then + if hostname | grep -q -- -cmake ; then + exec $mydir/build-ceph-cmake.sh + fi exec $mydir/build-ceph.sh fi if hostname | grep -q -- ceph-rpm- ; then diff --git a/build-ceph-cmake.sh b/build-ceph-cmake.sh new file mode 100755 index 0000000..ec262ff --- /dev/null +++ b/build-ceph-cmake.sh @@ -0,0 +1,90 @@ +#!/bin/bash -x +set -e + +git submodule foreach 'git clean -fdx && git reset --hard' +rm -rf ceph-object-corpus +rm -rf ceph-erasure-code-corpus +rm -rf src/gmock +rm -rf src/leveldb +rm -rf src/libs3 +rm -rf src/mongoose +rm -rf src/civetweb +rm -rf src/rocksdb +rm -rf src/erasure-code/jerasure/gf-complete +rm -rf src/erasure-code/jerasure/jerasure +rm -rf .git/modules/ +git clean -fdx && git reset --hard +/srv/git/bin/git submodule sync +/srv/autobuild-ceph/use-mirror.sh +/srv/git/bin/git submodule update --init --recursive +git clean -fdx + +echo --START-IGNORE-WARNINGS +[ ! -x install-deps.sh ] || ./install-deps.sh + +mkdir build +cd build +cmake .. + +# +# Return MIN(4, MAX(1, (number of processors / 2))) +# Do not try to use more than 4 because it will stress +# IO too much +# +function get_processors() { + if test $(nproc) -ge 16 ; then + echo 4 + elif test $(nproc) -ge 2 ; then + expr $(nproc) / 2 + else + echo 1 + fi +} + +make -j$(get_processors) "$@" || exit 4 + +# run "make check", but give it a time limit in case a test gets stuck +#trap "pkill -9 ceph-osd || true ; pkill -9 ceph-mon || true" EXIT +#if ! ../maxtime 5400 make $(maybe_parallel_make_check) check "$@" ; then +# exit 5 +#fi + +REV="$(git rev-parse HEAD)" +OUTDIR="../out/output/sha1/$REV" +OUTDIR_TMP="${OUTDIR}.tmp" +install -d -m0755 -- "$OUTDIR_TMP" +printf '%s\n' "$REV" >"$OUTDIR_TMP/sha1" +MACH="$(uname -m)" +INSTDIR="inst.tmp" +[ ! -e "$INSTDIR" ] +../maxtime 1800 ionice -c3 nice -n20 make install DESTDIR="$PWD/$INSTDIR" +tar czf "$OUTDIR_TMP/ceph.$MACH.tgz" -C "$INSTDIR" . +rm -rf -- "$INSTDIR" + +# put our temp files inside .git/ so ls-files doesn't see them +git ls-files --modified >.git/modified-files +if [ -s .git/modified-files ]; then + rm -rf "$OUTDIR_TMP" + echo "error: Modified files:" 1>&2 + cat .git/modified-files 1>&2 + exit 6 +fi + +git ls-files --exclude-standard --others >.git/added-files +if [ -s .git/added-files ]; then + rm -rf "$OUTDIR_TMP" + echo "error: Added files:" 1>&2 + cat .git/added-files 1>&2 + exit 7 +fi + +# we're successful, the files are ok to be published; try to be as +# atomic as possible about replacing potentially existing OUTDIR +if [ -e "$OUTDIR" ]; then + rm -rf -- "$OUTDIR.old" + mv -- "$OUTDIR" "$OUTDIR.old" +fi +mv -- "$OUTDIR_TMP" "$OUTDIR" +rm -rf -- "$OUTDIR.old" + +exit 0 -- 2.39.5