Skip to content
Snippets Groups Projects
Unverified Commit c36d9f29 authored by Todd Gamblin's avatar Todd Gamblin
Browse files

bugfix: mirror path works for unknown versions (#13626)

`mirror_archive_path` was failing to account for the case where the fetched version isn't known to Spack.

- [x] don't require the fetched version to be in `Package.versions`
- [x] add regression test for mirror paths when package does not have a version
parent b44df293
No related branches found
No related tags found
No related merge requests found
...@@ -303,8 +303,8 @@ def mirror_archive_paths(fetcher, per_package_ref, spec=None): ...@@ -303,8 +303,8 @@ def mirror_archive_paths(fetcher, per_package_ref, spec=None):
storage path of the resource associated with the specified ``fetcher``.""" storage path of the resource associated with the specified ``fetcher``."""
ext = None ext = None
if spec: if spec:
ext = spec.package.versions[spec.package.version].get( versions = spec.package.versions.get(spec.package.version, {})
'extension', None) ext = versions.get('extension', None)
# If the spec does not explicitly specify an extension (the default case), # If the spec does not explicitly specify an extension (the default case),
# then try to determine it automatically. An extension can only be # then try to determine it automatically. An extension can only be
# specified for the primary source of the package (e.g. the source code # specified for the primary source of the package (e.g. the source code
......
...@@ -146,6 +146,12 @@ def test_all_mirror( ...@@ -146,6 +146,12 @@ def test_all_mirror(
repos.clear() repos.clear()
def test_mirror_archive_paths_no_version(mock_packages, config, mock_archive):
spec = Spec('trivial-install-test-package@nonexistingversion')
fetcher = spack.fetch_strategy.URLFetchStrategy(mock_archive.url)
spack.mirror.mirror_archive_paths(fetcher, 'per-package-ref', spec)
def test_mirror_with_url_patches(mock_packages, config, monkeypatch): def test_mirror_with_url_patches(mock_packages, config, monkeypatch):
spec = Spec('patch-several-dependencies') spec = Spec('patch-several-dependencies')
spec.concretize() spec.concretize()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment