RPM Toolkit¶
RPM-related classes and procedures.
-
class
rpmrh.rpm.
Metadata
(name: str, version: str, release: str, epoch: Union[str, bytes, int, None] = 0, arch: Optional[str] = 'src')[source]¶ Generic RPM metadata.
This class should act as a basis for all the RPM-like objects, providing common comparison and other “dunder” methods.
-
name
¶ RPM name
-
version
¶ RPM version
-
release
¶ RPM release
-
epoch
¶ Optional RPM epoch
-
arch
¶ RPM architecture
-
classmethod
from_nevra
(nevra: str) → rpmrh.rpm.Metadata[source]¶ Parse a string NEVRA and converts it to respective fields.
Keyword Arguments: nevra – The name-epoch:version-release-arch to parse. Returns: New instance of Metadata. Raises: ValueError
– The nevra argument is not valid NEVRA string.
-
nvr
¶ name-version-release
string of the RPM object
-
nevra
¶ name-epoch:version-release.arch
string of the RPM object
-
label
¶ Label compatible with RPM’s C API.
-
canonical_file_name
¶ Canonical base file name of a package with this metadata.
-
-
class
rpmrh.rpm.
LocalPackage
(path: Union[str, pathlib.Path], metadata: rpmrh.rpm.Metadata = NOTHING)[source]¶ Existing RPM package on local file system.
-
path
¶ Resolved path to the RPM package
-
metadata
¶ Metadata of the package
-
-
rpmrh.rpm.
shorten_dist_tag
(metadata: rpmrh.rpm.Metadata) → rpmrh.rpm.Metadata[source]¶ Shorten release string by removing extra parts of dist tag.
Examples
- abcde-1.0-1.el7_4 → abcde-1.0-1.el7
- binutils-3.6-4.el8+4 → binutils-3.6-4.el8
- abcde-1.0-1.fc27 → abcde-1.0-1.fc27
Keyword Arguments: metadata – The metadata to shorten. Returns: Potentially modified metadata.