From: Kefu Chai Date: Sat, 20 Mar 2021 05:00:01 +0000 (+0800) Subject: install-deps.sh: remove existing ceph-libboost of different version X-Git-Tag: v14.2.22~22^2~2^2~2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F40287%2Fhead;p=ceph.git 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, octopus: v1.72 - 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 (cherry picked from commit 939b147a55192c21e98d21cb380d0ec0b2ca84d5) Conflicts: install-deps.sh: trivial resolution --- diff --git a/install-deps.sh b/install-deps.sh index 4f64ee176128..756316689913 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -147,13 +147,21 @@ function install_pkg_on_ubuntu { } function install_boost_on_ubuntu { - local codename=$1 - if dpkg -s ceph-libboost1.67-dev &> /dev/null; then - $SUDO env DEBIAN_FRONTEND=noninteractive apt-get -y remove 'ceph-libboost.*1.67.*' - $SUDO rm /etc/apt/sources.list.d/ceph-libboost1.67.list + local ver=1.72 + 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.72 local sha1=1d7c7a00cc3f37e340bae0360191a757b44ec80c install_pkg_on_ubuntu \ $project \