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 \
30 devel
/boost-python-libs \
35 devel
/google-perftools \
39 net
/openldap24-client \
44 misc
/e2fsprogs-libuuid \
61 sysutils
/fusefs-libs \
63 # Now use pip to install some extra python modules
68 source /etc
/os-release
71 echo "Using apt-get to install dependencies"
72 $SUDO apt-get
install -y lsb-release devscripts equivs
73 $SUDO apt-get
install -y dpkg-dev gcc
74 if ! test -r debian
/control
; then
75 echo debian
/control is not a readable
file
81 control
="debian/control"
82 case $
(lsb_release
-sc) in
84 control
="/tmp/control.$$"
85 grep -v babeltrace debian
/control
> $control
86 backports
="-t $(lsb_release -sc)-backports"
90 # make a metapackage that expresses the build dependencies,
91 # install it, rm the .deb; then uninstall the package as its
93 $SUDO env DEBIAN_FRONTEND
=noninteractive mk-build-deps
--install --remove --tool="apt-get -y --no-install-recommends $backports" $control ||
exit 1
94 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get
-y remove ceph-build-deps
95 if [ -n "$backports" ] ; then rm $control; fi
97 centos|fedora|rhel|ol|virtuozzo
)
99 builddepcmd
="yum-builddep -y"
100 if test "$(echo "$VERSION_ID >= 22" | bc)" -ne 0; then
102 builddepcmd
="dnf -y builddep --allowerasing"
104 echo "Using $yumdnf to install dependencies"
105 $SUDO $yumdnf install -y redhat-lsb-core
106 case $
(lsb_release
-si) in
108 if test $yumdnf = yum
; then
109 $SUDO $yumdnf install -y yum-utils
112 CentOS|RedHatEnterpriseServer|VirtuozzoLinux
)
113 $SUDO yum
install -y yum-utils
114 MAJOR_VERSION
=$
(lsb_release
-rs | cut
-f1 -d.
)
115 if test $
(lsb_release
-si) = RedHatEnterpriseServer
; then
116 $SUDO yum
install subscription-manager
117 $SUDO subscription-manager repos
--enable=rhel-
$MAJOR_VERSION-server-optional-rpms
119 $SUDO yum-config-manager
--add-repo https
://dl.fedoraproject.org
/pub
/epel
/$MAJOR_VERSION/x86_64
/
120 $SUDO yum
install --nogpgcheck -y epel-release
121 $SUDO rpm
--import /etc
/pki
/rpm-gpg
/RPM-GPG-KEY-EPEL-
$MAJOR_VERSION
122 $SUDO rm -f /etc
/yum.repos.d
/dl.fedoraproject.org
*
123 if test $
(lsb_release
-si) = CentOS
-a $MAJOR_VERSION = 7 ; then
124 $SUDO yum-config-manager
--enable cr
126 if test $
(lsb_release
-si) = VirtuozzoLinux
-a $MAJOR_VERSION = 7 ; then
127 $SUDO yum-config-manager
--enable cr
131 sed -e 's/@//g' < ceph.spec.
in > $DIR/ceph.spec
132 $SUDO $builddepcmd $DIR/ceph.spec
2>&1 |
tee $DIR/yum-builddep.out
133 ! grep -q -i error
: $DIR/yum-builddep.out ||
exit 1
136 echo "Using zypper to install dependencies"
137 $SUDO zypper
--gpg-auto-import-keys --non-interactive install lsb-release systemd-rpm-macros
138 sed -e 's/@//g' < ceph.spec.
in > $DIR/ceph.spec
139 $SUDO zypper
--non-interactive install $
(rpmspec
-q --buildrequires $DIR/ceph.spec
) ||
exit 1
142 # for now we need the testing repo for leveldb
143 TESTREPO
="http://nl.alpinelinux.org/alpine/edge/testing"
144 if ! grep -qF "$TESTREPO" /etc
/apk
/repositories
; then
145 $SUDO echo "$TESTREPO" | sudo
tee -a /etc
/apk
/repositories
> /dev
/null
147 source alpine
/APKBUILD.
in
148 $SUDO apk
--update add abuild build-base ccache
$makedepends
149 if id
-u build
>/dev
/null
2>&1 ; then
150 $SUDO addgroup build abuild
154 echo "$ID is unknown, dependencies will have to be installed manually."
160 function populate_wheelhouse
() {
164 # although pip comes with virtualenv, having a recent version
165 # of pip matters when it comes to using wheel packages
166 # workaround of https://github.com/pypa/setuptools/issues/1042
167 pip
--timeout 300 $install 'setuptools >= 0.8,< 36' 'pip >= 7.0' 'wheel >= 0.24' ||
return 1
168 if test $# != 0 ; then
169 pip
--timeout 300 $install $@ ||
return 1
173 function activate_virtualenv
() {
176 local env_dir
=$top_srcdir/install-deps-
$interpreter
178 if ! test -d $env_dir ; then
179 # Make a temporary virtualenv to get a fresh version of virtualenv
180 # because CentOS 7 has a buggy old version (v1.10.1)
181 # https://github.com/pypa/virtualenv/issues/463
182 virtualenv
${env_dir}_tmp
183 ${env_dir}_tmp
/bin
/pip
install --upgrade virtualenv
184 ${env_dir}_tmp
/bin
/virtualenv
--python $interpreter $env_dir
185 rm -rf ${env_dir}_tmp
187 .
$env_dir/bin
/activate
188 if ! populate_wheelhouse
install ; then
193 .
$env_dir/bin
/activate
196 # use pip cache if possible but do not store it outside of the source
198 # see https://pip.pypa.io/en/stable/reference/pip_install.html#caching
199 mkdir
-p install-deps-cache
201 export XDG_CACHE_HOME
=$top_srcdir/install-deps-cache
202 wip_wheelhouse
=wheelhouse-wip
205 # preload python modules so that tox can run without network access
207 find .
-name tox.ini |
while read ini
; do
210 require
=$
(ls *requirements.txt
2>/dev
/null |
sed -e 's/^/-r /')
211 if test "$require" && ! test -d wheelhouse
; then
212 for interpreter
in python2.7 python3
; do
213 type $interpreter > /dev
/null
2>&1 ||
continue
214 activate_virtualenv
$top_srcdir $interpreter ||
exit 1
215 populate_wheelhouse
"wheel -w $wip_wheelhouse" $require ||
exit 1
217 mv $wip_wheelhouse wheelhouse
222 for interpreter
in python2.7 python3
; do
223 rm -rf $top_srcdir/install-deps-
$interpreter
225 rm -rf $XDG_CACHE_HOME