From cc4347d1a29586a7f188275915e46bf3f2ae7a78 Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Wed, 10 Oct 2018 14:21:15 +0000 Subject: [PATCH] Re-try Minisat download (up to two times) in case it fails Running in CI we do see transient network access errors from time to time, which should not result in task failures (as long as they are genuinely transient). For CMake we could do the same once upgrading to >= 3.7 (else it would be very clumsy to implement). --- src/Makefile | 8 +++++++- src/solvers/CMakeLists.txt | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 403b2616423..020da636c97 100644 --- a/src/Makefile +++ b/src/Makefile @@ -89,7 +89,13 @@ TAR = tar minisat2-download: @echo "Downloading Minisat 2.2.1" - @$(DOWNLOADER) http://ftp.debian.org/debian/pool/main/m/minisat2/minisat2_2.2.1.orig.tar.gz + @for i in $$(seq 1 3) ; do \ + $(DOWNLOADER) \ + http://ftp.debian.org/debian/pool/main/m/minisat2/minisat2_2.2.1.orig.tar.gz && \ + exit 0 ; \ + $(RM) minisat2_2.2.1.orig.tar.gz ; \ + if [ $$i -lt 3 ] ; then echo "Re-trying in 10 seconds" 1>&2 ; sleep 10 ; fi ; \ + done ; exit 1 @$(TAR) xfz minisat2_2.2.1.orig.tar.gz @rm -Rf ../minisat-2.2.1 @mv minisat2-2.2.1 ../minisat-2.2.1 diff --git a/src/solvers/CMakeLists.txt b/src/solvers/CMakeLists.txt index 19aa7d29c55..162efa32c79 100644 --- a/src/solvers/CMakeLists.txt +++ b/src/solvers/CMakeLists.txt @@ -60,6 +60,9 @@ include("${CBMC_SOURCE_DIR}/../cmake/DownloadProject.cmake") if("${sat_impl}" STREQUAL "minisat2") message(STATUS "Building solvers with minisat2") + # once we upgrade to CMake 3.7 or higher we can specify multiple URLs as a + # fall-back in case the first URL fails (the Makefile-based build retries up + # to 2 times) download_project(PROJ minisat2 URL http://ftp.debian.org/debian/pool/main/m/minisat2/minisat2_2.2.1.orig.tar.gz PATCH_COMMAND patch -p1 -i ${CBMC_SOURCE_DIR}/../scripts/minisat-2.2.1-patch