From b51be2bb1bc9dd3c422af2f159c94bc0277fcecc Mon Sep 17 00:00:00 2001 From: Glenn Johnson Date: Sat, 23 Jul 2016 18:11:09 -0500 Subject: [PATCH] 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. --- lib/spack/spack/stage.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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.config import spack.fetch_strategy as fs import spack.error +from spack.version import Version STAGE_PREFIX = 'spack-stage-' @@ -306,6 +307,18 @@ def fetch(self, mirror_only=False): 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)