Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions pakages/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,11 @@ def push(self, uri=None, tag=None):
# Find all .spack archives in the cache
for archive in utils.recursive_find(self.cache_dir, ".spack"):

# Push a full hash
# Only push generic name - the full hash never hits
package_name = os.path.basename(archive)
full_name = "%s/%s:%s" % (uri, package_name, tag)
oras.push(full_name, archive, content_type=content_type)

# And a generic one
generic_name = utils.generalize_spack_archive(package_name)
full_name = "%s/%s:%s" % (uri, generic_name, tag)
oras.push(full_name, archive, content_type=content_type)
# TODO how to add sbom? separately?
# TODO we should support custom tags

def __repr__(self):
return str(self)
Expand Down
27 changes: 4 additions & 23 deletions pakages/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,6 @@ class PakInstaller(PackageInstaller):
We take this inline approach because we are not able to import it.
"""

def iter_artifact_names(self, registry, spec, tag):
"""
Given a registry
"""
name = bd.tarball_name(spec, ".spack")

uri = "%s/%s:%s" % (registry, name, tag)
yield name, uri

# Now try a generic name WITHOUT hash
generic_name = pakages.utils.generalize_spack_archive(name)
uri = "%s/%s:%s" % (registry, generic_name, tag)
yield generic_name, uri

def prepare_cache(self, registries=None, tag=None):
"""
Given that we have a build cache for a package, install it.
Expand Down Expand Up @@ -82,18 +68,13 @@ def prepare_cache(self, registries=None, tag=None):
# Try until we get a cache hit
artifact = None
for registry in registries:

# break for outer loop
name = bd.tarball_name(request.pkg.spec, ".spack")
generic_name = pakages.utils.generalize_spack_archive(name)
uri = "%s/%s:%s" % (registry, generic_name, tag)
artifact = oras.fetch(uri, os.path.join(tmpdir, name))
if artifact:
break

for name, uri in self.iter_artifact_names(
registry, request.pkg.spec, tag
):
artifact = oras.fetch(uri, os.path.join(tmpdir, name))
if artifact:
break

# Don't continue if not found
if not artifact:
shutil.rmtree(tmpdir)
Expand Down