Files
bifrost/scripts/install-deps.sh
Markos Chandras 0448b22266 scripts: install-deps: Add 'make' to the required packages
Latest paramiko pulls pynacl which requires 'make' to be present on the
host otherwise it fails with the following error:

~> pip install pynacl
Collecting pynacl
  Using cached PyNaCl-1.1.2.tar.gz
Requirement already satisfied: six in /usr/lib/python2.7/site-packages (from pynacl)
Requirement already satisfied: cffi>=1.4.1 in ./.local/lib/python2.7/site-packages (from pynacl)
Requirement already satisfied: pycparser in ./.local/lib/python2.7/site-packages (from cffi>=1.4.1->pynacl)
Building wheels for collected packages: pynacl
  Running setup.py bdist_wheel for pynacl ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-WNVVlf/pynacl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');
f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpCBHg6Lpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/nacl
[...]
    checking for nanosleep... yes
    checking for posix_memalign... yes
    checking for getpid... yes
    checking if gcc/ld supports -Wl,--output-def... not needed, shared libraries are disabled
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating dist-build/Makefile
    config.status: creating libsodium.pc
    config.status: creating libsodium-uninstalled.pc
    config.status: creating msvc-scripts/Makefile
    config.status: creating src/Makefile
    config.status: creating src/libsodium/Makefile
    config.status: creating src/libsodium/include/Makefile
    config.status: creating src/libsodium/include/sodium/version.h
    config.status: creating test/default/Makefile
    config.status: creating test/Makefile
    config.status: executing depfiles commands
    config.status: executing libtool commands
    error: [Errno 2] No such file or directory

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-WNVVlf/pynacl/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-PAHH7o-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-WNVVlf/pynacl/

The problem has also been reported to the project page on github to
improve the cryptic error message.

This also updates the list of required host packages

Link: https://github.com/pyca/pynacl/issues/298
Change-Id: I25031182379eb723cc0a15840564939122a44bd0
2017-06-12 15:01:13 +01:00

161 lines
4.5 KiB
Bash

#!/bin/bash
set -eu
declare -A PKG_MAP
CHECK_CMD_PKGS=(
gcc
git
libffi
libopenssl
make
net-tools
python-devel
venv
wget
)
# Check zypper before apt-get in case zypper-aptitude
# is installed
if [ -x '/usr/bin/zypper' ]; then
OS_FAMILY="Suse"
INSTALLER_CMD="sudo -H -E zypper install -y"
CHECK_CMD="zypper search --match-exact --installed"
PKG_MAP=(
[gcc]=gcc
[git]=git
[libffi]=libffi-devel
[libopenssl]=libopenssl-devel
[make]=make
[net-tools]=net-tools
[python]=python
[python-devel]=python-devel
[venv]=python-virtualenv
[wget]=wget
)
EXTRA_PKG_DEPS=( python-xml )
# NOTE (cinerama): we can't install python without removing this package
# if it exists
if $(${CHECK_CMD} patterns-openSUSE-minimal_base-conflicts &> /dev/null); then
sudo -H zypper remove -y patterns-openSUSE-minimal_base-conflicts
fi
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
)
EXTRA_PKG_DEPS=()
elif [ -x '/usr/bin/dnf' ] || [ -x '/usr/bin/yum' ]; then
OS_FAMILY="RedHat"
PKG_MANAGER=$(which dnf || which yum)
INSTALLER_CMD="sudo -H -E ${PKG_MANAGER} -y install"
CHECK_CMD="rpm -q"
PKG_MAP=(
[gcc]=gcc
[git]=git
[libffi]=libffi-devel
[libopenssl]=openssl-devel
[make]=make
[net-tools]=net-tools
[python]=python
[python-devel]=python-devel
[venv]=python-virtualenv
[wget]=wget
)
EXTRA_PKG_DEPS=()
else
echo "ERROR: Supported package manager not found. Supported: apt, dnf, yum, zypper"
fi
if ! $(python --version &>/dev/null); then
${INSTALLER_CMD} ${PKG_MAP[python]}
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
if [ -n "${VENV-}" ]; then
if ! $(python -m virtualenv --version &>/dev/null); then
${INSTALLER_CMD} ${PKG_MAP[venv]}
fi
fi
for pkg in ${CHECK_CMD_PKGS[@]}; do
if ! $(${CHECK_CMD} ${PKG_MAP[$pkg]} &>/dev/null); then
${INSTALLER_CMD} ${PKG_MAP[$pkg]}
fi
done
if [ -n "${EXTRA_PKG_DEPS-}" ]; then
for pkg in ${EXTRA_PKG_DEPS}; do
if ! $(${CHECK_CMD} ${pkg} &>/dev/null); then
${INSTALLER_CMD} ${pkg}
fi
done
fi
if [ -n "${VENV-}" ]; then
echo "NOTICE: Using virtualenv for this installation."
if [ ! -f ${VENV}/bin/activate ]; then
# only create venv if one doesn't exist
sudo -H -E python -m virtualenv --no-site-packages ${VENV}
fi
# Note(cinerama): activate is not compatible with "set -u";
# disable it just for this line.
set +u
source ${VENV}/bin/activate
set -u
VIRTUAL_ENV=${VENV}
else
echo "NOTICE: Not using virtualenv for this installation."
fi
# If we're using a venv, we need to work around sudo not
# keeping the path even with -E.
PYTHON=$(which python)
# To install python packages, we need pip.
#
# We can't use the apt packaged version of pip since
# older versions of pip are incompatible with
# requests, one of our indirect dependencies (bug 1459947).
#
# Note(cinerama): We use pip to install an updated pip plus our
# other python requirements. pip breakages can seriously impact us,
# so we've chosen to install/upgrade pip here rather than in
# requirements (which are synced automatically from the global ones)
# so we can quickly and easily adjust version parameters.
# See bug 1536627.
#
# Note(cinerama): If pip is linked to pip3, the rest of the install
# won't work. Remove the alternatives. This is due to ansible's
# python 2.x requirement.
if [[ $(readlink -f /etc/alternatives/pip) =~ "pip3" ]]; then
sudo -H update-alternatives --remove pip $(readlink -f /etc/alternatives/pip)
fi
if ! which pip; then
wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
sudo -H -E ${PYTHON} /tmp/get-pip.py
fi
PIP=$(which pip)
sudo -H -E ${PIP} install "pip>6.0"
sudo -H -E ${PIP} install -r "$(dirname $0)/../requirements.txt"