swh.loader.package.archive.loader module#
- class swh.loader.package.archive.loader.ArchivePackageInfo(url: str, filename: str | None, version: str, raw_info: Dict[str, Any], length: int, time: str | datetime, *, directory_extrinsic_metadata: List[RawExtrinsicMetadataCore] = [], checksums: Dict[str, str] = {})[source]#
Bases:
BasePackageInfo
Method generated by attrs for class ArchivePackageInfo.
- length#
Size of the archive file
- time#
Timestamp of the archive file on the server
- MANIFEST_FORMAT: Template | None = <string.Template object>#
If not None, used by the default extid() implementation to format a manifest, before hashing it to produce an ExtID.
- class swh.loader.package.archive.loader.ArchiveLoader(storage: StorageInterface, url: str, artifacts: Sequence[Dict[str, Any]], extid_manifest_format: str | None = None, snapshot_append: bool = False, **kwargs: Any)[source]#
Bases:
PackageLoader
[ArchivePackageInfo
]Load archive origin’s artifact files into swh archive
- Loader’s constructor. This raises exception if the minimal required
configuration is missing (cf. fn:check method).
- Parameters:
storage – Storage instance
url – Origin url to load data from
- get_versions() Sequence[str] [source]#
Return the list of all published package versions.
- Raises:
class – swh.loader.exception.NotFound error when failing to read the published package versions.
- Returns:
Sequence of published versions
- get_default_version() str [source]#
Retrieve the latest release version if any.
- Returns:
Latest version
- get_package_info(version: str) Iterator[Tuple[str, ArchivePackageInfo]] [source]#
- Given a release version of a package, retrieve the associated
package information for such version.
- Parameters:
version – Package version
- Returns:
(branch name, package metadata)
- build_release(p_info: ArchivePackageInfo, uncompressed_path: str, directory: bytes) Release | None [source]#
Build the release from the archive metadata (extrinsic artifact metadata) and the intrinsic metadata.
- Parameters:
p_info – Package information
uncompressed_path – Artifact uncompressed path on disk