Merge "Add support for testing on Gentoo."

This commit is contained in:
Zuul 2018-04-30 05:08:47 +00:00 committed by Gerrit Code Review
commit e8bdfbe222
2 changed files with 22 additions and 14 deletions

View File

@ -58,32 +58,33 @@ case ${ID,,} in
*suse*) pkg_mgr_cmd="zypper -n in" ;; *suse*) pkg_mgr_cmd="zypper -n in" ;;
centos|rhel|fedora) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;; centos|rhel|fedora) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;;
ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;; ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;;
gentoo) pkg_mgr_cmd="emerge" ;;
*) echo "unsupported distribution: ${ID,,}"; exit 1 ;; *) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
esac esac
# Install git so that we can clone the tests repo # Install git so that we can clone the tests repo if git is not available
eval sudo $pkg_mgr_cmd git which git &>/dev/null || eval sudo "${pkg_mgr_cmd}" git
# Clone the tests repo for access to the common test script # Clone the tests repo for access to the common test script
if [[ ! -d ${COMMON_TESTS_PATH} ]]; then if [[ ! -d "${COMMON_TESTS_PATH}" ]]; then
# The tests repo doesn't need a clone, we can just # The tests repo doesn't need a clone, we can just
# symlink it. # symlink it.
if [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-tests" ]]; then if [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-tests" ]]; then
ln -s ${WORKING_DIR} ${COMMON_TESTS_PATH} ln -s "${WORKING_DIR}" "${COMMON_TESTS_PATH}"
# In zuul v3 any dependent repository is placed into # In zuul v3 any dependent repository is placed into
# /home/zuul/src/git.openstack.org, so we check to see # /home/zuul/src/git.openstack.org, so we check to see
# if there is a tests checkout there already. If so, we # if there is a tests checkout there already. If so, we
# symlink that and use it. # symlink that and use it.
elif [[ -d "${ZUUL_TESTS_CLONE_LOCATION}" ]]; then elif [[ -d "${ZUUL_TESTS_CLONE_LOCATION}" ]]; then
ln -s "${ZUUL_TESTS_CLONE_LOCATION}" ${COMMON_TESTS_PATH} ln -s "${ZUUL_TESTS_CLONE_LOCATION}" "${COMMON_TESTS_PATH}"
# Otherwise we're clearly not in zuul or using a previously setup # Otherwise we're clearly not in zuul or using a previously setup
# repo in some way, so just clone it from upstream. # repo in some way, so just clone it from upstream.
else else
git clone -b ${TESTING_BRANCH} \ git clone -b "${TESTING_BRANCH}" \
https://git.openstack.org/openstack/openstack-ansible-tests \ https://git.openstack.org/openstack/openstack-ansible-tests \
${COMMON_TESTS_PATH} "${COMMON_TESTS_PATH}"
fi fi
fi fi

View File

@ -77,9 +77,13 @@ case "${ID,,}" in
pkg_list="python-dev lsb-release" pkg_list="python-dev lsb-release"
sudo apt-get update sudo apt-get update
;; ;;
gentoo)
sudo emaint-sync -A
;;
*) *)
echo "Unsupported distribution: ${ID,,}" echo "Unsupported distribution: ${ID,,}"
exit 1 exit 1
;;
esac esac
eval sudo ${pkg_mgr_cmd} ${pkg_list} eval sudo ${pkg_mgr_cmd} ${pkg_list}
@ -92,36 +96,39 @@ fi
# Install bindep and tox # Install bindep and tox
sudo pip install 'bindep>=2.4.0' tox sudo pip install 'bindep>=2.4.0' tox
if [[ ${ID,,} == "centos" ]]; then if [[ "${ID,,}" == "centos" ]]; then
# epel-release could be installed but not enabled (which is very common # epel-release could be installed but not enabled (which is very common
# in openstack-ci) so enable it here if needed # in openstack-ci) so enable it here if needed
sudo yum-config-manager --enable epel > /dev/null || true sudo yum-config-manager --enable epel > /dev/null || true
elif [[ ${ID,,} == "fedora" ]]; then elif [[ "${ID,,}" == "fedora" ]]; then
sudo dnf -y install redhat-lsb-core yum-utils sudo dnf -y install redhat-lsb-core yum-utils
# openSUSE 42.1 does not have python-ndg-httpsclient # openSUSE 42.1 does not have python-ndg-httpsclient
elif [[ ${ID,,} == *suse* ]] && [[ ${VERSION} == "42.1" ]]; then elif [[ "${ID,,}" == *suse* ]] && [[ ${VERSION} == "42.1" ]]; then
sudo pip install ndg-httpsclient sudo pip install ndg-httpsclient
fi fi
# Get a list of packages to install with bindep. If packages need to be # Get a list of packages to install with bindep. If packages need to be
# installed, bindep exits with an exit code of 1. # installed, bindep exits with an exit code of 1.
BINDEP_PKGS=$(bindep -b -f ${BINDEP_FILE} test || true) BINDEP_PKGS=$(bindep -b -f "${BINDEP_FILE}" test || true)
echo "Packages to install: ${BINDEP_PKGS}" echo "Packages to install: ${BINDEP_PKGS}"
# Install OS packages using bindep # Install OS packages using bindep
if [[ ${#BINDEP_PKGS} > 0 ]]; then if [[ ${#BINDEP_PKGS} > 0 ]]; then
case "${ID,,}" in case "${ID,,}" in
*suse*) *suse*)
sudo zypper -n in $BINDEP_PKGS sudo zypper -n in ${BINDEP_PKGS}
;; ;;
centos|fedora) centos|fedora)
sudo $RHT_PKG_MGR install -y $BINDEP_PKGS sudo "${RHT_PKG_MGR}" install -y ${BINDEP_PKGS}
;; ;;
ubuntu|debian) ubuntu|debian)
sudo apt-get update sudo apt-get update
DEBIAN_FRONTEND=noninteractive \ DEBIAN_FRONTEND=noninteractive \
sudo apt-get -q --option "Dpkg::Options::=--force-confold" \ sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes install $BINDEP_PKGS --assume-yes install ${BINDEP_PKGS}
;;
gentoo)
sudo emerge -q --jobs="$(nrpoc)" ${BINDEP_PKGS}
;; ;;
esac esac
fi fi