pakages.builders.spack package

Submodules

pakages.builders.spack.cache module

class pakages.builders.spack.cache.BuildCache(spec_name, cache_dir=None, username=None, email=None, settings=None)[source]

Bases: object

A controller that makes it easy to create a build cache and install to it. We require that it is specific to one spec for now.

add_as_mirror(name)[source]

Add the cache directory to spack as a filesystem mirror

This currently downloads and adds to /tmp, and we issue a warning to the user. I’m not sure how people will want to install from caches but for the time being I’m making it a temporary interaction.

create(specs, key=None)[source]

Create the build cache with some number of specs

Ideally we could do spack buildcache add but that isn’t supported.

get_spec_uri()[source]

Given a spec, return the unique resource identifier for the remote cache.

load_spec()[source]

Given a name at creation, find the corresponding spec json to load

push(uri=None, tag=None)[source]

Push the build cache to an OCI registry (compatible with ORAS)

remove()[source]

Delete the entire build cache

pakages.builders.spack.client module

class pakages.builders.spack.client.SpackClient(*args, **kwargs)[source]

Bases: PakagesClient

Pakages has a main controller for interacting with pakages.

add_repository(path)[source]

Add a repository.

Given a path that exists, add the repository to the underlying spack. If you need to add a GitHub uri, create a pakages.repo.PakRepo first.

build(packages, cache_dir=None, key=None, **kwargs)[source]

Build a package into a cache

download_cache(target, download_dir=None)[source]

Download a target to a cache download directory

install(packages, **kwargs)[source]

Install one or more packages.

list_installed()[source]

List installed packages

parse_package_request(packages)[source]

Parse the packages and repo (if any) from it. This is shared between install and build

parse_packages(packages)[source]

Helper function to ensure we return consistent names.

uninstall(packages)[source]

Uninstall a spack package

pakages.builders.spack.sbom module

pakages.builders.spack.sbom.generate_sbom(pkg)[source]

Generates the sbom based on best practices suggested in the guide.

This function used to import spack.main and spack.spec, but we have fallen back to calling spack on the command line because it is not reliable to use from Python as a native python API. After that change, the metadata is not very good. We don’t really use it, so it’s fine.

pakages.builders.spack.sbom.generate_sbom_file(spec, out_dir)[source]

Generate an sbom for a spec (currently not used)

pakages.builders.spack.sbom.generate_timestamp_now()[source]
pakages.builders.spack.sbom.get_component(spec)[source]

Given a spec, get a component for it.

pakages.builders.spack.utils module

pakages.builders.spack.utils.ensure_spack_on_path()[source]

Ensure spack is on the path.

pakages.builders.spack.utils.generalize_spack_archive(name)[source]

Helper function to consistently return the archive name with arch, os, no build hash

pakages.builders.spack.utils.install_spack(repo=None, branch=None)[source]

Install spack to pakages/spack (note this is not used).

Module contents