From d3d98075c5acef075ff4a8dc7fac77597a2a3985 Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Thu, 1 Oct 2020 14:32:43 -0600 Subject: Fix fetch of spec.yaml files from buildcache (#19101) Since those files currently exist in buildcaches (in S3 buckets) with potentially different content types, we should be less restrictive in what content types we accept when attempting to fetch them. This PR removes the content type constraint so any file with the matching name will be found. --- lib/spack/spack/binary_distribution.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 242a1d2b66..c14c84e346 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -271,8 +271,7 @@ class BinaryDistributionCacheManager(object): # Fetch the hash first so we can check if we actually need to fetch # the index itself. try: - _, _, fs = web_util.read_from_url( - hash_fetch_url, 'text/plain') + _, _, fs = web_util.read_from_url(hash_fetch_url) fetched_hash = codecs.getreader('utf-8')(fs).read() except (URLError, web_util.SpackWebError) as url_err: tty.debug('Unable to read index hash {0}'.format( @@ -288,8 +287,7 @@ class BinaryDistributionCacheManager(object): # Fetch index itself try: - _, _, fs = web_util.read_from_url( - index_fetch_url, 'application/json') + _, _, fs = web_util.read_from_url(index_fetch_url) index_object_str = codecs.getreader('utf-8')(fs).read() except (URLError, web_util.SpackWebError) as url_err: tty.debug('Unable to read index {0}'.format(index_fetch_url), @@ -1162,8 +1160,7 @@ def try_direct_fetch(spec, force=False, full_hash_match=False): mirror.fetch_url, _build_cache_relative_path, specfile_name) try: - _, _, fs = web_util.read_from_url( - buildcache_fetch_url, 'text/plain') + _, _, fs = web_util.read_from_url(buildcache_fetch_url) fetched_spec_yaml = codecs.getreader('utf-8')(fs).read() except (URLError, web_util.SpackWebError, HTTPError) as url_err: tty.debug('Did not find {0} on {1}'.format( -- cgit v1.2.3-60-g2f50