mirror of
https://github.com/ceph/ceph
synced 2025-03-25 11:48:05 +00:00
script: reorganize build scripts
In preparation for running builds and tests in containers, make some
organizational changes to the run-make-*.sh scripts.
Original version of the patch can be found at https://github.com/ceph/ceph/pull/46071
Original-version-by: Ernesto Puerta <epuertat@redhat.com>
Co-authored-by: Ernesto Puerta <epuertat@redhat.com>
Co-authored-by: John Mulligan <jmulligan@redhat.com>
Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 70bf755f9e
)
This commit is contained in:
parent
edc9202252
commit
339e5bc62f
@ -22,10 +22,6 @@ source src/script/run-make.sh
|
||||
|
||||
set -e
|
||||
|
||||
function in_jenkins() {
|
||||
test -n "$JENKINS_HOME"
|
||||
}
|
||||
|
||||
function run() {
|
||||
# to prevent OSD EMFILE death on tests, make sure ulimit >= 1024
|
||||
$DRY_RUN ulimit -n $(ulimit -Hn)
|
||||
@ -75,43 +71,13 @@ function main() {
|
||||
fi
|
||||
# uses run-make.sh to install-deps
|
||||
FOR_MAKE_CHECK=1 prepare
|
||||
local cxx_compiler=g++
|
||||
local c_compiler=gcc
|
||||
for i in $(seq 14 -1 10); do
|
||||
if type -t clang-$i > /dev/null; then
|
||||
cxx_compiler="clang++-$i"
|
||||
c_compiler="clang-$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
# Init defaults after deps are installed.
|
||||
local cmake_opts
|
||||
cmake_opts+=" -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_C_COMPILER=$c_compiler"
|
||||
cmake_opts+=" -DCMAKE_CXX_FLAGS_DEBUG=-Werror"
|
||||
cmake_opts+=" -DENABLE_GIT_VERSION=OFF"
|
||||
cmake_opts+=" -DWITH_GTEST_PARALLEL=ON"
|
||||
cmake_opts+=" -DWITH_FIO=ON"
|
||||
cmake_opts+=" -DWITH_CEPHFS_SHELL=ON"
|
||||
cmake_opts+=" -DWITH_GRAFANA=ON"
|
||||
cmake_opts+=" -DWITH_SPDK=ON"
|
||||
cmake_opts+=" -DWITH_RBD_MIRROR=ON"
|
||||
if [ $WITH_SEASTAR ]; then
|
||||
cmake_opts+=" -DWITH_SEASTAR=ON"
|
||||
fi
|
||||
if [ $WITH_ZBD ]; then
|
||||
cmake_opts+=" -DWITH_ZBD=ON"
|
||||
fi
|
||||
if [ $WITH_RBD_RWL ]; then
|
||||
cmake_opts+=" -DWITH_RBD_RWL=ON"
|
||||
fi
|
||||
cmake_opts+=" -DWITH_RBD_SSD_CACHE=ON"
|
||||
in_jenkins && echo "CI_DEBUG: Our cmake_opts are: $cmake_opts
|
||||
CI_DEBUG: Running ./configure"
|
||||
configure "$cmake_opts" "$@"
|
||||
configure "$@"
|
||||
in_jenkins && echo "CI_DEBUG: Running 'build tests'"
|
||||
build tests
|
||||
echo "make check: successful build on $(git rev-parse HEAD)"
|
||||
FOR_MAKE_CHECK=1 run
|
||||
}
|
||||
|
||||
main "$@"
|
||||
if [ "$0" = "$BASH_SOURCE" ]; then
|
||||
main "$@"
|
||||
fi
|
||||
|
@ -67,7 +67,11 @@ function do_install() {
|
||||
pkgs=$@
|
||||
shift
|
||||
ret=0
|
||||
$DRY_RUN sudo $install_cmd $pkgs || ret=$?
|
||||
SUDO=""
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
SUDO="sudo"
|
||||
fi
|
||||
$DRY_RUN $SUDO $install_cmd $pkgs || ret=$?
|
||||
if test $ret -eq 0 ; then
|
||||
return
|
||||
fi
|
||||
@ -75,9 +79,9 @@ function do_install() {
|
||||
if [[ $install_cmd == *"apt-get"* ]]; then
|
||||
if test $ret -eq 100 ; then
|
||||
# dpkg was interrupted
|
||||
$DRY_RUN sudo dpkg --configure -a
|
||||
in_jenkins && echo "CI_DEBUG: Running 'sudo $install_cmd $pkgs'"
|
||||
$DRY_RUN sudo $install_cmd $pkgs
|
||||
$DRY_RUN $SUDO dpkg --configure -a
|
||||
in_jenkins && echo "CI_DEBUG: Running '$SUDO $install_cmd $pkgs'"
|
||||
$DRY_RUN $SUDO $install_cmd $pkgs
|
||||
else
|
||||
return $ret
|
||||
fi
|
||||
@ -88,11 +92,7 @@ function prepare() {
|
||||
local which_pkg="which"
|
||||
source /etc/os-release
|
||||
if test -f /etc/redhat-release ; then
|
||||
if ! type bc > /dev/null 2>&1 ; then
|
||||
echo "Please install bc and re-run."
|
||||
exit 1
|
||||
fi
|
||||
if test "$(echo "$VERSION_ID >= 22" | bc)" -ne 0; then
|
||||
if [ "$VERSION_ID" -ge "22" ]; then
|
||||
install_cmd="dnf -y install"
|
||||
else
|
||||
install_cmd="yum install -y"
|
||||
@ -104,14 +104,14 @@ function prepare() {
|
||||
which_pkg="debianutils"
|
||||
fi
|
||||
|
||||
if ! type sudo > /dev/null 2>&1 ; then
|
||||
if [ "$EUID" -ne 0 ] && ! type sudo > /dev/null 2>&1 ; then
|
||||
echo "Please install sudo and re-run. This script assumes it is running"
|
||||
echo "as a normal user with the ability to run commands as root via sudo."
|
||||
echo "as a normal user with the ability to run commands as root via sudo."
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "$install_cmd" ]; then
|
||||
in_jenkins && echo "CI_DEBUG: Running '$install_cmd ccache $which_pkg clang'"
|
||||
do_install "$install_cmd" ccache $which_pkg clang
|
||||
do_install "$install_cmd" ccache git $which_pkg clang
|
||||
else
|
||||
echo "WARNING: Don't know how to install packages" >&2
|
||||
echo "This probably means distribution $ID is not supported by run-make-check.sh" >&2
|
||||
@ -127,7 +127,9 @@ function prepare() {
|
||||
$DRY_RUN source ./install-deps.sh || return 1
|
||||
trap clean_up_after_myself EXIT
|
||||
fi
|
||||
}
|
||||
|
||||
function configure() {
|
||||
cat <<EOM
|
||||
Note that the binaries produced by this script do not contain correct time
|
||||
and git version information, which may make them unsuitable for debugging
|
||||
@ -148,12 +150,44 @@ EOM
|
||||
ccache -p | grep max_size
|
||||
fi
|
||||
$DRY_RUN ccache -sz # Reset the ccache statistics and show the current configuration
|
||||
}
|
||||
|
||||
function configure() {
|
||||
local cmake_build_opts=$(detect_ceph_dev_pkgs)
|
||||
local cxx_compiler=g++
|
||||
local c_compiler=gcc
|
||||
for i in $(seq 14 -1 10); do
|
||||
if type -t clang-$i > /dev/null; then
|
||||
cxx_compiler="clang++-$i"
|
||||
c_compiler="clang-$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
local cmake_opts
|
||||
cmake_opts+=" -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_C_COMPILER=$c_compiler"
|
||||
cmake_opts+=" -DCMAKE_CXX_FLAGS_DEBUG=-Werror"
|
||||
cmake_opts+=" -DENABLE_GIT_VERSION=OFF"
|
||||
cmake_opts+=" -DWITH_GTEST_PARALLEL=ON"
|
||||
cmake_opts+=" -DWITH_FIO=ON"
|
||||
cmake_opts+=" -DWITH_CEPHFS_SHELL=ON"
|
||||
cmake_opts+=" -DWITH_GRAFANA=ON"
|
||||
cmake_opts+=" -DWITH_SPDK=ON"
|
||||
cmake_opts+=" -DWITH_RBD_MIRROR=ON"
|
||||
if [ $WITH_SEASTAR ]; then
|
||||
cmake_opts+=" -DWITH_SEASTAR=ON"
|
||||
fi
|
||||
if [ $WITH_ZBD ]; then
|
||||
cmake_opts+=" -DWITH_ZBD=ON"
|
||||
fi
|
||||
if [ $WITH_RBD_RWL ]; then
|
||||
cmake_opts+=" -DWITH_RBD_RWL=ON"
|
||||
fi
|
||||
cmake_opts+=" -DWITH_RBD_SSD_CACHE=ON"
|
||||
|
||||
cmake_opts+=$(detect_ceph_dev_pkgs)
|
||||
|
||||
in_jenkins && echo "CI_DEBUG: Our cmake_opts are: $cmake_opts
|
||||
CI_DEBUG: Running ./configure"
|
||||
in_jenkins && echo "CI_DEBUG: Running do_cmake.sh"
|
||||
$DRY_RUN ./do_cmake.sh $cmake_build_opts $@ || return 1
|
||||
|
||||
$DRY_RUN ./do_cmake.sh $cmake_opts $@ || return 1
|
||||
}
|
||||
|
||||
function build() {
|
||||
|
Loading…
Reference in New Issue
Block a user