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.
15 DIR
=/tmp
/install-deps.$$
16 trap "rm -fr $DIR" EXIT
18 if test $
(id
-u) != 0 ; then
21 # enable UTF-8 encoding for programs like pip that expect to
22 # print more than just ascii chars
27 function in_jenkins
() {
28 test -n "$JENKINS_HOME"
31 function munge_ceph_spec_in
{
36 local for_make_check
=$1
39 sed -e 's/@//g' < ceph.spec.
in > $OUTFILE
40 # http://rpm.org/user_doc/conditional_builds.html
41 if $with_seastar; then
42 sed -i -e 's/%bcond_with seastar/%bcond_without seastar/g' $OUTFILE
45 sed -i -e 's/%bcond_with zbd/%bcond_without zbd/g' $OUTFILE
47 if $for_make_check; then
48 sed -i -e 's/%bcond_with make_check/%bcond_without make_check/g' $OUTFILE
52 function munge_debian_control
{
58 control
="/tmp/control.$$"
59 grep -v babeltrace debian
/control
> $control
65 function ensure_decent_gcc_on_ubuntu
{
66 in_jenkins
&& echo "CI_DEBUG: Start ensure_decent_gcc_on_ubuntu() in install-deps.sh"
67 # point gcc to the one offered by g++-7 if the used one is not
69 local old
=$
(gcc
-dumpfullversion -dumpversion)
72 if dpkg
--compare-versions $old ge
${new}.0; then
76 if [ ! -f /usr
/bin
/g
++-${new} ]; then
77 $SUDO tee /etc
/apt
/sources.list.d
/ubuntu-toolchain-r.list
<<EOF
78 deb [lang=none] http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu $codename main
79 deb [arch=amd64 lang=none] http://mirror.nullivex.com/ppa/ubuntu-toolchain-r-test $codename main
81 # import PPA's signing key into APT's keyring
82 cat << ENDOFKEY | $SUDO apt-key add -
83 -----BEGIN PGP PUBLIC KEY BLOCK-----
85 Comment: Hostname: keyserver.ubuntu.com
87 mI0ESuBvRwEEAMi4cDba7xlKaaoXjO1n1HX8RKrkW+HEIl79nSOSJyvzysajs7zUow/OzCQp
88 9NswqrDmNuH1+lPTTRNAGtK8r2ouq2rnXT1mTl23dpgHZ9spseR73s4ZBGw/ag4bpU5dNUSt
89 vfmHhIjVCuiSpNn7cyy1JSSvSs3N2mxteKjXLBf7ABEBAAG0GkxhdW5jaHBhZCBUb29sY2hh
90 aW4gYnVpbGRziLYEEwECACAFAkrgb0cCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRAe
91 k3eiup7yfzGKA/4xzUqNACSlB+k+DxFFHqkwKa/ziFiAlkLQyyhm+iqz80htRZr7Ls/ZRYZl
92 0aSU56/hLe0V+TviJ1s8qdN2lamkKdXIAFfavA04nOnTzyIBJ82EAUT3Nh45skMxo4z4iZMN
93 msyaQpNl/m/lNtOLhR64v5ZybofB2EWkMxUzX8D/FQ==
95 -----END PGP PUBLIC KEY BLOCK-----
97 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get update
-y || true
98 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get
install -y g
++-${new}
102 function ensure_python3_sphinx_on_ubuntu
{
103 in_jenkins
&& echo "CI_DEBUG: Running ensure_python3_sphinx_on_ubuntu() in install-deps.sh"
104 local sphinx_command
=/usr
/bin
/sphinx-build
105 # python-sphinx points $sphinx_command to
106 # ../share/sphinx/scripts/python2/sphinx-build when it's installed
107 # let's "correct" this
108 if test -e $sphinx_command && head -n1 $sphinx_command |
grep -q python$
; then
109 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get
-y remove python-sphinx
113 function install_pkg_on_ubuntu
{
114 in_jenkins
&& echo "CI_DEBUG: Running install_pkg_on_ubuntu() in install-deps.sh"
125 if [ $force = "force" ]; then
129 if ! apt
-qq list
$pkg 2>/dev
/null |
grep -q installed
; then
130 missing_pkgs
+=" $pkg"
131 in_jenkins
&& echo "CI_DEBUG: missing_pkgs=$missing_pkgs"
135 if test -n "$missing_pkgs"; then
136 local shaman_url
="https://shaman.ceph.com/api/repos/${project}/master/${sha1}/ubuntu/${codename}/repo"
137 in_jenkins
&& echo -n "CI_DEBUG: Downloading $shaman_url ... "
138 $SUDO curl
--silent --fail --write-out "%{http_code}" --location $shaman_url --output /etc
/apt
/sources.list.d
/$project.list
139 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get update
-y -o Acquire
::Languages
=none
-o Acquire
::Translation
=none || true
140 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get
install --allow-unauthenticated -y $missing_pkgs
144 function install_boost_on_ubuntu
{
145 in_jenkins
&& echo "CI_DEBUG: Running install_boost_on_ubuntu() in install-deps.sh"
147 local installed_ver
=$
(apt
-qq list
--installed ceph-libboost
*-dev 2>/dev
/null |
148 grep -e 'libboost[0-9].[0-9]\+-dev' |
151 if test -n "$installed_ver"; then
152 if echo "$installed_ver" |
grep -q "^$ver"; then
155 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get
-y remove
"ceph-libboost.*${installed_ver}.*"
156 $SUDO rm -f /etc
/apt
/sources.list.d
/ceph-libboost
${installed_ver}.list
160 local project
=libboost
161 local sha1
=892ab89e76b91b505ffbf083f6fb7f2a666d4132
162 install_pkg_on_ubuntu \
167 ceph-libboost-atomic
$ver-dev \
168 ceph-libboost-chrono
$ver-dev \
169 ceph-libboost-container
$ver-dev \
170 ceph-libboost-context
$ver-dev \
171 ceph-libboost-coroutine
$ver-dev \
172 ceph-libboost-date-time
$ver-dev \
173 ceph-libboost-filesystem
$ver-dev \
174 ceph-libboost-iostreams
$ver-dev \
175 ceph-libboost-program-options
$ver-dev \
176 ceph-libboost-python
$ver-dev \
177 ceph-libboost-random
$ver-dev \
178 ceph-libboost-regex
$ver-dev \
179 ceph-libboost-system
$ver-dev \
180 ceph-libboost-test
$ver-dev \
181 ceph-libboost-thread
$ver-dev \
182 ceph-libboost-timer
$ver-dev
185 function install_libzbd_on_ubuntu
{
186 in_jenkins
&& echo "CI_DEBUG: Running install_libzbd_on_ubuntu() in install-deps.sh"
189 local sha1
=1fadde94b08fab574b17637c2bebd2b1e7f9127b
190 install_pkg_on_ubuntu \
198 motr_pkgs_url
='https://github.com/Seagate/cortx-motr/releases/download/2.0.0-rgw'
200 function install_cortx_motr_on_ubuntu
{
201 if dpkg
-l cortx-motr-dev
&> /dev
/null
; then
204 if [ "$(lsb_release -sc)" = "jammy" ]; then
205 install_pkg_on_ubuntu \
207 39f89fa1c6945040433a913f2687c4b4e6cbeb3f \
213 local deb_arch
=$
(dpkg
--print-architecture)
214 local motr_pkg
="cortx-motr_2.0.0.git3252d623_$deb_arch.deb"
215 local motr_dev_pkg
="cortx-motr-dev_2.0.0.git3252d623_$deb_arch.deb"
216 $SUDO curl
-sL -o/var
/cache
/apt
/archives
/$motr_pkg $motr_pkgs_url/$motr_pkg
217 $SUDO curl
-sL -o/var
/cache
/apt
/archives
/$motr_dev_pkg $motr_pkgs_url/$motr_dev_pkg
218 # For some reason libfabric pkg is not available in arm64 version
219 #Â of Ubuntu 20.04 (Focal Fossa), so we borrow it from more recent
221 if [[ "$deb_arch" == 'arm64' ]]; then
222 local lf_pkg
='libfabric1_1.11.0-2_arm64.deb'
223 $SUDO curl
-sL -o/var
/cache
/apt
/archives
/$lf_pkg http
://ports.ubuntu.com
/pool
/universe
/libf
/libfabric
/$lf_pkg
224 $SUDO apt-get
install -y /var
/cache
/apt
/archives
/$lf_pkg
226 $SUDO apt-get
install -y /var
/cache
/apt
/archives
/{$motr_pkg,$motr_dev_pkg}
227 $SUDO apt-get
install -y libisal-dev
231 function version_lt
{
232 test $1 != $
(echo -e "$1\n$2" |
sort -rV |
head -n 1)
235 function ensure_decent_gcc_on_rh
{
236 local old
=$
(gcc
-dumpversion)
238 if version_lt
$old $dts_ver; then
242 Your GCC is too old. Please run following command to add DTS to your environment:
244 scl enable gcc-toolset-$dts_ver bash
246 Or add the following line to the end of ~/.bashrc and run "source ~/.bashrc" to add it permanently:
248 source scl_source enable gcc-toolset-$dts_ver
251 # non-interactive shell
252 source /opt
/rh
/gcc-toolset-
$dts_ver/enable
261 elif [ $FOR_MAKE_CHECK ]; then
267 if [ x$
(uname
)x
= xFreeBSDx
]; then
268 $SUDO pkg
install -yq \
277 devel
/boost-python-libs \
282 devel
/google-perftools \
285 net
/openldap24-client \
289 misc
/e2fsprogs-libuuid \
296 textproc
/xmlstarlet \
307 devel
/py-prettytable \
316 security
/oath-toolkit \
318 sysutils
/fusefs-libs \
320 # Now use pip to install some extra python modules
325 [ $WITH_SEASTAR ] && with_seastar
=true || with_seastar
=false
326 [ $WITH_ZBD ] && with_zbd
=true || with_zbd
=false
327 [ $WITH_PMEM ] && with_pmem
=true || with_pmem
=false
328 [ $WITH_RADOSGW_MOTR ] && with_rgw_motr
=true || with_rgw_motr
=false
329 source /etc
/os-release
331 debian|ubuntu|devuan|elementary|softiron
)
332 echo "Using apt-get to install dependencies"
333 $SUDO apt-get
install -y devscripts equivs
334 $SUDO apt-get
install -y dpkg-dev
335 ensure_python3_sphinx_on_ubuntu
338 ensure_decent_gcc_on_ubuntu
9 bionic
339 [ ! $NO_BOOST_PKGS ] && install_boost_on_ubuntu bionic
340 $with_zbd && install_libzbd_on_ubuntu bionic
343 ensure_decent_gcc_on_ubuntu
11 focal
344 [ ! $NO_BOOST_PKGS ] && install_boost_on_ubuntu focal
345 $with_zbd && install_libzbd_on_ubuntu focal
348 [ ! $NO_BOOST_PKGS ] && install_boost_on_ubuntu jammy
349 $SUDO apt-get
install -y gcc
352 $SUDO apt-get
install -y gcc
355 if ! test -r debian
/control
; then
356 echo debian
/control is not a readable
file
361 in_jenkins
&& echo "CI_DEBUG: Running munge_debian_control() in install-deps.sh"
363 control
=$
(munge_debian_control
"$VERSION" "debian/control")
366 backports
="-t $codename-backports"
370 # make a metapackage that expresses the build dependencies,
371 # install it, rm the .deb; then uninstall the package as its
374 if $for_make_check; then
375 build_profiles
+=",pkg.ceph.check"
377 if $with_seastar; then
378 build_profiles
+=",pkg.ceph.crimson"
381 build_profiles
+=",pkg.ceph.pmdk"
384 in_jenkins
&& cat <<EOF
385 CI_DEBUG: for_make_check=$for_make_check
386 CI_DEBUG: with_seastar=$with_seastar
387 CI_DEBUG: with_jaeger=$with_jaeger
388 CI_DEBUG: build_profiles=$build_profiles
389 CI_DEBUG: Now running 'mk-build-deps' and installing ceph-build-deps package
392 $SUDO env DEBIAN_FRONTEND
=noninteractive mk-build-deps \
393 --build-profiles "${build_profiles#,}" \
395 --tool="apt-get -y --no-install-recommends $backports" $control ||
exit 1
396 in_jenkins
&& echo "CI_DEBUG: Removing ceph-build-deps"
397 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get
-y remove ceph-build-deps
398 if [ "$control" != "debian/control" ] ; then rm $control; fi
400 # for rgw motr backend build checks
401 if $with_rgw_motr; then
402 install_cortx_motr_on_ubuntu
405 rocky|centos|fedora|rhel|ol|virtuozzo
)
406 builddepcmd
="dnf -y builddep --allowerasing"
407 echo "Using dnf to install dependencies"
410 $SUDO dnf
install -y dnf-utils
412 rocky|centos|rhel|ol|virtuozzo
)
413 MAJOR_VERSION
="$(echo $VERSION_ID | cut -d. -f1)"
414 $SUDO dnf
install -y dnf-utils selinux-policy-targeted
415 rpm
--quiet --query epel-release || \
416 $SUDO dnf
-y install --nogpgcheck https
://dl.fedoraproject.org
/pub
/epel
/epel-release-latest-
$MAJOR_VERSION.noarch.rpm
417 $SUDO rpm
--import /etc
/pki
/rpm-gpg
/RPM-GPG-KEY-EPEL-
$MAJOR_VERSION
418 $SUDO rm -f /etc
/yum.repos.d
/dl.fedoraproject.org
*
419 if test $ID = centos
-a $MAJOR_VERSION = 8 ; then
420 # Enable 'powertools' or 'PowerTools' repo
421 $SUDO dnf config-manager
--set-enabled $
(dnf repolist
--all 2>/dev
/null|gawk
'tolower($0) ~ /^powertools\s/{print $1}')
423 # before EPEL8 and PowerTools provide all dependencies, we use sepia for the dependencies
424 $SUDO dnf config-manager
--add-repo http
://apt-mirror.front.sepia.ceph.com
/lab-extras
/8/
425 $SUDO dnf config-manager
--setopt=apt-mirror.front.sepia.ceph.com_lab-extras_8_.gpgcheck
=0 --save
426 $SUDO dnf
-y module
enable javapackages-tools
427 elif test $ID = rhel
-a $MAJOR_VERSION = 8 ; then
429 $SUDO dnf config-manager
--set-enabled "codeready-builder-for-rhel-8-${ARCH}-rpms"
430 $SUDO dnf config-manager
--add-repo http
://apt-mirror.front.sepia.ceph.com
/lab-extras
/8/
431 $SUDO dnf config-manager
--setopt=apt-mirror.front.sepia.ceph.com_lab-extras_8_.gpgcheck
=0 --save
432 $SUDO dnf
-y module
enable javapackages-tools
436 munge_ceph_spec_in
$with_seastar $with_zbd $for_make_check $DIR/ceph.spec
437 # for python3_pkgversion macro defined by python-srpm-macros, which is required by python3-devel
438 $SUDO dnf
install -y python3-devel
439 $SUDO $builddepcmd $DIR/ceph.spec
2>&1 |
tee $DIR/yum-builddep.out
440 [ ${PIPESTATUS[0]} -ne 0 ] && exit 1
441 if [ -n "$dts_ver" ]; then
442 ensure_decent_gcc_on_rh
$dts_ver
444 IGNORE_YUM_BUILDEP_ERRORS
="ValueError: SELinux policy is not managed or store cannot be accessed."
445 sed "/$IGNORE_YUM_BUILDEP_ERRORS/d" $DIR/yum-builddep.out |
grep -i "error:" && exit 1
446 # for rgw motr backend build checks
447 if ! rpm
--quiet -q cortx-motr-devel
&&
448 { [[ $FOR_MAKE_CHECK ]] ||
$with_rgw_motr; }; then
449 $SUDO dnf
install -y \
450 "$motr_pkgs_url/isa-l-2.30.0-1.el7.${ARCH}.rpm" \
451 "$motr_pkgs_url/cortx-motr-2.0.0-1_git3252d623_any.el8.${ARCH}.rpm" \
452 "$motr_pkgs_url/cortx-motr-devel-2.0.0-1_git3252d623_any.el8.${ARCH}.rpm"
456 echo "Using zypper to install dependencies"
457 zypp_install
="zypper --gpg-auto-import-keys --non-interactive install --no-recommends"
458 $SUDO $zypp_install systemd-rpm-macros rpm-build ||
exit 1
459 munge_ceph_spec_in
$with_seastar false
$for_make_check $DIR/ceph.spec
460 $SUDO $zypp_install $
(rpmspec
-q --buildrequires $DIR/ceph.spec
) ||
exit 1
463 echo "$ID is unknown, dependencies will have to be installed manually."
469 function populate_wheelhouse
() {
470 in_jenkins
&& echo "CI_DEBUG: Running populate_wheelhouse() in install-deps.sh"
474 # although pip comes with virtualenv, having a recent version
475 # of pip matters when it comes to using wheel packages
476 PIP_OPTS
="--timeout 300 --exists-action i"
477 pip
$PIP_OPTS $install \
478 'setuptools >= 0.8' 'pip >= 21.0' 'wheel >= 0.24' 'tox >= 2.9.1' ||
return 1
479 if test $# != 0 ; then
480 pip
$PIP_OPTS $install $@ ||
return 1
484 function activate_virtualenv
() {
485 in_jenkins
&& echo "CI_DEBUG: Running activate_virtualenv() in install-deps.sh"
487 local env_dir
=$top_srcdir/install-deps-python3
489 if ! test -d $env_dir ; then
490 python3
-m venv
${env_dir}
491 .
$env_dir/bin
/activate
492 if ! populate_wheelhouse
install ; then
497 .
$env_dir/bin
/activate
500 function preload_wheels_for_tox
() {
501 in_jenkins
&& echo "CI_DEBUG: Running preload_wheels_for_tox() in install-deps.sh"
506 local require_files
=$
(ls *requirements
*.txt
2>/dev
/null
) || true
507 local constraint_files
=$
(ls *constraints
*.txt
2>/dev
/null
) || true
508 local require
=$
(echo -n "$require_files" |
sed -e 's/^/-r /')
509 local constraint
=$
(echo -n "$constraint_files" |
sed -e 's/^/-c /')
510 local md5
=wheelhouse
/md5
511 if test "$require"; then
512 if ! test -f $md5 ||
! md5sum -c $md5 > /dev
/null
; then
516 if test "$require" && ! test -d wheelhouse
; then
517 type python3
> /dev
/null
2>&1 ||
continue
518 activate_virtualenv
$top_srcdir ||
exit 1
519 python3
-m pip
install --upgrade pip
520 populate_wheelhouse
"wheel -w $wip_wheelhouse" $require $constraint ||
exit 1
521 mv $wip_wheelhouse wheelhouse
522 md5sum $require_files $constraint_files > $md5
527 # use pip cache if possible but do not store it outside of the source
529 # see https://pip.pypa.io/en/stable/reference/pip_install.html#caching
530 if $for_make_check; then
531 mkdir
-p install-deps-cache
533 export XDG_CACHE_HOME
=$top_srcdir/install-deps-cache
534 wip_wheelhouse
=wheelhouse-wip
536 # preload python modules so that tox can run without network access
538 find .
-name tox.ini |
while read ini
; do
539 preload_wheels_for_tox
$ini
541 rm -rf $top_srcdir/install-deps-python3
542 rm -rf $XDG_CACHE_HOME
543 type git
> /dev
/null ||
(echo "Dashboard uses git to pull dependencies." ; false
)
546 in_jenkins
&& echo "CI_DEBUG: End install-deps.sh" || true