2017-07-20 22:26:42 +00:00
|
|
|
#!/usr/bin/env bash
|
2017-11-10 01:32:13 +00:00
|
|
|
# -*- mode:sh; tab-width:8; indent-tabs-mode:t -*-
|
2014-11-25 16:25:26 +00:00
|
|
|
#
|
|
|
|
# Ceph distributed storage system
|
|
|
|
#
|
2015-05-02 13:59:12 +00:00
|
|
|
# Copyright (C) 2014, 2015 Red Hat <contact@redhat.com>
|
2014-11-25 16:25:26 +00:00
|
|
|
#
|
|
|
|
# Author: Loic Dachary <loic@dachary.org>
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
2017-07-20 22:26:42 +00:00
|
|
|
set -e
|
2014-11-25 16:25:26 +00:00
|
|
|
DIR=/tmp/install-deps.$$
|
|
|
|
trap "rm -fr $DIR" EXIT
|
|
|
|
mkdir -p $DIR
|
2014-12-20 17:57:59 +00:00
|
|
|
if test $(id -u) != 0 ; then
|
|
|
|
SUDO=sudo
|
|
|
|
fi
|
2015-01-25 19:45:48 +00:00
|
|
|
export LC_ALL=C # the following is vulnerable to i18n
|
2015-02-03 15:26:17 +00:00
|
|
|
|
2018-08-01 10:33:58 +00:00
|
|
|
ARCH=$(uname -m)
|
2018-02-14 15:53:47 +00:00
|
|
|
|
2017-06-27 07:45:09 +00:00
|
|
|
function munge_ceph_spec_in {
|
2019-06-06 03:10:41 +00:00
|
|
|
local with_seastar=$1
|
|
|
|
shift
|
2019-02-13 12:47:38 +00:00
|
|
|
local for_make_check=$1
|
|
|
|
shift
|
2017-06-27 07:45:09 +00:00
|
|
|
local OUTFILE=$1
|
2019-02-13 12:47:38 +00:00
|
|
|
sed -e 's/@//g' < ceph.spec.in > $OUTFILE
|
|
|
|
# http://rpm.org/user_doc/conditional_builds.html
|
2019-06-06 03:10:41 +00:00
|
|
|
if $with_seastar; then
|
2018-07-03 09:06:47 +00:00
|
|
|
sed -i -e 's/%bcond_with seastar/%bcond_without seastar/g' $OUTFILE
|
|
|
|
fi
|
2019-02-13 12:47:38 +00:00
|
|
|
if $for_make_check; then
|
|
|
|
sed -i -e 's/%bcond_with make_check/%bcond_without make_check/g' $OUTFILE
|
|
|
|
fi
|
2017-06-27 07:45:09 +00:00
|
|
|
}
|
|
|
|
|
2019-02-13 11:56:00 +00:00
|
|
|
function munge_debian_control {
|
|
|
|
local version=$1
|
|
|
|
shift
|
2019-06-06 03:10:41 +00:00
|
|
|
local with_seastar=$1
|
|
|
|
shift
|
2019-02-13 12:25:21 +00:00
|
|
|
local for_make_check=$1
|
2019-02-13 11:56:00 +00:00
|
|
|
shift
|
2019-02-13 12:25:21 +00:00
|
|
|
local control=$1
|
2019-02-13 11:56:00 +00:00
|
|
|
case "$version" in
|
|
|
|
*squeeze*|*wheezy*)
|
|
|
|
control="/tmp/control.$$"
|
|
|
|
grep -v babeltrace debian/control > $control
|
|
|
|
;;
|
|
|
|
esac
|
2019-06-06 03:10:41 +00:00
|
|
|
if $with_seastar; then
|
2019-06-06 02:57:53 +00:00
|
|
|
sed -i -e 's/^# Crimson[[:space:]]//g' $control
|
|
|
|
fi
|
2019-02-13 12:25:21 +00:00
|
|
|
if $for_make_check; then
|
|
|
|
sed -i 's/^# Make-Check[[:space:]]/ /g' $control
|
|
|
|
fi
|
2019-02-13 11:56:00 +00:00
|
|
|
echo $control
|
2017-06-27 07:45:09 +00:00
|
|
|
}
|
|
|
|
|
2018-08-01 10:52:45 +00:00
|
|
|
function ensure_decent_gcc_on_ubuntu {
|
2017-11-12 05:07:35 +00:00
|
|
|
# point gcc to the one offered by g++-7 if the used one is not
|
|
|
|
# new enough
|
2018-10-26 06:32:09 +00:00
|
|
|
local old=$(gcc -dumpfullversion -dumpversion)
|
2017-12-08 08:34:59 +00:00
|
|
|
local new=$1
|
2018-08-01 10:52:45 +00:00
|
|
|
local codename=$2
|
2019-05-14 14:37:00 +00:00
|
|
|
if dpkg --compare-versions $old ge ${new}.0; then
|
2017-11-12 05:07:35 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2017-12-13 06:22:39 +00:00
|
|
|
if [ ! -f /usr/bin/g++-${new} ]; then
|
2017-12-14 11:06:51 +00:00
|
|
|
$SUDO tee /etc/apt/sources.list.d/ubuntu-toolchain-r.list <<EOF
|
2018-09-28 03:45:03 +00:00
|
|
|
deb [lang=none] http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu $codename main
|
2019-06-07 16:13:04 +00:00
|
|
|
deb [arch=amd64 lang=none] http://mirror.nullivex.com/ppa/ubuntu-toolchain-r-test $codename main
|
|
|
|
deb [arch=amd64 lang=none] http://deb.rug.nl/ppa/mirror/ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu $codename main
|
2017-12-13 06:22:39 +00:00
|
|
|
EOF
|
|
|
|
# import PPA's signing key into APT's keyring
|
2018-07-10 12:23:48 +00:00
|
|
|
cat << ENDOFKEY | $SUDO apt-key add -
|
|
|
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
|
|
Version: SKS 1.1.6
|
|
|
|
Comment: Hostname: keyserver.ubuntu.com
|
|
|
|
|
|
|
|
mI0ESuBvRwEEAMi4cDba7xlKaaoXjO1n1HX8RKrkW+HEIl79nSOSJyvzysajs7zUow/OzCQp
|
|
|
|
9NswqrDmNuH1+lPTTRNAGtK8r2ouq2rnXT1mTl23dpgHZ9spseR73s4ZBGw/ag4bpU5dNUSt
|
|
|
|
vfmHhIjVCuiSpNn7cyy1JSSvSs3N2mxteKjXLBf7ABEBAAG0GkxhdW5jaHBhZCBUb29sY2hh
|
|
|
|
aW4gYnVpbGRziLYEEwECACAFAkrgb0cCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRAe
|
|
|
|
k3eiup7yfzGKA/4xzUqNACSlB+k+DxFFHqkwKa/ziFiAlkLQyyhm+iqz80htRZr7Ls/ZRYZl
|
|
|
|
0aSU56/hLe0V+TviJ1s8qdN2lamkKdXIAFfavA04nOnTzyIBJ82EAUT3Nh45skMxo4z4iZMN
|
|
|
|
msyaQpNl/m/lNtOLhR64v5ZybofB2EWkMxUzX8D/FQ==
|
|
|
|
=LcUQ
|
|
|
|
-----END PGP PUBLIC KEY BLOCK-----
|
|
|
|
ENDOFKEY
|
2018-09-28 03:45:03 +00:00
|
|
|
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get update -y || true
|
2019-05-14 14:37:00 +00:00
|
|
|
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get install -y g++-${new}
|
2017-12-09 11:29:58 +00:00
|
|
|
fi
|
2017-12-13 06:22:39 +00:00
|
|
|
|
2018-08-01 10:52:45 +00:00
|
|
|
case $codename in
|
2017-12-13 06:22:39 +00:00
|
|
|
trusty)
|
|
|
|
old=4.8;;
|
|
|
|
xenial)
|
|
|
|
old=5;;
|
2019-06-07 16:08:37 +00:00
|
|
|
bionic)
|
|
|
|
old=7;;
|
2017-12-13 06:22:39 +00:00
|
|
|
esac
|
2017-12-09 11:29:58 +00:00
|
|
|
$SUDO update-alternatives --remove-all gcc || true
|
2017-11-12 05:07:35 +00:00
|
|
|
$SUDO update-alternatives \
|
2017-12-09 09:35:28 +00:00
|
|
|
--install /usr/bin/gcc gcc /usr/bin/gcc-${new} 20 \
|
|
|
|
--slave /usr/bin/g++ g++ /usr/bin/g++-${new}
|
2017-11-12 05:07:35 +00:00
|
|
|
|
2018-04-14 15:23:58 +00:00
|
|
|
if [ -f /usr/bin/g++-${old} ]; then
|
|
|
|
$SUDO update-alternatives \
|
|
|
|
--install /usr/bin/gcc gcc /usr/bin/gcc-${old} 10 \
|
|
|
|
--slave /usr/bin/g++ g++ /usr/bin/g++-${old}
|
|
|
|
fi
|
2017-11-12 05:07:35 +00:00
|
|
|
|
|
|
|
$SUDO update-alternatives --auto gcc
|
|
|
|
|
|
|
|
# cmake uses the latter by default
|
2018-06-07 07:51:31 +00:00
|
|
|
$SUDO ln -nsf /usr/bin/gcc /usr/bin/$(uname -m)-linux-gnu-gcc
|
|
|
|
$SUDO ln -nsf /usr/bin/g++ /usr/bin/$(uname -m)-linux-gnu-g++
|
2017-11-12 05:07:35 +00:00
|
|
|
}
|
|
|
|
|
2018-09-08 15:06:45 +00:00
|
|
|
function install_pkg_on_ubuntu {
|
|
|
|
local project=$1
|
|
|
|
shift
|
|
|
|
local sha1=$1
|
|
|
|
shift
|
|
|
|
local codename=$1
|
|
|
|
shift
|
|
|
|
local pkgs=$@
|
|
|
|
local missing_pkgs
|
|
|
|
for pkg in $pkgs; do
|
|
|
|
if ! dpkg -s $pkg &> /dev/null; then
|
|
|
|
missing_pkgs+=" $pkg"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if test -n "$missing_pkgs"; then
|
|
|
|
local shaman_url="https://shaman.ceph.com/api/repos/${project}/master/${sha1}/ubuntu/${codename}/repo"
|
|
|
|
$SUDO curl --silent --location $shaman_url --output /etc/apt/sources.list.d/$project.list
|
|
|
|
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get update -y -o Acquire::Languages=none -o Acquire::Translation=none || true
|
|
|
|
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get install --allow-unauthenticated -y $missing_pkgs
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-11-20 04:43:34 +00:00
|
|
|
function install_boost_on_ubuntu {
|
|
|
|
local codename=$1
|
|
|
|
install_pkg_on_ubuntu \
|
|
|
|
ceph-libboost1.67 \
|
|
|
|
dd38c27740c1f9a9e6719a07eef84a1369dc168b \
|
|
|
|
$codename \
|
|
|
|
ceph-libboost-atomic1.67-dev \
|
|
|
|
ceph-libboost-chrono1.67-dev \
|
|
|
|
ceph-libboost-container1.67-dev \
|
|
|
|
ceph-libboost-context1.67-dev \
|
|
|
|
ceph-libboost-coroutine1.67-dev \
|
|
|
|
ceph-libboost-date-time1.67-dev \
|
|
|
|
ceph-libboost-filesystem1.67-dev \
|
|
|
|
ceph-libboost-iostreams1.67-dev \
|
|
|
|
ceph-libboost-program-options1.67-dev \
|
|
|
|
ceph-libboost-python1.67-dev \
|
|
|
|
ceph-libboost-random1.67-dev \
|
|
|
|
ceph-libboost-regex1.67-dev \
|
|
|
|
ceph-libboost-system1.67-dev \
|
2019-05-08 00:21:48 +00:00
|
|
|
ceph-libboost-test1.67-dev \
|
2018-11-20 04:43:34 +00:00
|
|
|
ceph-libboost-thread1.67-dev \
|
|
|
|
ceph-libboost-timer1.67-dev
|
|
|
|
}
|
|
|
|
|
2017-12-08 08:34:59 +00:00
|
|
|
function version_lt {
|
|
|
|
test $1 != $(echo -e "$1\n$2" | sort -rV | head -n 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
function ensure_decent_gcc_on_rh {
|
|
|
|
local old=$(gcc -dumpversion)
|
|
|
|
local expected=5.1
|
|
|
|
local dts_ver=$1
|
|
|
|
if version_lt $old $expected; then
|
2017-12-28 02:18:11 +00:00
|
|
|
if test -t 1; then
|
|
|
|
# interactive shell
|
|
|
|
cat <<EOF
|
2017-12-08 08:34:59 +00:00
|
|
|
Your GCC is too old. Please run following command to add DTS to your environment:
|
|
|
|
|
2019-03-22 17:16:23 +00:00
|
|
|
scl enable devtoolset-8 bash
|
2017-12-08 08:34:59 +00:00
|
|
|
|
|
|
|
Or add following line to the end of ~/.bashrc to add it permanently:
|
|
|
|
|
2019-03-22 17:16:23 +00:00
|
|
|
source scl_source enable devtoolset-8
|
2017-12-08 08:34:59 +00:00
|
|
|
|
|
|
|
see https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ for more details.
|
|
|
|
EOF
|
2017-12-28 02:18:11 +00:00
|
|
|
else
|
|
|
|
# non-interactive shell
|
|
|
|
source /opt/rh/devtoolset-$dts_ver/enable
|
|
|
|
fi
|
2017-12-08 08:34:59 +00:00
|
|
|
fi
|
2019-07-03 13:20:45 +00:00
|
|
|
if [ $(rpm -q --queryformat "%{VERSION}" devtoolset-$dts_ver-gcc-c++) = 8.3.1 ]; then
|
|
|
|
# rollback to avoid using a buggy version
|
|
|
|
$SUDO yum remove -y devtoolset-8-gcc-c++ devtoolset-8-gcc devtoolset-8-libstdc++-devel
|
|
|
|
$SUDO yum install -y devtoolset-8-gcc-c++-8.2.1-3.el7
|
|
|
|
fi
|
2017-12-08 08:34:59 +00:00
|
|
|
}
|
|
|
|
|
2018-08-01 10:33:58 +00:00
|
|
|
if [ x$(uname)x = xFreeBSDx ]; then
|
2016-03-24 11:48:20 +00:00
|
|
|
$SUDO pkg install -yq \
|
2017-07-24 16:20:19 +00:00
|
|
|
devel/babeltrace \
|
2019-03-06 22:23:33 +00:00
|
|
|
devel/binutils \
|
2016-03-24 11:48:20 +00:00
|
|
|
devel/git \
|
2016-08-09 16:28:07 +00:00
|
|
|
devel/gperf \
|
2016-03-24 11:48:20 +00:00
|
|
|
devel/gmake \
|
2016-10-16 20:10:03 +00:00
|
|
|
devel/cmake \
|
2016-03-24 11:48:20 +00:00
|
|
|
devel/yasm \
|
|
|
|
devel/boost-all \
|
2016-10-16 20:10:03 +00:00
|
|
|
devel/boost-python-libs \
|
2016-03-24 11:48:20 +00:00
|
|
|
devel/valgrind \
|
|
|
|
devel/pkgconf \
|
|
|
|
devel/libedit \
|
|
|
|
devel/libtool \
|
|
|
|
devel/google-perftools \
|
|
|
|
lang/cython \
|
|
|
|
devel/py-virtualenv \
|
|
|
|
databases/leveldb \
|
2018-09-04 15:39:59 +00:00
|
|
|
net/openldap24-client \
|
2016-03-24 11:48:20 +00:00
|
|
|
archivers/snappy \
|
2018-04-10 16:32:46 +00:00
|
|
|
archivers/liblz4 \
|
2016-03-24 11:48:20 +00:00
|
|
|
ftp/curl \
|
|
|
|
misc/e2fsprogs-libuuid \
|
2016-10-18 09:33:09 +00:00
|
|
|
misc/getopt \
|
2017-07-07 08:13:35 +00:00
|
|
|
net/socat \
|
2016-03-24 11:48:20 +00:00
|
|
|
textproc/expat2 \
|
2017-03-09 12:42:34 +00:00
|
|
|
textproc/gsed \
|
2018-09-06 09:10:32 +00:00
|
|
|
lang/gawk \
|
2016-03-24 11:48:20 +00:00
|
|
|
textproc/libxml2 \
|
|
|
|
textproc/xmlstarlet \
|
2017-07-24 16:20:19 +00:00
|
|
|
textproc/jq \
|
|
|
|
textproc/py-sphinx \
|
2016-03-24 11:48:20 +00:00
|
|
|
emulators/fuse \
|
|
|
|
java/junit \
|
2017-07-24 16:20:19 +00:00
|
|
|
lang/python \
|
2016-03-24 11:48:20 +00:00
|
|
|
lang/python27 \
|
2018-11-25 14:06:07 +00:00
|
|
|
lang/python36 \
|
2017-07-24 16:20:19 +00:00
|
|
|
devel/py-pip \
|
2018-11-25 14:06:07 +00:00
|
|
|
devel/py-flake8 \
|
2016-03-24 11:48:20 +00:00
|
|
|
devel/py-argparse \
|
|
|
|
devel/py-nose \
|
2017-07-24 16:20:19 +00:00
|
|
|
devel/py-prettytable \
|
2018-11-25 14:06:07 +00:00
|
|
|
www/py-routes \
|
2016-03-24 11:48:20 +00:00
|
|
|
www/py-flask \
|
2018-11-25 14:06:07 +00:00
|
|
|
www/node \
|
|
|
|
www/npm \
|
2016-03-24 11:48:20 +00:00
|
|
|
www/fcgi \
|
2018-12-23 20:24:45 +00:00
|
|
|
security/nss \
|
2019-05-28 18:05:16 +00:00
|
|
|
security/krb5 \
|
2018-11-25 14:06:07 +00:00
|
|
|
security/oath-toolkit \
|
2016-03-24 11:48:20 +00:00
|
|
|
sysutils/flock \
|
2017-04-02 00:08:51 +00:00
|
|
|
sysutils/fusefs-libs \
|
2016-03-24 11:48:20 +00:00
|
|
|
|
2017-06-10 10:12:23 +00:00
|
|
|
# Now use pip to install some extra python modules
|
|
|
|
pip install pecan
|
|
|
|
|
2016-03-24 11:48:20 +00:00
|
|
|
exit
|
2016-06-29 07:40:07 +00:00
|
|
|
else
|
2019-02-13 12:25:21 +00:00
|
|
|
for_make_check=false
|
|
|
|
if tty -s; then
|
|
|
|
# interactive
|
|
|
|
for_make_check=true
|
|
|
|
elif [ $FOR_MAKE_CHECK ]; then
|
|
|
|
for_make_check=true
|
|
|
|
else
|
|
|
|
for_make_check=false
|
|
|
|
fi
|
2019-06-06 03:10:41 +00:00
|
|
|
[ $WITH_SEASTAR ] && with_seastar=true || with_seastar=false
|
2016-09-05 13:40:33 +00:00
|
|
|
source /etc/os-release
|
|
|
|
case $ID in
|
2016-06-29 07:40:07 +00:00
|
|
|
debian|ubuntu|devuan)
|
|
|
|
echo "Using apt-get to install dependencies"
|
2018-08-01 10:52:45 +00:00
|
|
|
$SUDO apt-get install -y devscripts equivs
|
2017-11-12 05:07:35 +00:00
|
|
|
$SUDO apt-get install -y dpkg-dev
|
|
|
|
case "$VERSION" in
|
2018-08-01 10:52:45 +00:00
|
|
|
*Trusty*)
|
2019-05-14 14:37:00 +00:00
|
|
|
ensure_decent_gcc_on_ubuntu 8 trusty
|
2018-08-01 10:52:45 +00:00
|
|
|
;;
|
|
|
|
*Xenial*)
|
2019-05-14 14:37:00 +00:00
|
|
|
ensure_decent_gcc_on_ubuntu 8 xenial
|
2019-04-24 01:14:51 +00:00
|
|
|
[ ! $NO_BOOST_PKGS ] && install_boost_on_ubuntu xenial
|
2018-11-20 04:43:34 +00:00
|
|
|
;;
|
|
|
|
*Bionic*)
|
2019-06-07 16:08:37 +00:00
|
|
|
ensure_decent_gcc_on_ubuntu 9 bionic
|
2019-04-24 01:14:51 +00:00
|
|
|
[ ! $NO_BOOST_PKGS ] && install_boost_on_ubuntu bionic
|
2017-11-12 05:07:35 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
$SUDO apt-get install -y gcc
|
|
|
|
;;
|
|
|
|
esac
|
2015-02-05 13:46:41 +00:00
|
|
|
if ! test -r debian/control ; then
|
|
|
|
echo debian/control is not a readable file
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-11-25 16:25:26 +00:00
|
|
|
touch $DIR/status
|
2016-03-24 00:43:53 +00:00
|
|
|
|
|
|
|
backports=""
|
2019-06-06 03:10:41 +00:00
|
|
|
control=$(munge_debian_control "$VERSION" "$with_seastar" "$for_make_check" "debian/control")
|
2018-08-01 10:52:45 +00:00
|
|
|
case "$VERSION" in
|
|
|
|
*squeeze*|*wheezy*)
|
|
|
|
backports="-t $codename-backports"
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
|
|
|
esac
|
2016-03-24 00:43:53 +00:00
|
|
|
|
|
|
|
# make a metapackage that expresses the build dependencies,
|
|
|
|
# install it, rm the .deb; then uninstall the package as its
|
|
|
|
# work is done
|
|
|
|
$SUDO env DEBIAN_FRONTEND=noninteractive mk-build-deps --install --remove --tool="apt-get -y --no-install-recommends $backports" $control || exit 1
|
|
|
|
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get -y remove ceph-build-deps
|
2019-02-13 11:56:00 +00:00
|
|
|
if [ "$control" != "debian/control" ] ; then rm $control; fi
|
2018-11-13 07:27:08 +00:00
|
|
|
$SUDO apt-get install -y libxmlsec1 libxmlsec1-nss libxmlsec1-openssl libxmlsec1-dev
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
2017-04-03 13:35:49 +00:00
|
|
|
centos|fedora|rhel|ol|virtuozzo)
|
2016-09-16 04:29:15 +00:00
|
|
|
yumdnf="yum"
|
2018-12-19 08:37:55 +00:00
|
|
|
builddepcmd="yum-builddep -y --setopt=*.skip_if_unavailable=true"
|
2016-09-16 04:29:15 +00:00
|
|
|
if test "$(echo "$VERSION_ID >= 22" | bc)" -ne 0; then
|
|
|
|
yumdnf="dnf"
|
|
|
|
builddepcmd="dnf -y builddep --allowerasing"
|
|
|
|
fi
|
|
|
|
echo "Using $yumdnf to install dependencies"
|
2018-08-01 10:52:45 +00:00
|
|
|
if [ "$ID" = "centos" -a $(uname -m) = aarch64 ]; then
|
2017-12-08 10:07:37 +00:00
|
|
|
$SUDO yum-config-manager --disable centos-sclo-sclo || true
|
|
|
|
$SUDO yum-config-manager --disable centos-sclo-rh || true
|
|
|
|
$SUDO yum remove centos-release-scl || true
|
|
|
|
fi
|
2018-08-01 10:52:45 +00:00
|
|
|
case $ID in
|
|
|
|
fedora)
|
2016-09-16 04:29:15 +00:00
|
|
|
if test $yumdnf = yum; then
|
|
|
|
$SUDO $yumdnf install -y yum-utils
|
|
|
|
fi
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
2018-08-01 10:52:45 +00:00
|
|
|
centos|rhel|ol|virtuozzo)
|
2019-02-01 00:36:17 +00:00
|
|
|
MAJOR_VERSION="$(echo $VERSION_ID | cut -d. -f1)"
|
2015-03-04 12:47:37 +00:00
|
|
|
$SUDO yum install -y yum-utils
|
2018-08-01 10:52:45 +00:00
|
|
|
if test $ID = rhel ; then
|
2019-02-01 00:36:17 +00:00
|
|
|
$SUDO yum-config-manager --enable rhel-$MAJOR_VERSION-server-optional-rpms
|
2015-03-04 12:47:37 +00:00
|
|
|
fi
|
2019-02-01 00:36:17 +00:00
|
|
|
$SUDO yum-config-manager --add-repo https://dl.fedoraproject.org/pub/epel/$MAJOR_VERSION/x86_64/
|
2015-03-04 12:47:37 +00:00
|
|
|
$SUDO yum install --nogpgcheck -y epel-release
|
2019-02-01 00:36:17 +00:00
|
|
|
$SUDO rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$MAJOR_VERSION
|
2015-03-04 12:47:37 +00:00
|
|
|
$SUDO rm -f /etc/yum.repos.d/dl.fedoraproject.org*
|
2019-02-01 00:36:17 +00:00
|
|
|
if test $ID = centos -a $MAJOR_VERSION = 7 ; then
|
2017-12-05 15:22:17 +00:00
|
|
|
case $(uname -m) in
|
|
|
|
x86_64)
|
2017-12-08 10:07:37 +00:00
|
|
|
$SUDO yum -y install centos-release-scl
|
2019-03-22 17:16:23 +00:00
|
|
|
dts_ver=8
|
2017-12-08 08:34:59 +00:00
|
|
|
;;
|
2017-12-05 15:22:17 +00:00
|
|
|
aarch64)
|
2017-12-08 10:07:37 +00:00
|
|
|
$SUDO yum -y install centos-release-scl-rh
|
|
|
|
$SUDO yum-config-manager --disable centos-sclo-rh
|
|
|
|
$SUDO yum-config-manager --enable centos-sclo-rh-testing
|
2019-04-03 03:08:04 +00:00
|
|
|
dts_ver=8
|
2017-12-08 08:34:59 +00:00
|
|
|
;;
|
2017-12-05 15:22:17 +00:00
|
|
|
esac
|
2018-08-01 10:52:45 +00:00
|
|
|
elif test $ID = rhel -a $MAJOR_VERSION = 7 ; then
|
2019-03-22 17:16:23 +00:00
|
|
|
$SUDO yum-config-manager \
|
|
|
|
--enable rhel-server-rhscl-7-rpms \
|
|
|
|
--enable rhel-7-server-devtools-rpms
|
|
|
|
dts_ver=8
|
2017-04-03 13:35:49 +00:00
|
|
|
fi
|
2015-03-04 12:47:37 +00:00
|
|
|
;;
|
2014-11-25 16:25:26 +00:00
|
|
|
esac
|
2019-06-06 03:10:41 +00:00
|
|
|
munge_ceph_spec_in $with_seastar $for_make_check $DIR/ceph.spec
|
2019-04-11 16:11:42 +00:00
|
|
|
$SUDO $yumdnf install -y \*rpm-macros
|
2016-09-16 04:29:15 +00:00
|
|
|
$SUDO $builddepcmd $DIR/ceph.spec 2>&1 | tee $DIR/yum-builddep.out
|
2018-06-24 01:48:50 +00:00
|
|
|
[ ${PIPESTATUS[0]} -ne 0 ] && exit 1
|
2018-03-09 09:46:27 +00:00
|
|
|
if [ -n "$dts_ver" ]; then
|
2017-12-08 08:34:59 +00:00
|
|
|
ensure_decent_gcc_on_rh $dts_ver
|
|
|
|
fi
|
2015-06-06 10:28:03 +00:00
|
|
|
! grep -q -i error: $DIR/yum-builddep.out || exit 1
|
2018-11-13 07:27:08 +00:00
|
|
|
# for building python-saml and its dependencies
|
|
|
|
$SUDO $yumdnf install -y xmlsec1 xmlsec1-nss xmlsec1-openssl xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
2018-07-02 13:23:58 +00:00
|
|
|
opensuse*|suse|sles)
|
2016-06-29 07:40:07 +00:00
|
|
|
echo "Using zypper to install dependencies"
|
2018-02-14 10:49:03 +00:00
|
|
|
zypp_install="zypper --gpg-auto-import-keys --non-interactive install --no-recommends"
|
2018-08-01 10:52:45 +00:00
|
|
|
$SUDO $zypp_install systemd-rpm-macros
|
2019-06-06 03:10:41 +00:00
|
|
|
munge_ceph_spec_in $with_seastar $for_make_check $DIR/ceph.spec
|
2018-02-14 10:49:03 +00:00
|
|
|
$SUDO $zypp_install $(rpmspec -q --buildrequires $DIR/ceph.spec) || exit 1
|
2018-06-11 09:29:08 +00:00
|
|
|
$SUDO $zypp_install libxmlsec1-1 libxmlsec1-nss1 libxmlsec1-openssl1 xmlsec1-devel xmlsec1-openssl-devel
|
2015-03-23 20:28:20 +00:00
|
|
|
;;
|
2016-12-21 01:24:31 +00:00
|
|
|
alpine)
|
|
|
|
# for now we need the testing repo for leveldb
|
|
|
|
TESTREPO="http://nl.alpinelinux.org/alpine/edge/testing"
|
|
|
|
if ! grep -qF "$TESTREPO" /etc/apk/repositories ; then
|
|
|
|
$SUDO echo "$TESTREPO" | sudo tee -a /etc/apk/repositories > /dev/null
|
|
|
|
fi
|
|
|
|
source alpine/APKBUILD.in
|
|
|
|
$SUDO apk --update add abuild build-base ccache $makedepends
|
|
|
|
if id -u build >/dev/null 2>&1 ; then
|
|
|
|
$SUDO addgroup build abuild
|
|
|
|
fi
|
|
|
|
;;
|
2016-06-29 07:40:07 +00:00
|
|
|
*)
|
2016-09-05 13:40:33 +00:00
|
|
|
echo "$ID is unknown, dependencies will have to be installed manually."
|
2016-08-31 21:29:30 +00:00
|
|
|
exit 1
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
2016-06-29 07:40:07 +00:00
|
|
|
esac
|
|
|
|
fi
|
2015-05-02 13:59:12 +00:00
|
|
|
|
2015-06-04 08:00:45 +00:00
|
|
|
function populate_wheelhouse() {
|
2015-05-28 23:34:45 +00:00
|
|
|
local install=$1
|
2015-06-04 03:45:55 +00:00
|
|
|
shift
|
2015-05-28 23:34:45 +00:00
|
|
|
|
|
|
|
# although pip comes with virtualenv, having a recent version
|
|
|
|
# of pip matters when it comes to using wheel packages
|
2019-01-26 17:20:53 +00:00
|
|
|
pip --timeout 300 $install 'setuptools >= 0.8' 'pip >= 7.0' 'wheel >= 0.24' || return 1
|
2015-06-04 03:45:55 +00:00
|
|
|
if test $# != 0 ; then
|
|
|
|
pip --timeout 300 $install $@ || return 1
|
|
|
|
fi
|
2015-05-28 23:34:45 +00:00
|
|
|
}
|
|
|
|
|
2015-06-04 05:44:00 +00:00
|
|
|
function activate_virtualenv() {
|
|
|
|
local top_srcdir=$1
|
|
|
|
local interpreter=$2
|
|
|
|
local env_dir=$top_srcdir/install-deps-$interpreter
|
|
|
|
|
|
|
|
if ! test -d $env_dir ; then
|
2016-07-13 22:06:51 +00:00
|
|
|
# Make a temporary virtualenv to get a fresh version of virtualenv
|
|
|
|
# because CentOS 7 has a buggy old version (v1.10.1)
|
|
|
|
# https://github.com/pypa/virtualenv/issues/463
|
|
|
|
virtualenv ${env_dir}_tmp
|
2018-11-10 21:33:43 +00:00
|
|
|
# install setuptools before upgrading virtualenv, as the latter needs
|
|
|
|
# a recent setuptools for setup commands like `extras_require`.
|
|
|
|
${env_dir}_tmp/bin/pip install --upgrade setuptools
|
2016-07-13 22:06:51 +00:00
|
|
|
${env_dir}_tmp/bin/pip install --upgrade virtualenv
|
|
|
|
${env_dir}_tmp/bin/virtualenv --python $interpreter $env_dir
|
|
|
|
rm -rf ${env_dir}_tmp
|
|
|
|
|
2015-06-04 05:44:00 +00:00
|
|
|
. $env_dir/bin/activate
|
2015-06-04 08:00:45 +00:00
|
|
|
if ! populate_wheelhouse install ; then
|
2015-06-04 05:44:00 +00:00
|
|
|
rm -rf $env_dir
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
. $env_dir/bin/activate
|
|
|
|
}
|
|
|
|
|
2015-05-30 08:53:51 +00:00
|
|
|
# use pip cache if possible but do not store it outside of the source
|
|
|
|
# tree
|
|
|
|
# see https://pip.pypa.io/en/stable/reference/pip_install.html#caching
|
|
|
|
mkdir -p install-deps-cache
|
|
|
|
top_srcdir=$(pwd)
|
|
|
|
export XDG_CACHE_HOME=$top_srcdir/install-deps-cache
|
2015-06-04 03:53:55 +00:00
|
|
|
wip_wheelhouse=wheelhouse-wip
|
2015-05-30 08:53:51 +00:00
|
|
|
|
2015-05-02 13:59:12 +00:00
|
|
|
#
|
|
|
|
# preload python modules so that tox can run without network access
|
|
|
|
#
|
2015-05-08 18:53:54 +00:00
|
|
|
find . -name tox.ini | while read ini ; do
|
|
|
|
(
|
|
|
|
cd $(dirname $ini)
|
|
|
|
require=$(ls *requirements.txt 2>/dev/null | sed -e 's/^/-r /')
|
2018-05-16 11:41:52 +00:00
|
|
|
md5=wheelhouse/md5
|
|
|
|
if test "$require"; then
|
|
|
|
if ! test -f $md5 || ! md5sum -c $md5 ; then
|
|
|
|
rm -rf wheelhouse
|
|
|
|
fi
|
|
|
|
fi
|
2015-05-08 18:53:54 +00:00
|
|
|
if test "$require" && ! test -d wheelhouse ; then
|
2015-09-18 10:59:09 +00:00
|
|
|
for interpreter in python2.7 python3 ; do
|
2015-05-08 18:53:54 +00:00
|
|
|
type $interpreter > /dev/null 2>&1 || continue
|
2015-06-04 05:44:00 +00:00
|
|
|
activate_virtualenv $top_srcdir $interpreter || exit 1
|
2015-06-04 08:00:45 +00:00
|
|
|
populate_wheelhouse "wheel -w $wip_wheelhouse" $require || exit 1
|
2015-05-08 18:53:54 +00:00
|
|
|
done
|
2015-06-04 03:53:55 +00:00
|
|
|
mv $wip_wheelhouse wheelhouse
|
2018-05-16 11:41:52 +00:00
|
|
|
md5sum *requirements.txt > $md5
|
2015-05-08 18:53:54 +00:00
|
|
|
fi
|
|
|
|
)
|
2015-05-02 13:59:12 +00:00
|
|
|
done
|
2015-06-03 14:05:28 +00:00
|
|
|
|
2015-09-18 10:59:09 +00:00
|
|
|
for interpreter in python2.7 python3 ; do
|
2015-06-03 14:05:28 +00:00
|
|
|
rm -rf $top_srcdir/install-deps-$interpreter
|
|
|
|
done
|
|
|
|
rm -rf $XDG_CACHE_HOME
|
2018-10-10 12:21:04 +00:00
|
|
|
git --version || (echo "Dashboard uses git to pull dependencies." ; false)
|