3 # Ceph distributed storage system
5 # Copyright (C) 2014, 2015 Red Hat <contact@redhat.com>
7 # Author: Loic Dachary <loic@dachary.org>
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
14 DIR
=/tmp
/install-deps.$$
15 trap "rm -fr $DIR" EXIT
17 if test $
(id
-u) != 0 ; then
20 export LC_ALL
=C
# the following is vulnerable to i18n
22 if [ x
`uname`x
= xFreeBSDx
]; then
23 $SUDO pkg
install -yq \
29 devel
/boost-python-libs \
35 devel
/google-perftools \
39 net
/openldap24-client \
44 misc
/e2fsprogs-libuuid \
60 sysutils
/fusefs-libs \
64 source /etc
/os-release
67 echo "Using apt-get to install dependencies"
68 $SUDO apt-get
install -y lsb-release devscripts equivs
69 $SUDO apt-get
install -y dpkg-dev gcc
70 if ! test -r debian
/control
; then
71 echo debian
/control is not a readable
file
77 control
="debian/control"
78 case $
(lsb_release
-sc) in
80 control
="/tmp/control.$$"
81 grep -v babeltrace debian
/control
> $control
82 backports
="-t $(lsb_release -sc)-backports"
86 # make a metapackage that expresses the build dependencies,
87 # install it, rm the .deb; then uninstall the package as its
89 $SUDO env DEBIAN_FRONTEND
=noninteractive mk-build-deps
--install --remove --tool="apt-get -y --no-install-recommends $backports" $control ||
exit 1
90 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get
-y remove ceph-build-deps
91 if [ -n "$backports" ] ; then rm $control; fi
93 centos|fedora|rhel|ol|virtuozzo
)
95 builddepcmd
="yum-builddep -y"
96 if test "$(echo "$VERSION_ID >= 22" | bc)" -ne 0; then
98 builddepcmd
="dnf -y builddep --allowerasing"
100 echo "Using $yumdnf to install dependencies"
101 $SUDO $yumdnf install -y redhat-lsb-core
102 case $
(lsb_release
-si) in
104 if test $yumdnf = yum
; then
105 $SUDO $yumdnf install -y yum-utils
108 CentOS|RedHatEnterpriseServer|VirtuozzoLinux
)
109 $SUDO yum
install -y yum-utils
110 MAJOR_VERSION
=$
(lsb_release
-rs | cut
-f1 -d.
)
111 if test $
(lsb_release
-si) = RedHatEnterpriseServer
; then
112 $SUDO yum
install subscription-manager
113 $SUDO subscription-manager repos
--enable=rhel-
$MAJOR_VERSION-server-optional-rpms
115 $SUDO yum-config-manager
--add-repo https
://dl.fedoraproject.org
/pub
/epel
/$MAJOR_VERSION/x86_64
/
116 $SUDO yum
install --nogpgcheck -y epel-release
117 $SUDO rpm
--import /etc
/pki
/rpm-gpg
/RPM-GPG-KEY-EPEL-
$MAJOR_VERSION
118 $SUDO rm -f /etc
/yum.repos.d
/dl.fedoraproject.org
*
119 if test $
(lsb_release
-si) = CentOS
-a $MAJOR_VERSION = 7 ; then
120 $SUDO yum-config-manager
--enable cr
122 if test $
(lsb_release
-si) = VirtuozzoLinux
-a $MAJOR_VERSION = 7 ; then
123 $SUDO yum-config-manager
--enable cr
127 sed -e 's/@//g' < ceph.spec.
in > $DIR/ceph.spec
128 $SUDO $builddepcmd $DIR/ceph.spec
2>&1 |
tee $DIR/yum-builddep.out
129 ! grep -q -i error
: $DIR/yum-builddep.out ||
exit 1
132 echo "Using zypper to install dependencies"
133 $SUDO zypper
--gpg-auto-import-keys --non-interactive install lsb-release systemd-rpm-macros
134 sed -e 's/@//g' < ceph.spec.
in > $DIR/ceph.spec
135 $SUDO zypper
--non-interactive install $
(rpmspec
-q --buildrequires $DIR/ceph.spec
) ||
exit 1
138 # for now we need the testing repo for leveldb
139 TESTREPO
="http://nl.alpinelinux.org/alpine/edge/testing"
140 if ! grep -qF "$TESTREPO" /etc
/apk
/repositories
; then
141 $SUDO echo "$TESTREPO" | sudo
tee -a /etc
/apk
/repositories
> /dev
/null
143 source alpine
/APKBUILD.
in
144 $SUDO apk
--update add abuild build-base ccache
$makedepends
145 if id
-u build
>/dev
/null
2>&1 ; then
146 $SUDO addgroup build abuild
150 echo "$ID is unknown, dependencies will have to be installed manually."
156 function populate_wheelhouse
() {
160 # although pip comes with virtualenv, having a recent version
161 # of pip matters when it comes to using wheel packages
162 pip
--timeout 300 $install 'setuptools >= 0.8' 'pip >= 7.0' 'wheel >= 0.24' ||
return 1
163 if test $# != 0 ; then
164 pip
--timeout 300 $install $@ ||
return 1
168 function activate_virtualenv
() {
171 local env_dir
=$top_srcdir/install-deps-
$interpreter
173 if ! test -d $env_dir ; then
174 # Make a temporary virtualenv to get a fresh version of virtualenv
175 # because CentOS 7 has a buggy old version (v1.10.1)
176 # https://github.com/pypa/virtualenv/issues/463
177 virtualenv
${env_dir}_tmp
178 ${env_dir}_tmp
/bin
/pip
install --upgrade virtualenv
179 ${env_dir}_tmp
/bin
/virtualenv
--python $interpreter $env_dir
180 rm -rf ${env_dir}_tmp
182 .
$env_dir/bin
/activate
183 if ! populate_wheelhouse
install ; then
188 .
$env_dir/bin
/activate
191 # use pip cache if possible but do not store it outside of the source
193 # see https://pip.pypa.io/en/stable/reference/pip_install.html#caching
194 mkdir
-p install-deps-cache
196 export XDG_CACHE_HOME
=$top_srcdir/install-deps-cache
197 wip_wheelhouse
=wheelhouse-wip
200 # preload python modules so that tox can run without network access
202 find .
-name tox.ini |
while read ini
; do
205 require
=$
(ls *requirements.txt
2>/dev
/null |
sed -e 's/^/-r /')
206 if test "$require" && ! test -d wheelhouse
; then
207 for interpreter
in python2.7 python3
; do
208 type $interpreter > /dev
/null
2>&1 ||
continue
209 activate_virtualenv
$top_srcdir $interpreter ||
exit 1
210 populate_wheelhouse
"wheel -w $wip_wheelhouse" $require ||
exit 1
212 mv $wip_wheelhouse wheelhouse
217 for interpreter
in python2.7 python3
; do
218 rm -rf $top_srcdir/install-deps-
$interpreter
220 rm -rf $XDG_CACHE_HOME