]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
install-deps.sh: remove existing ceph-libboost of different version 40287/head
authorKefu Chai <kchai@redhat.com>
Sat, 20 Mar 2021 05:00:01 +0000 (13:00 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 21 Mar 2021 07:30:39 +0000 (15:30 +0800)
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 <kchai@redhat.com>
(cherry picked from commit 939b147a55192c21e98d21cb380d0ec0b2ca84d5)

Conflicts:
install-deps.sh: trivial resolution

install-deps.sh

index 4f64ee176128e1841cd6dabd10bbee88a91852f7..7563166899134bc37da5dbf72e4d2232d9650fa3 100755 (executable)
@@ -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 \