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.
This commit is contained in:
		 Adam J. Stewart
					Adam J. Stewart
				
			
				
					committed by
					
						 scheibelp
						scheibelp
					
				
			
			
				
	
			
			
			 scheibelp
						scheibelp
					
				
			
						parent
						
							583af6ef4f
						
					
				
				
					commit
					0f1a1ae94e
				
			| @@ -286,6 +286,13 @@ def find_versions_of_archive(archive_urls, list_url=None, list_depth=0): | |||||||
|     for aurl in archive_urls: |     for aurl in archive_urls: | ||||||
|         list_urls.add(spack.url.find_list_url(aurl)) |         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. |     # Grab some web pages to scrape. | ||||||
|     pages = {} |     pages = {} | ||||||
|     links = set() |     links = set() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user