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, *, directory_extrinsic_metadata: List[swh.loader.package.loader.RawExtrinsicMetadataCore] = [])[source]

Bases: swh.loader.package.loader.BasePackageInfo

Method generated by attrs for class ArchivePackageInfo.


Size of the archive file


Timestamp of the archive file on the server

MANIFEST_FORMAT: Optional[string.Template] = <string.Template object>

If not None, used by the default extid() implementation to format a manifest, before hashing it to produce an ExtID.

extid(manifest_format: Optional[string.Template] = None) Tuple[str, bytes][source]

Returns a unique intrinsic identifier of this package info

manifest_format allows overriding the class’ default MANIFEST_FORMAT

classmethod from_metadata(a_metadata: Dict[str, Any]) swh.loader.package.archive.loader.ArchivePackageInfo[source]
class swh.loader.package.archive.loader.ArchiveLoader(storage: swh.storage.interface.StorageInterface, url: str, artifacts: Sequence[Dict[str, Any]], extid_manifest_format: Optional[str] = None, max_content_size: Optional[int] = None, snapshot_append: bool = False)[source]

Bases: swh.loader.package.loader.PackageLoader[swh.loader.package.archive.loader.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).

  • storage – Storage instance

  • url – Origin url to load data from

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

Return the list of all published package versions.


classswh.loader.exception.NotFound error when failing to read the published package versions.


Sequence of published versions

get_default_version() str[source]

Retrieve the latest release version if any.


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.


version – Package version


(branch name, package metadata)

new_packageinfo_to_extid(p_info: swh.loader.package.archive.loader.ArchivePackageInfo) Optional[Tuple[str, bytes]][source]
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.

  • p_info – Package information

  • uncompressed_path – Artifact uncompressed path on disk


Revision object

visit_date: datetime.datetime
extra_branches() Dict[bytes, Mapping[str, Any]][source]

Return an extra dict of branches that are used to update the set of branches.