From 89a35c1dc4c14b67015687721fba72e5ef11060d Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 5 Oct 2022 10:19:32 -0400 Subject: [PATCH] script: use install-deps.sh to install extra packages wanted by run-make.sh The run-make.sh script's prepare method pulls in additional dependencies that are needed by the CI build and tests. To avoid issues such as these packages not being available until after install-deps.sh being run in a container environment, we allow install-deps.sh and its new INSTALL_EXTRA_PKGS input variable to handle all of the dependency installation. Signed-off-by: John Mulligan (cherry picked from commit 5f92f545c67efa38e1c977b1c87281abad5ec748) --- src/script/run-make.sh | 64 ++++-------------------------------------- 1 file changed, 6 insertions(+), 58 deletions(-) diff --git a/src/script/run-make.sh b/src/script/run-make.sh index d2ccf1fbf4d54..4b9a17b790695 100755 --- a/src/script/run-make.sh +++ b/src/script/run-make.sh @@ -58,75 +58,23 @@ function detect_ceph_dev_pkgs() { echo "$cmake_opts" } -function do_install() { - local install_cmd - local pkgs - local ret - install_cmd=$1 - shift - pkgs=$@ - shift - ret=0 - SUDO="" - if [ "$EUID" -ne 0 ]; then - SUDO="sudo" - fi - $DRY_RUN $SUDO $install_cmd $pkgs || ret=$? - if test $ret -eq 0 ; then - return - fi - # try harder if apt-get, and it was interrutped - 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 - else - return $ret - fi - fi -} function prepare() { - local install_cmd local which_pkg="which" - source /etc/os-release - if test -f /etc/redhat-release ; then - if [ "$VERSION_ID" -ge "22" ]; then - install_cmd="dnf -y install" - else - install_cmd="yum install -y" - fi - elif type zypper > /dev/null 2>&1 ; then - install_cmd="zypper --gpg-auto-import-keys --non-interactive install --no-recommends" - elif type apt-get > /dev/null 2>&1 ; then - install_cmd="apt-get install -y" + if command -v apt-get > /dev/null 2>&1 ; then which_pkg="debianutils" fi - 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." - 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 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 + if test -f ./install-deps.sh ; then + in_jenkins && echo "CI_DEBUG: Running install-deps.sh" + INSTALL_EXTRA_PACKAGES="ccache git $which_pkg clang" + $DRY_RUN source ./install-deps.sh || return 1 + trap clean_up_after_myself EXIT fi if ! type ccache > /dev/null 2>&1 ; then echo "ERROR: ccache could not be installed" exit 1 fi - - if test -f ./install-deps.sh ; then - in_jenkins && echo "CI_DEBUG: Running install-deps.sh" - $DRY_RUN source ./install-deps.sh || return 1 - trap clean_up_after_myself EXIT - fi } function configure() { -- 2.39.5