From 939b147a55192c21e98d21cb380d0ec0b2ca84d5 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 20 Mar 2021 13:00:01 +0800 Subject: [PATCH] install-deps.sh: remove existing ceph-libboost of different version we install different versions of precompiled ceph-libboost packages for different branches when building and testing them on ubuntu test nodes. for instance, - nautilus: v1.72 - octopus, pacific: v1.73 they share the same set of test nodes. and these ceph-libboost packages conflict with each other, because they install files to the same places. in order to avoid the confliction, we should uninstall existing packages before installing a different version of ceph-libboost packages. ceph-libboost${version}-dev is a package providing the shared headers of boost library, so, in this change we check if it is installed before returning or removing the existing packages. Signed-off-by: Kefu Chai --- install-deps.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/install-deps.sh b/install-deps.sh index def03ef35ab80..7911bcb405ba9 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -174,13 +174,21 @@ function install_pkg_on_ubuntu { } function install_boost_on_ubuntu { - local codename=$1 - if apt -qq list ceph-libboost1.72-dev 2>/dev/null | grep -q installed; then - $SUDO env DEBIAN_FRONTEND=noninteractive apt-get -y remove 'ceph-libboost.*1.72.*' - $SUDO rm -f /etc/apt/sources.list.d/ceph-libboost1.72.list + local ver=1.73 + local installed_ver=$(apt -qq list --installed ceph-libboost*-dev 2>/dev/null | + grep -e 'libboost[0-9].[0-9]\+-dev' | + cut -d' ' -f2 | + cut -d'.' -f1,2) + if test -n "$installed_ver"; then + if echo "$installed_ver" | grep -q "^$ver"; then + return + else + $SUDO env DEBIAN_FRONTEND=noninteractive apt-get -y remove "ceph-libboost.*${installed_ver}.*" + $SUDO rm -f /etc/apt/sources.list.d/ceph-libboost${installed_ver}.list + fi fi + local codename=$1 local project=libboost - local ver=1.73 local sha1=7aba8a1882670522ee1d1ee1bba0ea170b292dec install_pkg_on_ubuntu \ $project \ -- 2.39.5