Have fetch use list_url
This PR allows archive file retrieval from urls derived from the `list_url` setting in a package file. This allows for continued retrieval of checksummed archive files even when they are moved to a new remote location when a package is updated upstream.
This commit is contained in:
parent
7220bc1766
commit
b51be2bb1b
1 changed files with 13 additions and 0 deletions
|
@ -37,6 +37,7 @@
|
||||||
import spack.config
|
import spack.config
|
||||||
import spack.fetch_strategy as fs
|
import spack.fetch_strategy as fs
|
||||||
import spack.error
|
import spack.error
|
||||||
|
from spack.version import Version
|
||||||
|
|
||||||
STAGE_PREFIX = 'spack-stage-'
|
STAGE_PREFIX = 'spack-stage-'
|
||||||
|
|
||||||
|
@ -306,6 +307,18 @@ def fetch(self, mirror_only=False):
|
||||||
fetchers.insert(0, fs.URLFetchStrategy(url, digest))
|
fetchers.insert(0, fs.URLFetchStrategy(url, digest))
|
||||||
fetchers.insert(0, spack.cache.fetcher(self.mirror_path, digest))
|
fetchers.insert(0, spack.cache.fetcher(self.mirror_path, digest))
|
||||||
|
|
||||||
|
# Look for the archive in list_url
|
||||||
|
archive_version = spack.url.parse_version(self.default_fetcher.url)
|
||||||
|
package_name = os.path.dirname(self.mirror_path)
|
||||||
|
pkg = spack.repo.get(package_name)
|
||||||
|
versions = pkg.fetch_remote_versions()
|
||||||
|
try:
|
||||||
|
url_from_list = versions[Version(archive_version)]
|
||||||
|
fetchers.append(fs.URLFetchStrategy(url_from_list, digest))
|
||||||
|
except KeyError:
|
||||||
|
tty.msg("Can not find version %s in url_list" %
|
||||||
|
archive_version)
|
||||||
|
|
||||||
for fetcher in fetchers:
|
for fetcher in fetchers:
|
||||||
try:
|
try:
|
||||||
fetcher.set_stage(self)
|
fetcher.set_stage(self)
|
||||||
|
|
Loading…
Reference in a new issue