summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-09-29 23:28:16 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-09-29 23:28:16 -0700
commit921a5b5bcc43de88ced7ec9e2fdd5d3dc8eebd21 (patch)
treeda6a8dcfe03ddaa0f064cae735750c4b80387354
parent26495ddce940dbf47c8b1bc84d4fdb8ff61217df (diff)
downloadspack-921a5b5bcc43de88ced7ec9e2fdd5d3dc8eebd21.tar.gz
spack-921a5b5bcc43de88ced7ec9e2fdd5d3dc8eebd21.tar.bz2
spack-921a5b5bcc43de88ced7ec9e2fdd5d3dc8eebd21.tar.xz
spack-921a5b5bcc43de88ced7ec9e2fdd5d3dc8eebd21.zip
Make fetch fail on 404.
-rw-r--r--lib/spack/spack/stage.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
index 3dac798396..e2e156e916 100644
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -224,6 +224,7 @@ class Stage(object):
# Run curl but grab the mime type from the http headers
headers = spack.curl('-#', # status bar
'-O', # save file to disk
+ '-f', # fail on >400 errors
'-D', '-', # print out HTML headers
'-L', url,
return_output=True, fail_on_error=False)
@@ -233,6 +234,10 @@ class Stage(object):
if self.archive_file:
os.remove(self.archive_file)
+ if spack.curl.returncode == 22:
+ # This is a 404. Curl will print the error.
+ raise FailedDownloadError(url)
+
if spack.curl.returncode == 60:
# This is a certificate error. Suggest spack -k
raise FailedDownloadError(