buildcache: ignore errors of newer buildcache version (#40279)

Currently buildcaches are forward incompatible in an annoying way: spack
errors out when trying to use them.

With this change, you just get a warning.
This commit is contained in:
Harmen Stoppels 2023-10-02 14:51:48 +02:00 committed by GitHub
parent a9dcba76ce
commit 6c4ce379ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -216,11 +216,11 @@ def _associate_built_specs_with_mirror(self, cache_key, mirror_url):
with self._index_file_cache.read_transaction(cache_key):
db._read_from_file(cache_path)
except spack_db.InvalidDatabaseVersionError as e:
msg = (
tty.warn(
f"you need a newer Spack version to read the buildcache index for the "
f"following mirror: '{mirror_url}'. {e.database_version_message}"
)
raise BuildcacheIndexError(msg) from e
return
spec_list = db.query_local(installed=False, in_buildcache=True)