swh.loader.package.rpm.loader module#

class swh.loader.package.rpm.loader.RpmPackageInfo(url: str, filename: str | None, version: str, name: str, intrinsic_version: str, build_time: str = None, checksums_str: str = None, *, directory_extrinsic_metadata: List[RawExtrinsicMetadataCore] = [], checksums: Dict[str, str] = {})[source]#

Bases: BasePackageInfo

Method generated by attrs for class RpmPackageInfo.

intrinsic_version#

Intrinsic version of the package, independent from the distribution (e.g. 1.18.0-5)

build_time#

31+00:00)

Type:

Build time of the package in iso format. (e.g. 2017-02-10T04

Type:

59

EXTID_TYPE: str = 'rpm-sha256'#
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: Dict[str, Any], version: str) RpmPackageInfo[source]#
class swh.loader.package.rpm.loader.RpmLoader(storage: StorageInterface, url: str, packages: Dict[str, Dict[str, Any]], **kwargs: Any)[source]#

Bases: PackageLoader[RpmPackageInfo]

RPM Loader implementation.

Parameters:
  • url – Origin url (e.g. rpm://Fedora/packages/nginx)

  • packages

    versioned packages and associated artifacts, example:

    {
      '34/Everything/1.18.0-5': {
        'name': 'nginx',
        'version': '1.18.0-5',
        'release': 34,
        'edition': 'Everything',
        'build_time': '2022-11-01T12:00:55+00:00',
        'url': 'https://archives.fedoraproject.org/nginx-1.18.0-5.fc34.src.rpm',
        'checksums': {
          'sha256': 'ac68fa26886c661b77bfb97bbe234a6c37d36a16c1eca126eabafbfc7fcb',
        }
      },
      # ...
    }
    

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

Returns the package versions sorted by build time

get_default_version() str[source]#

Get the latest release version of a rpm package

get_package_info(version: str) Iterator[Tuple[str, RpmPackageInfo]][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)

uncompress(dl_artifacts: List[Tuple[str, Mapping[str, Any]]], dest: str) str[source]#

Uncompress the artifact(s) in the destination folder dest.

Optionally, this could need to use the p_info dict for some more information (debian).

build_release(p_info: RpmPackageInfo, 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

extra_branches() Dict[bytes, Mapping[str, Any]][source]#

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

swh.loader.package.rpm.loader.extract_rpm_package(rpm_path: str, dest: str) str[source]#

Extracts an RPM package.