2015-05-08 07:19:44 +00:00
|
|
|
#!/bin/bash -e
|
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.
|
|
|
|
#
|
|
|
|
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
|
|
|
|
|
|
|
if test -f /etc/redhat-release ; then
|
|
|
|
$SUDO yum install -y redhat-lsb-core
|
|
|
|
fi
|
|
|
|
|
2015-03-23 20:28:20 +00:00
|
|
|
if type apt-get > /dev/null 2>&1 ; then
|
2015-02-03 16:18:09 +00:00
|
|
|
$SUDO apt-get install -y lsb-release
|
|
|
|
fi
|
|
|
|
|
2015-03-23 20:28:20 +00:00
|
|
|
if type zypper > /dev/null 2>&1 ; then
|
|
|
|
$SUDO zypper --gpg-auto-import-keys --non-interactive install openSUSE-release lsb-release
|
|
|
|
fi
|
|
|
|
|
2014-11-25 16:25:26 +00:00
|
|
|
case $(lsb_release -si) in
|
|
|
|
Ubuntu|Debian|Devuan)
|
2014-12-20 17:57:59 +00:00
|
|
|
$SUDO apt-get install -y dpkg-dev
|
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
|
|
|
|
packages=$(dpkg-checkbuilddeps --admindir=$DIR debian/control 2>&1 | \
|
|
|
|
perl -p -e 's/.*Unmet build dependencies: *//;' \
|
|
|
|
-e 's/build-essential:native/build-essential/;' \
|
2015-03-05 10:38:18 +00:00
|
|
|
-e 's/\|//g;' \
|
2014-11-25 16:25:26 +00:00
|
|
|
-e 's/\(.*?\)//g;' \
|
|
|
|
-e 's/ +/\n/g;' | sort)
|
|
|
|
case $(lsb_release -sc) in
|
2015-02-03 16:40:41 +00:00
|
|
|
squeeze|wheezy)
|
|
|
|
packages=$(echo $packages | perl -pe 's/[-\w]*babeltrace[-\w]*//g')
|
2015-04-10 07:26:14 +00:00
|
|
|
backports="-t $(lsb_release -sc)-backports"
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
|
|
|
esac
|
2015-03-05 11:17:26 +00:00
|
|
|
packages=$(echo $packages) # change newlines into spaces
|
2015-05-08 07:19:44 +00:00
|
|
|
$SUDO bash -c "DEBIAN_FRONTEND=noninteractive apt-get install $backports -y $packages" || exit 1
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
2015-03-23 20:28:20 +00:00
|
|
|
CentOS|Fedora|RedHatEnterpriseServer)
|
2014-11-25 16:25:26 +00:00
|
|
|
case $(lsb_release -si) in
|
2015-03-04 12:47:37 +00:00
|
|
|
Fedora)
|
2014-12-20 17:57:59 +00:00
|
|
|
$SUDO yum install -y yum-utils
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
2015-03-04 12:47:37 +00:00
|
|
|
CentOS|RedHatEnterpriseServer)
|
|
|
|
$SUDO yum install -y yum-utils
|
|
|
|
MAJOR_VERSION=$(lsb_release -rs | cut -f1 -d.)
|
|
|
|
if test $(lsb_release -si) == RedHatEnterpriseServer ; then
|
|
|
|
$SUDO yum install subscription-manager
|
|
|
|
$SUDO subscription-manager repos --enable=rhel-$MAJOR_VERSION-server-optional-rpms
|
|
|
|
fi
|
|
|
|
$SUDO yum-config-manager --add-repo https://dl.fedoraproject.org/pub/epel/$MAJOR_VERSION/x86_64/
|
|
|
|
$SUDO yum install --nogpgcheck -y epel-release
|
|
|
|
$SUDO rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$MAJOR_VERSION
|
|
|
|
$SUDO rm -f /etc/yum.repos.d/dl.fedoraproject.org*
|
|
|
|
;;
|
2014-11-25 16:25:26 +00:00
|
|
|
esac
|
|
|
|
sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
|
2015-05-08 07:19:44 +00:00
|
|
|
$SUDO yum-builddep -y $DIR/ceph.spec || exit 1
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
2015-03-23 20:28:20 +00:00
|
|
|
*SUSE*)
|
|
|
|
sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
|
2015-05-08 07:19:44 +00:00
|
|
|
$SUDO zypper --non-interactive install $(rpmspec -q --buildrequires $DIR/ceph.spec) || exit 1
|
2015-03-23 20:28:20 +00:00
|
|
|
;;
|
2014-11-25 16:25:26 +00:00
|
|
|
*)
|
|
|
|
echo "$(lsb_release -si) is unknown, dependencies will have to be installed manually."
|
|
|
|
;;
|
|
|
|
esac
|
2015-05-02 13:59:12 +00:00
|
|
|
|
2015-05-28 23:34:45 +00:00
|
|
|
function get_pip_and_wheel() {
|
|
|
|
local install=$1
|
|
|
|
|
|
|
|
# Ubuntu-12.04 and Python 2.7.3 require this line
|
|
|
|
pip --timeout 300 $install 'distribute >= 0.7.3' || return 1
|
|
|
|
# although pip comes with virtualenv, having a recent version
|
|
|
|
# of pip matters when it comes to using wheel packages
|
|
|
|
pip --timeout 300 $install 'setuptools >= 0.8' 'pip >= 7.0' 'wheel >= 0.24' || return 1
|
|
|
|
}
|
|
|
|
|
2015-05-02 13:59:12 +00:00
|
|
|
#
|
|
|
|
# preload python modules so that tox can run without network access
|
|
|
|
#
|
|
|
|
for interpreter in python2.7 python3 ; do
|
|
|
|
type $interpreter > /dev/null 2>&1 || continue
|
2015-05-08 18:53:54 +00:00
|
|
|
if ! test -d install-deps-$interpreter ; then
|
|
|
|
virtualenv --python $interpreter install-deps-$interpreter
|
|
|
|
. install-deps-$interpreter/bin/activate
|
2015-05-28 23:34:45 +00:00
|
|
|
get_pip_and_wheel install || exit 1
|
2015-05-08 18:53:54 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
find . -name tox.ini | while read ini ; do
|
|
|
|
top_srcdir=$(pwd)
|
|
|
|
(
|
|
|
|
cd $(dirname $ini)
|
|
|
|
require=$(ls *requirements.txt 2>/dev/null | sed -e 's/^/-r /')
|
|
|
|
if test "$require" && ! test -d wheelhouse ; then
|
|
|
|
for interpreter in python2.7 python3 ; do
|
|
|
|
type $interpreter > /dev/null 2>&1 || continue
|
|
|
|
. $top_srcdir/install-deps-$interpreter/bin/activate
|
2015-05-28 23:34:45 +00:00
|
|
|
get_pip_and_wheel wheel || exit 1
|
|
|
|
pip --timeout 300 wheel $require || exit 1
|
2015-05-08 18:53:54 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
)
|
2015-05-02 13:59:12 +00:00
|
|
|
done
|