From 192d26bd7af7f7f87f55a91c07087e07833bd944 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 3 Oct 2022 15:08:30 -0400 Subject: [PATCH] install-deps.sh: copy ubuntu/apt retry logic from run-make.sh 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 (cherry picked from commit e8b370a9c7dd465345d5dc62513d635339a150b3) --- install-deps.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/install-deps.sh b/install-deps.sh index c0f90d03b63..ae818091b0d 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -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 -- 2.39.5