swh.loader.package.puppet.loader module#

class swh.loader.package.puppet.loader.PuppetPackageInfo(url: str, name: str, filename: str, version: str, last_modified: datetime, *, directory_extrinsic_metadata: List[RawExtrinsicMetadataCore] = [], checksums: Dict[str, str] = {})[source]#

Bases: BasePackageInfo

Method generated by attrs for class PuppetPackageInfo.

name#

Name of the package

filename#

Archive (tar.gz) file name

version#

Current version

last_modified#

Module last update date as release date

swh.loader.package.puppet.loader.extract_intrinsic_metadata(dir_path: Path) Dict[str, Any][source]#

Extract intrinsic metadata from metadata.json file at dir_path.

Each Puppet module version has a metadata.json file at the root of the archive.

See https://puppet.com/docs/puppet/7/modules_metadata.html for metadata specifications.

Parameters:

dir_path – A directory on disk where a metadata.json file must be present

Returns:

A dict mapping from json parser

class swh.loader.package.puppet.loader.PuppetLoader(storage: StorageInterface, url: str, artifacts: List[Dict[str, Any]], **kwargs)[source]#

Bases: PackageLoader[PuppetPackageInfo]

Loader’s constructor. This raises exception if the minimal required

configuration is missing (cf. fn:check method).

Parameters:
  • storage – Storage instance

  • url – Origin url to load data from

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

Get all released versions of a Puppet module

Returns:

A sequence of versions

Example:

["0.1.1", "0.10.2"]

origin: Origin#
loaded_snapshot_id: Optional[bytes]#
parent_origins: Optional[List[Origin]]#

If the given origin is a “forge fork” (ie. created with the “Fork” button of GitHub-like forges), build_extrinsic_origin_metadata() sets this to a list of origins it was forked from; closest parent first.

get_default_version() str[source]#

Get the newest release version of a Puppet module

Returns:

A string representing a version

Example:

"0.10.2"

get_package_info(version: str) Iterator[Tuple[str, PuppetPackageInfo]][source]#

Get release name and package information from version

Parameters:

version – Package version (e.g: “0.1.0”)

Returns:

Iterator of tuple (release_name, p_info)

build_release(p_info: PuppetPackageInfo, uncompressed_path: str, directory: bytes) Optional[Release][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