Fail fast in stage if all fetch strategies fail for a package.

This commit is contained in:
Todd Gamblin 2014-12-02 09:58:30 -08:00
parent d2fe038caf
commit e71cf672f1
2 changed files with 12 additions and 2 deletions

View file

@ -156,9 +156,10 @@ def fetch(self):
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 @@ def fetch(self):
"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.

View file

@ -260,6 +260,8 @@ def fetch(self):
tty.msg("Fetching from %s failed." % fetcher)
tty.debug(e)
continue
else:
tty.die("All fetchers failed for %s" % self.name)
def check(self):