]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
install-deps.sh: copy ubuntu/apt retry logic from run-make.sh
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 3 Oct 2022 19:08:30 +0000 (15:08 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 18 Feb 2025 22:58:08 +0000 (17:58 -0500)
Copy the logic from run-make.sh into install-deps.sh so that we can later
remove it from run-make.sh. It helps prevent breakage when apt-get is
interrupted.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit e8b370a9c7dd465345d5dc62513d635339a150b3)

install-deps.sh

index c0f90d03b63d760c28a8f146ecd23964d47e6a51..ae818091b0def47785564581977d3b1fcc92f9f0 100755 (executable)
@@ -428,7 +428,16 @@ else
        # up in a broken case.
         clean_boost_on_ubuntu
         if [ "$INSTALL_EXTRA_PACKAGES" ]; then
-            $SUDO apt-get install -y $INSTALL_EXTRA_PACKAGES
+            if ! $SUDO apt-get install -y $INSTALL_EXTRA_PACKAGES ; then
+                # try again. ported over from run-make.sh (orignally e278295)
+                # In the case that apt-get is interrupted, like when a jenkins
+                # job is cancelled, the package manager will be in an inconsistent
+                # state. Run the command again after `dpkg --configure -a` to
+                # bring package manager back into a clean state.
+                $SUDO dpkg --configure -a
+                in_jenkins && echo "CI_DEBUG: trying to install $INSTALL_EXTRA_PACKAGES again"
+                $SUDO apt-get install -y $INSTALL_EXTRA_PACKAGES
+            fi
         fi
         $SUDO apt-get install -y devscripts equivs
         $SUDO apt-get install -y dpkg-dev