swh.loader.package.maven.loader module#

class swh.loader.package.maven.loader.ArtifactDict[source]#

Bases: TypedDict

Data about a Maven artifact, passed by the Maven Lister.

time: str#

the time of the last update of jar file on the server as an iso8601 date string

url: str#

the artifact url to retrieve filename

filename: str | None#

optionally, the file’s name

gid: str#

artifact’s groupId

aid: str#

artifact’s artifactId

version: str#

artifact’s version

base_url: str#

root URL of the Maven instance

class swh.loader.package.maven.loader.MavenPackageInfo(url: str, filename: str | None, time: datetime, gid: str, aid: str, version: str, base_url: str, *, directory_extrinsic_metadata: List[RawExtrinsicMetadataCore] = [], checksums: Dict[str, str] = {})[source]#

Bases: BasePackageInfo

Method generated by attrs for class MavenPackageInfo.

time#

Timestamp of the last update of jar file on the server.

gid#

Group ID of the maven artifact

aid#

Artifact ID of the maven artifact

version#

Version of the maven artifact

base_url#

Root URL of the Maven instance

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.

EXTID_TYPE: str = 'maven-jar'#
EXTID_VERSION: int = 0#
classmethod from_metadata(a_metadata: ArtifactDict) MavenPackageInfo[source]#
class swh.loader.package.maven.loader.MavenLoader(storage: StorageInterface, url: str, artifacts: Sequence[ArtifactDict], **kwargs: Any)[source]#

Bases: PackageLoader[MavenPackageInfo]

Load source code jar origin’s artifact files into swh archive

Loader constructor.

For now, this is the lister’s task output. There is one, and only one, artefact (jar or zip) per version, as guaranteed by the Maven coordinates system.

Parameters:
  • url – Origin url

  • artifacts – List of single artifact information

visit_type: str = 'maven'#
get_versions() Sequence[str][source]#

Return the list of all published package versions.

Raises:

classswh.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_metadata_authority()[source]#

For package loaders that get extrinsic metadata, returns the authority the metadata are coming from.

build_extrinsic_directory_metadata(p_info: MavenPackageInfo, release_id: bytes, directory_id: bytes) List[RawExtrinsicMetadata][source]#
get_package_info(version: str) Iterator[Tuple[str, MavenPackageInfo]][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: MavenPackageInfo, 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