diff options
author | Glenn Johnson <glenn-johnson@uiowa.edu> | 2016-07-23 18:11:09 -0500 |
---|---|---|
committer | Glenn Johnson <glenn-johnson@uiowa.edu> | 2016-07-23 19:09:58 -0500 |
commit | b51be2bb1bc9dd3c422af2f159c94bc0277fcecc (patch) | |
tree | 5f9796221fdd971c1eeb264f404b626a2beda2ef | |
parent | 7220bc1766a7c76e53464b009a5816c40f606575 (diff) | |
download | spack-b51be2bb1bc9dd3c422af2f159c94bc0277fcecc.tar.gz spack-b51be2bb1bc9dd3c422af2f159c94bc0277fcecc.tar.bz2 spack-b51be2bb1bc9dd3c422af2f159c94bc0277fcecc.tar.xz spack-b51be2bb1bc9dd3c422af2f159c94bc0277fcecc.zip |
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.
-rw-r--r-- | lib/spack/spack/stage.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index b08cce43b8..0914afe3a7 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -37,6 +37,7 @@ import spack import spack.config import spack.fetch_strategy as fs import spack.error +from spack.version import Version STAGE_PREFIX = 'spack-stage-' @@ -306,6 +307,18 @@ class Stage(object): fetchers.insert(0, fs.URLFetchStrategy(url, 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: try: fetcher.set_stage(self) |