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