spack.mirrors package
Submodules
spack.mirrors.layout module
- class spack.mirrors.layout.DefaultLayout(alias_path: str, digest_path: str | None = None)[source]
Bases:
MirrorLayout
- class spack.mirrors.layout.MirrorLayout(path: str)[source]
Bases:
object
A
MirrorLayout
object describes the relative path of a mirror entry.
- class spack.mirrors.layout.OCILayout(digest: Digest)[source]
Bases:
MirrorLayout
Follow the OCI Image Layout Specification to archive blobs where paths are of the form
blobs/<algorithm>/<digest>
- spack.mirrors.layout.default_mirror_layout(fetcher: FetchStrategy, per_package_ref: str, spec: Spec | None = None) MirrorLayout [source]
Returns a
MirrorReference
object which keeps track of the relative storage path of the resource associated with the specifiedfetcher
.
spack.mirrors.mirror module
- class spack.mirrors.mirror.Mirror(data: str | dict, name: str | None = None)[source]
Bases:
object
Represents a named location for storing source tarballs and binary packages.
Mirrors have a fetch_url that indicate where and how artifacts are fetched from them, and a push_url that indicate where and how artifacts are pushed to them. These two URLs are usually the same.
- property binary
- property fetch_url
Get the valid, canonicalized fetch URL
- static from_url(url: str)[source]
Create an anonymous mirror by URL. This method validates the URL.
- get_credentials(direction: str) Dict[str, Any] [source]
Get the mirror credentials from the mirror config
- Parameters:
direction – fetch or push mirror config
- Returns:
Dictionary from credential type string to value
- Credential Type Map:
access_token -> str access_pair -> tuple(str,str) profile -> str
- property name
- property push_url
Get the valid, canonicalized fetch URL
- property source
- class spack.mirrors.mirror.MirrorCollection(mirrors=None, scope=None, binary: bool | None = None, source: bool | None = None, autopush: bool | None = None)[source]
Bases:
Mapping
A mapping of mirror names to mirrors.
- spack.mirrors.mirror.supported_url_schemes = ('file', 'http', 'https', 'sftp', 'ftp', 's3', 'gs', 'oci')
What schemes do we support
spack.mirrors.utils module
- spack.mirrors.utils.create(path, specs, skip_unstable_versions=False)[source]
Create a directory to be used as a spack mirror, and fill it with package archives.
- Parameters:
path – Path to create a mirror directory hierarchy in.
specs – Any package versions matching these specs will be added to the mirror.
skip_unstable_versions – if true, this skips adding resources when they do not have a stable archive checksum (as determined by
fetch_strategy.stable_target
)
- Return Value:
Returns a tuple of lists: (present, mirrored, error)
present: Package specs that were already present.
mirrored: Package specs that were successfully mirrored.
error: Package specs that failed to mirror due to some error.
- spack.mirrors.utils.create_mirror_from_package_object(pkg_obj, mirror_cache: MirrorCache, mirror_stats: MirrorStats) bool [source]
Add a single package object to a mirror.
The package object is only required to have an associated spec with a concrete version.
- Parameters:
pkg_obj (spack.package_base.PackageBase) – package object with to be added.
mirror_cache – mirror where to add the spec.
mirror_stats – statistics on the current mirror
- Returns:
True if the spec was added successfully, False otherwise
- spack.mirrors.utils.get_all_versions(specs)[source]
Given a set of initial specs, return a new set of specs that includes each version of each package in the original set.
Note that if any spec in the original set specifies properties other than version, this information will be omitted in the new set; for example; the new set of specs will not include variant settings.
- spack.mirrors.utils.get_matching_versions(specs, num_versions=1)[source]
Get a spec for EACH known version matching any spec in the list. For concrete specs, this retrieves the concrete version and, if more than one version per spec is requested, retrieves the latest versions of the package.
- spack.mirrors.utils.mirror_cache_and_stats(path, skip_unstable_versions=False)[source]
Return both a mirror cache and a mirror stats, starting from the path where a mirror ought to be created.
- Parameters:
path (str) – path to create a mirror directory hierarchy in.
skip_unstable_versions – if true, this skips adding resources when they do not have a stable archive checksum (as determined by
fetch_strategy.stable_target
)