swh.loader.package.maven.loader module#
- class swh.loader.package.maven.loader.ArtifactDict[source]#
Bases:
TypedDictData about a Maven artifact, passed by the Maven Lister.
- 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:
BasePackageInfoMethod 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.
- classmethod from_metadata(a_metadata: ArtifactDict, session: Session) 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
- get_versions() Sequence[str][source]#
Return the list of all published package versions.
There is no need to sort that list, it is handled by
get_sorted_versions().- Raises:
class – swh.loader.exception.NotFound error when failing to read the published package versions.
- Returns:
Sequence of published versions
- 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
- download_package(p_info: MavenPackageInfo, tmpdir: str) List[Tuple[str, Mapping]][source]#
Download artifacts for a specific package. All downloads happen in in the tmpdir folder.
Default implementation expects the artifacts package info to be about one artifact per package.
Note that most implementation have 1 artifact per package. But some implementation have multiple artifacts per package (debian), some have none, the package is the artifact (gnu).
- Parameters:
artifacts_package_info – Information on the package artifacts to download (url, filename, etc…)
tmpdir – Location to retrieve such artifacts
- Returns:
List of (path, computed hashes)