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
146 function clean_boost_on_ubuntu
{
147 in_jenkins
&& echo "CI_DEBUG: Running clean_boost_on_ubuntu() in install-deps.sh"
148 # Find currently installed version. If there are multiple
149 # versions, they end up newline separated
150 local installed_ver
=$
(apt
-qq list
--installed ceph-libboost
*-dev 2>/dev
/null |
154 # If installed_ver contains whitespace, we can't really count on it,
155 # but otherwise, bail out if the version installed is the version
157 if test -n "$installed_ver" &&
158 echo -n "$installed_ver" |
tr '[:space:]' ' ' |
grep -v -q ' '; then
159 if echo "$installed_ver" |
grep -q "^$boost_ver"; then
164 # Historical packages
165 $SUDO rm -f /etc
/apt
/sources.list.d
/ceph-libboost
*.list
167 $SUDO rm -f /etc
/apt
/sources.list.d
/libboost.list
168 # Refresh package list so things aren't in the available list.
169 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get update
-y || true
170 # Remove all ceph-libboost packages. We have an early return if
171 # the desired version is already (and the only) version installed,
172 # so no need to spare it.
173 if test -n "$installed_ver"; then
174 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get
-y --fix-missing remove
"ceph-libboost*"
178 function install_boost_on_ubuntu
{
179 in_jenkins
&& echo "CI_DEBUG: Running install_boost_on_ubuntu() in install-deps.sh"
180 # Once we get to this point, clean_boost_on_ubuntu() should ensure
181 # that there is no more than one installed version.
182 local installed_ver
=$
(apt
-qq list
--installed ceph-libboost
*-dev 2>/dev
/null |
183 grep -e 'libboost[0-9].[0-9]\+-dev' |
186 if test -n "$installed_ver"; then
187 if echo "$installed_ver" |
grep -q "^$boost_ver"; then
192 local project
=libboost
193 local sha1
=892ab89e76b91b505ffbf083f6fb7f2a666d4132
194 install_pkg_on_ubuntu \
199 ceph-libboost-atomic
${boost_ver}-dev \
200 ceph-libboost-chrono
${boost_ver}-dev \
201 ceph-libboost-container
${boost_ver}-dev \
202 ceph-libboost-context
${boost_ver}-dev \
203 ceph-libboost-coroutine
${boost_ver}-dev \
204 ceph-libboost-date-time
${boost_ver}-dev \
205 ceph-libboost-filesystem
${boost_ver}-dev \
206 ceph-libboost-iostreams
${boost_ver}-dev \
207 ceph-libboost-program-options
${boost_ver}-dev \
208 ceph-libboost-python
${boost_ver}-dev \
209 ceph-libboost-random
${boost_ver}-dev \
210 ceph-libboost-regex
${boost_ver}-dev \
211 ceph-libboost-system
${boost_ver}-dev \
212 ceph-libboost-test
${boost_ver}-dev \
213 ceph-libboost-thread
${boost_ver}-dev \
214 ceph-libboost-timer
${boost_ver}-dev
217 function install_libzbd_on_ubuntu
{
218 in_jenkins
&& echo "CI_DEBUG: Running install_libzbd_on_ubuntu() in install-deps.sh"
221 local sha1
=1fadde94b08fab574b17637c2bebd2b1e7f9127b
222 install_pkg_on_ubuntu \
230 motr_pkgs_url
='https://github.com/Seagate/cortx-motr/releases/download/2.0.0-rgw'
232 function install_cortx_motr_on_ubuntu
{
233 if dpkg
-l cortx-motr-dev
&> /dev
/null
; then
236 if [ "$(lsb_release -sc)" = "jammy" ]; then
237 install_pkg_on_ubuntu \
239 39f89fa1c6945040433a913f2687c4b4e6cbeb3f \
245 local deb_arch
=$
(dpkg
--print-architecture)
246 local motr_pkg
="cortx-motr_2.0.0.git3252d623_$deb_arch.deb"
247 local motr_dev_pkg
="cortx-motr-dev_2.0.0.git3252d623_$deb_arch.deb"
248 $SUDO curl
-sL -o/var
/cache
/apt
/archives
/$motr_pkg $motr_pkgs_url/$motr_pkg
249 $SUDO curl
-sL -o/var
/cache
/apt
/archives
/$motr_dev_pkg $motr_pkgs_url/$motr_dev_pkg
250 # For some reason libfabric pkg is not available in arm64 version
251 #Â of Ubuntu 20.04 (Focal Fossa), so we borrow it from more recent
253 if [[ "$deb_arch" == 'arm64' ]]; then
254 local lf_pkg
='libfabric1_1.11.0-2_arm64.deb'
255 $SUDO curl
-sL -o/var
/cache
/apt
/archives
/$lf_pkg http
://ports.ubuntu.com
/pool
/universe
/libf
/libfabric
/$lf_pkg
256 $SUDO apt-get
install -y /var
/cache
/apt
/archives
/$lf_pkg
258 $SUDO apt-get
install -y /var
/cache
/apt
/archives
/{$motr_pkg,$motr_dev_pkg}
259 $SUDO apt-get
install -y libisal-dev
263 function version_lt
{
264 test $1 != $
(echo -e "$1\n$2" |
sort -rV |
head -n 1)
267 function ensure_decent_gcc_on_rh
{
268 local old
=$
(gcc
-dumpversion)
270 if version_lt
$old $dts_ver; then
274 Your GCC is too old. Please run following command to add DTS to your environment:
276 scl enable gcc-toolset-$dts_ver bash
278 Or add the following line to the end of ~/.bashrc and run "source ~/.bashrc" to add it permanently:
280 source scl_source enable gcc-toolset-$dts_ver
283 # non-interactive shell
284 source /opt
/rh
/gcc-toolset-
$dts_ver/enable
293 elif [ $FOR_MAKE_CHECK ]; then
299 if [ x$
(uname
)x
= xFreeBSDx
]; then
300 $SUDO pkg
install -yq \
309 devel
/boost-python-libs \
314 devel
/google-perftools \
317 net
/openldap24-client \
321 misc
/e2fsprogs-libuuid \
328 textproc
/xmlstarlet \
339 devel
/py-prettytable \
348 security
/oath-toolkit \
350 sysutils
/fusefs-libs \
352 # Now use pip to install some extra python modules
357 [ $WITH_SEASTAR ] && with_seastar
=true || with_seastar
=false
358 [ $WITH_ZBD ] && with_zbd
=true || with_zbd
=false
359 [ $WITH_PMEM ] && with_pmem
=true || with_pmem
=false
360 [ $WITH_RADOSGW_MOTR ] && with_rgw_motr
=true || with_rgw_motr
=false
361 source /etc
/os-release
363 debian|ubuntu|devuan|elementary|softiron
)
364 echo "Using apt-get to install dependencies"
365 # Put this before any other invocation of apt so it can clean
366 # up in a broken case.
367 clean_boost_on_ubuntu
368 $SUDO apt-get
install -y devscripts equivs
369 $SUDO apt-get
install -y dpkg-dev
370 ensure_python3_sphinx_on_ubuntu
373 ensure_decent_gcc_on_ubuntu
9 bionic
374 [ ! $NO_BOOST_PKGS ] && install_boost_on_ubuntu bionic
375 $with_zbd && install_libzbd_on_ubuntu bionic
378 ensure_decent_gcc_on_ubuntu
11 focal
379 [ ! $NO_BOOST_PKGS ] && install_boost_on_ubuntu focal
380 $with_zbd && install_libzbd_on_ubuntu focal
383 [ ! $NO_BOOST_PKGS ] && install_boost_on_ubuntu jammy
384 $SUDO apt-get
install -y gcc
387 $SUDO apt-get
install -y gcc
390 if ! test -r debian
/control
; then
391 echo debian
/control is not a readable
file
396 in_jenkins
&& echo "CI_DEBUG: Running munge_debian_control() in install-deps.sh"
398 control
=$
(munge_debian_control
"$VERSION" "debian/control")
401 backports
="-t $codename-backports"
405 # make a metapackage that expresses the build dependencies,
406 # install it, rm the .deb; then uninstall the package as its
409 if $for_make_check; then
410 build_profiles
+=",pkg.ceph.check"
412 if $with_seastar; then
413 build_profiles
+=",pkg.ceph.crimson"
416 build_profiles
+=",pkg.ceph.pmdk"
419 in_jenkins
&& cat <<EOF
420 CI_DEBUG: for_make_check=$for_make_check
421 CI_DEBUG: with_seastar=$with_seastar
422 CI_DEBUG: with_jaeger=$with_jaeger
423 CI_DEBUG: build_profiles=$build_profiles
424 CI_DEBUG: Now running 'mk-build-deps' and installing ceph-build-deps package
427 $SUDO env DEBIAN_FRONTEND
=noninteractive mk-build-deps \
428 --build-profiles "${build_profiles#,}" \
430 --tool="apt-get -y --no-install-recommends $backports" $control ||
exit 1
431 in_jenkins
&& echo "CI_DEBUG: Removing ceph-build-deps"
432 $SUDO env DEBIAN_FRONTEND
=noninteractive apt-get
-y remove ceph-build-deps
433 if [ "$control" != "debian/control" ] ; then rm $control; fi
435 # for rgw motr backend build checks
436 if $with_rgw_motr; then
437 install_cortx_motr_on_ubuntu
440 rocky|centos|fedora|rhel|ol|virtuozzo
)
441 builddepcmd
="dnf -y builddep --allowerasing"
442 echo "Using dnf to install dependencies"
445 $SUDO dnf
install -y dnf-utils
447 rocky|centos|rhel|ol|virtuozzo
)
448 MAJOR_VERSION
="$(echo $VERSION_ID | cut -d. -f1)"
449 $SUDO dnf
install -y dnf-utils selinux-policy-targeted
450 rpm
--quiet --query epel-release || \
451 $SUDO dnf
-y install --nogpgcheck https
://dl.fedoraproject.org
/pub
/epel
/epel-release-latest-
$MAJOR_VERSION.noarch.rpm
452 $SUDO rpm
--import /etc
/pki
/rpm-gpg
/RPM-GPG-KEY-EPEL-
$MAJOR_VERSION
453 $SUDO rm -f /etc
/yum.repos.d
/dl.fedoraproject.org
*
454 if test $ID = centos
-a $MAJOR_VERSION = 8 ; then
455 # Enable 'powertools' or 'PowerTools' repo
456 $SUDO dnf config-manager
--set-enabled $
(dnf repolist
--all 2>/dev
/null|gawk
'tolower($0) ~ /^powertools\s/{print $1}')
458 # before EPEL8 and PowerTools provide all dependencies, we use sepia for the dependencies
459 $SUDO dnf config-manager
--add-repo http
://apt-mirror.front.sepia.ceph.com
/lab-extras
/8/
460 $SUDO dnf config-manager
--setopt=apt-mirror.front.sepia.ceph.com_lab-extras_8_.gpgcheck
=0 --save
461 $SUDO dnf
-y module
enable javapackages-tools
462 elif test $ID = rhel
-a $MAJOR_VERSION = 8 ; then
464 $SUDO dnf config-manager
--set-enabled "codeready-builder-for-rhel-8-${ARCH}-rpms"
465 $SUDO dnf config-manager
--add-repo http
://apt-mirror.front.sepia.ceph.com
/lab-extras
/8/
466 $SUDO dnf config-manager
--setopt=apt-mirror.front.sepia.ceph.com_lab-extras_8_.gpgcheck
=0 --save
467 $SUDO dnf
-y module
enable javapackages-tools
471 munge_ceph_spec_in
$with_seastar $with_zbd $for_make_check $DIR/ceph.spec
472 # for python3_pkgversion macro defined by python-srpm-macros, which is required by python3-devel
473 $SUDO dnf
install -y python3-devel
474 $SUDO $builddepcmd $DIR/ceph.spec
2>&1 |
tee $DIR/yum-builddep.out
475 [ ${PIPESTATUS[0]} -ne 0 ] && exit 1
476 if [ -n "$dts_ver" ]; then
477 ensure_decent_gcc_on_rh
$dts_ver
479 IGNORE_YUM_BUILDEP_ERRORS
="ValueError: SELinux policy is not managed or store cannot be accessed."
480 sed "/$IGNORE_YUM_BUILDEP_ERRORS/d" $DIR/yum-builddep.out |
grep -i "error:" && exit 1
481 # for rgw motr backend build checks
482 if ! rpm
--quiet -q cortx-motr-devel
&&
483 { [[ $FOR_MAKE_CHECK ]] ||
$with_rgw_motr; }; then
484 $SUDO dnf
install -y \
485 "$motr_pkgs_url/isa-l-2.30.0-1.el7.${ARCH}.rpm" \
486 "$motr_pkgs_url/cortx-motr-2.0.0-1_git3252d623_any.el8.${ARCH}.rpm" \
487 "$motr_pkgs_url/cortx-motr-devel-2.0.0-1_git3252d623_any.el8.${ARCH}.rpm"
491 echo "Using zypper to install dependencies"
492 zypp_install
="zypper --gpg-auto-import-keys --non-interactive install --no-recommends"
493 $SUDO $zypp_install systemd-rpm-macros rpm-build ||
exit 1
494 munge_ceph_spec_in
$with_seastar false
$for_make_check $DIR/ceph.spec
495 $SUDO $zypp_install $
(rpmspec
-q --buildrequires $DIR/ceph.spec
) ||
exit 1
498 echo "$ID is unknown, dependencies will have to be installed manually."
504 function populate_wheelhouse
() {
505 in_jenkins
&& echo "CI_DEBUG: Running populate_wheelhouse() in install-deps.sh"
509 # although pip comes with virtualenv, having a recent version
510 # of pip matters when it comes to using wheel packages
511 PIP_OPTS
="--timeout 300 --exists-action i"
512 pip
$PIP_OPTS $install \
513 'setuptools >= 0.8' 'pip >= 21.0' 'wheel >= 0.24' 'tox >= 2.9.1' ||
return 1
514 if test $# != 0 ; then
515 pip
$PIP_OPTS $install $@ ||
return 1
519 function activate_virtualenv
() {
520 in_jenkins
&& echo "CI_DEBUG: Running activate_virtualenv() in install-deps.sh"
522 local env_dir
=$top_srcdir/install-deps-python3
524 if ! test -d $env_dir ; then
525 python3
-m venv
${env_dir}
526 .
$env_dir/bin
/activate
527 if ! populate_wheelhouse
install ; then
532 .
$env_dir/bin
/activate
535 function preload_wheels_for_tox
() {
536 in_jenkins
&& echo "CI_DEBUG: Running preload_wheels_for_tox() in install-deps.sh"
541 local require_files
=$
(ls *requirements
*.txt
2>/dev
/null
) || true
542 local constraint_files
=$
(ls *constraints
*.txt
2>/dev
/null
) || true
543 local require
=$
(echo -n "$require_files" |
sed -e 's/^/-r /')
544 local constraint
=$
(echo -n "$constraint_files" |
sed -e 's/^/-c /')
545 local md5
=wheelhouse
/md5
546 if test "$require"; then
547 if ! test -f $md5 ||
! md5sum -c $md5 > /dev
/null
; then
551 if test "$require" && ! test -d wheelhouse
; then
552 type python3
> /dev
/null
2>&1 ||
continue
553 activate_virtualenv
$top_srcdir ||
exit 1
554 python3
-m pip
install --upgrade pip
555 populate_wheelhouse
"wheel -w $wip_wheelhouse" $require $constraint ||
exit 1
556 mv $wip_wheelhouse wheelhouse
557 md5sum $require_files $constraint_files > $md5
562 # use pip cache if possible but do not store it outside of the source
564 # see https://pip.pypa.io/en/stable/reference/pip_install.html#caching
565 if $for_make_check; then
566 mkdir
-p install-deps-cache
568 export XDG_CACHE_HOME
=$top_srcdir/install-deps-cache
569 wip_wheelhouse
=wheelhouse-wip
571 # preload python modules so that tox can run without network access
573 find .
-name tox.ini |
while read ini
; do
574 preload_wheels_for_tox
$ini
576 rm -rf $top_srcdir/install-deps-python3
577 rm -rf $XDG_CACHE_HOME
578 type git
> /dev
/null ||
(echo "Dashboard uses git to pull dependencies." ; false
)
581 in_jenkins
&& echo "CI_DEBUG: End install-deps.sh" || true