From 24d81ac0617519aa85318aba83fd608fb6f36d8c Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Mon, 19 Jun 2017 14:38:09 +0100 Subject: [PATCH] Add bindep.txt file OpenStack CI uses bindep to figure out which packages need to be installed on the host. However, when a bindep.txt file is not available, a default one is used which may or may not be good enough for all cases. It's best to have control over the packages which are going to be installed on the host and as such we add our own bindep.txt file. Change-Id: Idab36eb82d916183f2fb40d326d095c5a8ee34b2 --- bindep.txt | 17 ++++++++ .../add-bindep-support-8f54b246a1d2bca5.yaml | 14 +++++++ scripts/install-deps.sh | 39 +++++++++++-------- 3 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 bindep.txt create mode 100644 releasenotes/notes/add-bindep-support-8f54b246a1d2bca5.yaml diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 000000000..db578ffb4 --- /dev/null +++ b/bindep.txt @@ -0,0 +1,17 @@ +gcc +git +libffi-devel [platform:rpm] +libffi-dev [platform:dpkg] +libopenssl-devel [platform:suse] +openssl-devel [platform:redhat] +libssl-dev [platform:dpkg] +lsb-release [platform:suse platform:dpkg] +redhat-lsb [platform:redhat] +make +net-tools +python [platform:rpm] +python-minimal [platform:dpkg] +python-devel [platform:rpm] +python-dev [platform:dpkg] +python-virtualenv +wget diff --git a/releasenotes/notes/add-bindep-support-8f54b246a1d2bca5.yaml b/releasenotes/notes/add-bindep-support-8f54b246a1d2bca5.yaml new file mode 100644 index 000000000..59389e805 --- /dev/null +++ b/releasenotes/notes/add-bindep-support-8f54b246a1d2bca5.yaml @@ -0,0 +1,14 @@ +--- +other: + - bifrost host dependencies are now being installed using the + ``bindep`` tool. New dependencies should be added to the bindep.txt + file with the appropriate profile information if necessary. Core + dependencies (ie those needed to bootstrap the system such as python, + gcc, libffi, etc) must be listed in both the bindep.txt file and the + scripts/install-deps.sh one for mainly two reasons. First of all, the + OpenStack CI may only consult the bindep.txt in order to pull the + necessary dependencies. Second, ``bindep`` needs certain packages to + be present in order to its dependencies to build properly. + + More information about the ``bindep`` tool can be found at + https://docs.openstack.org/infra/bindep/ diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index b79f7768b..c854e497f 100644 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -5,12 +5,13 @@ declare -A PKG_MAP CHECK_CMD_PKGS=( gcc - git libffi libopenssl + lsb-release make net-tools python-devel + python venv wget ) @@ -23,9 +24,9 @@ if [ -x '/usr/bin/zypper' ]; then CHECK_CMD="zypper search --match-exact --installed" PKG_MAP=( [gcc]=gcc - [git]=git [libffi]=libffi-devel [libopenssl]=libopenssl-devel + [lsb-release]=lsb-release [make]=make [net-tools]=net-tools [python]=python @@ -43,17 +44,18 @@ elif [ -x '/usr/bin/apt-get' ]; then OS_FAMILY="Debian" INSTALLER_CMD="sudo -H -E apt-get -y install" CHECK_CMD="dpkg -l" - PKG_MAP=( [gcc]=gcc - [git]=git - [libffi]=libffi-dev - [libopenssl]=libssl-dev - [make]=make - [net-tools]=net-tools - [python]=python-minimal - [python-devel]=libpython-dev - [venv]=python-virtualenv - [wget]=wget - ) + PKG_MAP=( + [gcc]=gcc + [libffi]=libffi-dev + [libopenssl]=libssl-dev + [lsb-release]=lsb-release + [make]=make + [net-tools]=net-tools + [python]=python-minimal + [python-devel]=libpython-dev + [venv]=python-virtualenv + [wget]=wget + ) EXTRA_PKG_DEPS=() elif [ -x '/usr/bin/dnf' ] || [ -x '/usr/bin/yum' ]; then OS_FAMILY="RedHat" @@ -62,9 +64,9 @@ elif [ -x '/usr/bin/dnf' ] || [ -x '/usr/bin/yum' ]; then CHECK_CMD="rpm -q" PKG_MAP=( [gcc]=gcc - [git]=git [libffi]=libffi-devel [libopenssl]=openssl-devel + [lsb-release]=redhat-lsb [make]=make [net-tools]=net-tools [python]=python @@ -83,9 +85,6 @@ fi if ! $(gcc -v &>/dev/null); then ${INSTALLER_CMD} ${PKG_MAP[gcc]} fi -if ! $(git --version &>/dev/null); then - ${INSTALLER_CMD} ${PKG_MAP[git]} -fi if ! $(wget --version &>/dev/null); then ${INSTALLER_CMD} ${PKG_MAP[wget]} fi @@ -158,3 +157,9 @@ PIP=$(which pip) sudo -H -E ${PIP} install "pip>6.0" sudo -H -E ${PIP} install -r "$(dirname $0)/../requirements.txt" + +# Install the rest of required packages using bindep +sudo -H -E ${PIP} install bindep + +# bindep returns 1 if packages are missing +bindep -b &> /dev/null || ${INSTALLER_CMD} $(bindep -b)