swh.loader.package.puppet.loader module#
- class swh.loader.package.puppet.loader.PuppetPackageInfo(url: str, name: str, filename: str, version: str, last_modified: datetime, sha256_checksum: str, *, directory_extrinsic_metadata: List[RawExtrinsicMetadataCore] = [], checksums: Dict[str, str] = {})[source]#
Bases:
BasePackageInfoMethod 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.htmlfor metadata specifications.- Parameters:
dir_path – A directory on disk where a puppet package was unpacked
- 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
- FORGEAPI_BASE_URL = 'https://forgeapi.puppet.com'#
- METADATA_URL = 'https://forgeapi.puppet.com/v3/releases?module={module}'#
- extrinsic_metadata() Dict[source]#
Return the project metadata information (fetched from Puppet forge API)
- get_metadata_authority()[source]#
For package loaders that get extrinsic metadata, returns the authority the metadata are coming from.
- 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"]
- 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) 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