summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2018-06-12 12:33:47 -0500
committerscheibelp <scheibel1@llnl.gov>2018-06-12 10:33:47 -0700
commit0f1a1ae94e9b5f6e147bf13dae44a3af8d46c8fa (patch)
tree3401b07d427a4e17d1cd78bdd0980e9c1dd93ceb
parent583af6ef4fbeabebcaac1899bd902075bc46fb12 (diff)
downloadspack-0f1a1ae94e9b5f6e147bf13dae44a3af8d46c8fa.tar.gz
spack-0f1a1ae94e9b5f6e147bf13dae44a3af8d46c8fa.tar.bz2
spack-0f1a1ae94e9b5f6e147bf13dae44a3af8d46c8fa.tar.xz
spack-0f1a1ae94e9b5f6e147bf13dae44a3af8d46c8fa.zip
Add trailing slash when spidering URLs for versions (#8429)
By default, if a package does not specify a list_url and does not download from a common repository, Spack runs dirname on the package URL. Given a URL like https://root.cern.ch/download/root_v6.09.02.source.tar.gz, this returns https://root.cern.ch/download. However, https://root.cern.ch/download gives a 404, while https://root.cern.ch/download/ works just fine. Note that some servers *don't* work with a trailing slash, so this tries with and without the slash. This will double the number of URLs searched but the slowdown should only affect the "spack versions" command.
-rw-r--r--lib/spack/spack/util/web.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/spack/spack/util/web.py b/lib/spack/spack/util/web.py
index f694b49e7a..b9f94fcc35 100644
--- a/lib/spack/spack/util/web.py
+++ b/lib/spack/spack/util/web.py
@@ -286,6 +286,13 @@ def find_versions_of_archive(archive_urls, list_url=None, list_depth=0):
for aurl in archive_urls:
list_urls.add(spack.url.find_list_url(aurl))
+ # Add '/' to the end of the URL. Some web servers require this.
+ additional_list_urls = set()
+ for lurl in list_urls:
+ if not lurl.endswith('/'):
+ additional_list_urls.add(lurl + '/')
+ list_urls.update(additional_list_urls)
+
# Grab some web pages to scrape.
pages = {}
links = set()