From a4f3fe2ac7997b25ed6358b5fffee728603cd2d5 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Fri, 4 Nov 2022 20:06:42 +0100 Subject: Deprecate old YAML format for buildcaches (#33707) --- lib/spack/spack/binary_distribution.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 3de0bcf9db..5ea7138a16 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -950,13 +950,13 @@ def generate_package_index(cache_prefix): .json) under cache_prefix. """ try: - file_list = ( + file_list = [ entry for entry in web_util.list_url(cache_prefix) if entry.endswith(".yaml") or entry.endswith("spec.json") or entry.endswith("spec.json.sig") - ) + ] except KeyError as inst: msg = "No packages at {0}: {1}".format(cache_prefix, inst) tty.warn(msg) @@ -969,6 +969,14 @@ def generate_package_index(cache_prefix): tty.warn(msg) return + if any(x.endswith(".yaml") for x in file_list): + msg = ( + "The mirror in '{}' contains specs in the deprecated YAML format.\n\n\tSupport for " + "this format will be removed in v0.20, please regenerate the build cache with a " + "recent Spack\n" + ).format(cache_prefix) + warnings.warn(msg) + tty.debug("Retrieving spec descriptor files from {0} to build index".format(cache_prefix)) tmpdir = tempfile.mkdtemp() @@ -1436,6 +1444,13 @@ def download_tarball(spec, unsigned=False, mirrors_for_spec=None): # the remaining mirrors, looking for one we can use. tarball_stage = try_fetch(spackfile_url) if tarball_stage: + if ext == "yaml": + msg = ( + "Reading {} from mirror.\n\n\tThe YAML format for buildcaches is " + "deprecated and will be removed in v0.20\n" + ).format(spackfile_url) + warnings.warn(msg) + return { "tarball_stage": tarball_stage, "specfile_stage": local_specfile_stage, -- cgit v1.2.3-70-g09d2