swh.loader.package.archive.loader module

class swh.loader.package.archive.loader.ArchivePackageInfo(url: str, filename: Optional[str], raw_info: Dict[str, Any], length: int, time: Union[str, datetime.datetime], version: str, *, revision_extrinsic_metadata: List[swh.loader.package.loader.RawExtrinsicMetadataCore] = [])[source]

Bases: swh.loader.package.loader.BasePackageInfo

length

Size of the archive file

time

Timestamp of the archive file on the server

ID_KEYS = ['time', 'url', 'length', 'version']
artifact_identity(id_keys=None)[source]
classmethod from_metadata(a_metadata: Dict[str, Any])swh.loader.package.archive.loader.ArchivePackageInfo[source]
class swh.loader.package.archive.loader.ArchiveLoader(*args, **kwds)[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) → Iterator[Tuple[str, swh.loader.package.archive.loader.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)

resolve_revision_from(known_artifacts: Dict, p_info: swh.loader.package.archive.loader.ArchivePackageInfo) → 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

  • p_info – Package information

Returns

None or revision identifier

build_revision(p_info: swh.loader.package.archive.loader.ArchivePackageInfo, 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
  • p_info – Package information

  • uncompressed_path – Artifact uncompressed path on disk

Returns

Revision object