From 6d68865a5d083b8892c3f4854284bb2036f1efdf Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Tue, 11 Feb 2020 00:38:11 +0100 Subject: Using backup server when original download server fails Until now, the main download script could only check one server for the given URL. However, ultimately the actual server that a file is downloaded from is irrelevant for this project: we actually check its checksum. Especially in the case of software (which are distributed over many servers), this can usually be very annoying: the servers may not properly communicate with the running system and even the 10 trials won't be enough. With this commit, the download script `reproduce/analysis/bash/download-multi-try' can take a new optional argument (a 5th argument). It assumes this argument is a space-separated list of server(s) to use as backup for the original URL. When downloading from the original URL fails, it will look into this list and try downloading the same file from each given server. --- reproduce/software/make/basic.mk | 16 ++++++++++++---- reproduce/software/make/high-level.mk | 7 ++++++- reproduce/software/make/python.mk | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) (limited to 'reproduce/software/make') diff --git a/reproduce/software/make/basic.mk b/reproduce/software/make/basic.mk index d08ba62..2cad9f9 100644 --- a/reproduce/software/make/basic.mk +++ b/reproduce/software/make/basic.mk @@ -82,6 +82,10 @@ export BASH_ENV := $(shell pwd)/reproduce/software/shell/bashrc.sh top-level-programs = low-level-links gcc all: $(foreach p, $(top-level-programs), $(ibidir)/$(p)) +# Servers to use as backup, later this should go in a file that is not +# under version control (the actual server that the tarbal comes from is +# irrelevant). +backupservers = http://akhlaghi.org/reproduce-software @@ -236,15 +240,19 @@ $(tarballs): $(tdir)/%: | $(lockdir) \ touch $(lockdir)/download; \ $(downloadwrapper) "$$downloader" $(lockdir)/download \ - $$tarballurl "$@.unchecked"; \ + $$tarballurl "$@.unchecked" "$(backupservers)"; \ fi; \ \ \ if type sha512sum > /dev/null 2>/dev/null; then \ checksum=$$(sha512sum "$@.unchecked" | awk '{print $$1}'); \ - echo "$*: should be '$$c', is '$$checksum'"; \ - if [ x$$checksum = x$$c ]; then mv "$@.unchecked" "$@"; \ - else echo "ERROR: Non-matching checksum for '$*'."; exit 1; \ + if [ x"$$checksum" = x"$$c" ]; then \ + mv "$@.unchecked" "$@"; \ + else \ + echo "ERROR: Non-matching checksum for '$*'."; \ + echo "Checksum should be: $$c"; \ + echo "Checksum is: $$checksum"; \ + exit 1; \ fi; \ else mv "$@.unchecked" "$@"; \ fi; diff --git a/reproduce/software/make/high-level.mk b/reproduce/software/make/high-level.mk index 53bef55..8457690 100644 --- a/reproduce/software/make/high-level.mk +++ b/reproduce/software/make/high-level.mk @@ -100,6 +100,11 @@ export LIBRARY_PATH := $(sys_library_path) export PROJECT_STATUS := configure_highlevel export BASH_ENV := $(shell pwd)/reproduce/software/shell/bashrc.sh +# Servers to use as backup, later this should go in a file that is not +# under version control (the actual server that the tarbal comes from is +# irrelevant). +backupservers = http://akhlaghi.org/reproduce-software + # Building flags: # # C++ flags: when we build GCC, the C++ standard library needs to link with @@ -321,7 +326,7 @@ $(tarballs): $(tdir)/%: | $(lockdir) touch $(lockdir)/download downloader="wget --no-use-server-timestamps -O" $(downloadwrapper) "$$downloader" $(lockdir)/download \ - $$tarballurl "$@.unchecked" + $$tarballurl "$@.unchecked" "$(backupservers)" fi # Make sure this is the expected tarball. Note that we now have a diff --git a/reproduce/software/make/python.mk b/reproduce/software/make/python.mk index 8c7b6f0..2e74c16 100644 --- a/reproduce/software/make/python.mk +++ b/reproduce/software/make/python.mk @@ -259,7 +259,7 @@ $(pytarballs): $(tdir)/%: touch $(lockdir)/download downloader="wget --no-use-server-timestamps -O" $(downloadwrapper) "$$downloader" $(lockdir)/download \ - $$tarballurl "$@.unchecked" + $$tarballurl "$@.unchecked" "$(backupservers)" fi # Make sure this is the expected tarball. Note that we now have a -- cgit v1.2.1