Deprecate old YAML format for buildcaches (#33707)

This commit is contained in:
Massimiliano Culpo 2022-11-04 20:06:42 +01:00 committed by GitHub
parent b6da8635ec
commit a4f3fe2ac7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,