thoth.package_extract package

Submodules

thoth.package_extract.cli module

Command line interface for thoth-package-extract.

thoth.package_extract.core module

Implementation of core routines for thoth-package-extract.

thoth.package_extract.core.extract_buildlog(input_text: str) → List[dict][source]

Extract Docker image build log and get all installed packages based on ecosystem.

thoth.package_extract.core.extract_image(image_name: str, timeout: int = None, *, registry_credentials: str = None, tls_verify: bool = True) → dict[source]

Extract dependencies from an image.

thoth.package_extract.exceptions module

Exception hierarchy in thoth-package-extract tool.

exception thoth.package_extract.exceptions.InvalidImageError[source]

Bases: thoth.package_extract.exceptions.ThothPkgdepsException

Raised on invalid Docker image.

exception thoth.package_extract.exceptions.NotSupported[source]

Bases: thoth.package_extract.exceptions.ThothPkgdepsException

Raised on requesting an unsupported operation.

exception thoth.package_extract.exceptions.ThothPkgdepsException[source]

Bases: Exception

A base exception in the thoth-package-extract exception hierarchy.

exception thoth.package_extract.exceptions.TimeoutExpired[source]

Bases: thoth.package_extract.exceptions.ThothPkgdepsException

Raised on command timeout.

thoth.package_extract.image module

Manipulation with an image and image scanning.

thoth.package_extract.image.construct_rootfs(dir_path: str, rootfs_path: str) → list[source]

Construct rootfs in a directory by extracting layers.

thoth.package_extract.image.download_image(image_name: str, dir_path: str, timeout: int = None, registry_credentials: str = None, tls_verify: bool = True) → None[source]

Download an image to dir_path.

thoth.package_extract.image.run_analyzers(path: str, timeout: int = None) → dict[source]

Run analyzers on the given path (directory) and extract found packages.

thoth.package_extract.rpmlib module

Functionality copied from kobo.

Even though copying code is not nice at all, this is better to have copied. Assuming naming is mature and stable enough, it should be safe to have them there.

The original code can be found at:

https://github.com/release-engineering/kobo/blob/master/kobo/rpmlib.py

Note we used code from Koji before, but that looks to be broken in some cases.

thoth.package_extract.rpmlib.parse_nvr(nvre)[source]

Split N-V-R into a dictionary.

@param nvre: N-V-R:E, E:N-V-R or N-E:V-R string @type nvre: str @return: {name, version, release, epoch} @rtype: dict

thoth.package_extract.rpmlib.parse_nvra(nvra)[source]

Split N-V-R.A[.rpm] into a dictionary.

@param nvra: N-V-R:E.A[.rpm], E:N-V-R.A[.rpm], N-V-R.A[.rpm]:E or N-E:V-R.A[.rpm] string @type nvra: str @return: {name, version, release, epoch, arch} @rtype: dict

thoth.package_extract.rpmlib.split_nvr_epoch(nvre)[source]

Split nvre to N-V-R and E.

@param nvre: E:N-V-R or N-V-R:E string @type nvre: str @return: (N-V-R, E) @rtype: (str, str)

Module contents

Extraction of installed packages for project Thoth.