From e71cf672f19565b8cc5b7f1aaec33dca6a3a74f4 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 2 Dec 2014 09:58:30 -0800 Subject: Fail fast in stage if all fetch strategies fail for a package. --- lib/spack/spack/fetch_strategy.py | 12 ++++++++++-- lib/spack/spack/stage.py | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index d48b999ddc..0e848652ae 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -156,9 +156,10 @@ class URLFetchStrategy(FetchStrategy): if spack.curl.returncode == 22: # This is a 404. Curl will print the error. - raise FailedDownloadError(self.url) + raise FailedDownloadError( + self.url, "URL %s was not found!" % self.url) - if spack.curl.returncode == 60: + elif spack.curl.returncode == 60: # This is a certificate error. Suggest spack -k raise FailedDownloadError( self.url, @@ -168,6 +169,13 @@ class URLFetchStrategy(FetchStrategy): "can try running spack -k, which will not check SSL certificates." "Use this at your own risk.") + else: + # This is some other curl error. Curl will print the + # error, but print a spack message too + raise FailedDownloadError( + self.url, "Curl failed with error %d", spack.curl.returncode) + + # Check if we somehow got an HTML file rather than the archive we # asked for. We only look at the last content type, to handle # redirects properly. diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index f09346ab9b..84454c9d2c 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -260,6 +260,8 @@ class Stage(object): tty.msg("Fetching from %s failed." % fetcher) tty.debug(e) continue + else: + tty.die("All fetchers failed for %s" % self.name) def check(self): -- cgit v1.2.3-70-g09d2