swh.loader.package.archive.loader module

class swh.loader.package.archive.loader.ArchiveLoader(url: str, artifacts: Sequence[Mapping[str, Any]], identity_artifact_keys: Optional[Sequence[str]] = None)[source]

Bases: swh.loader.package.loader.PackageLoader

Load archive origin’s artifact files into swh archive

visit_type = 'tar'
get_versions() → Sequence[str][source]

Return the list of all 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) → Generator[Tuple[str, Mapping[str, Any]], None, None][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)

resolve_revision_from(known_artifacts: Dict, artifact_metadata: Dict) → Optional[bytes][source]

Resolve the revision from a snapshot and an artifact metadata dict.

If the artifact has already been downloaded, this will return the existing revision targeting that uncompressed artifact directory. Otherwise, this returns None.

Parameters
  • snapshot – Snapshot

  • artifact_metadata – Information dict

Returns

None or revision identifier

build_revision(a_metadata: Mapping[str, Any], uncompressed_path: str, directory: bytes) → Optional[swh.model.model.Revision][source]

Build the revision from the archive metadata (extrinsic artifact metadata) and the intrinsic metadata.

Parameters
  • a_metadata – Artifact metadata

  • uncompressed_path – Artifact uncompressed path on disk

Returns

SWH data dict