kojismokydingo.dnf¶
Koji Smoky Dingo - DNF ease-of-use wrappers
- since:
2.1
- author:
Christopher O'Brien <obriencj@gmail.com>
- license:
GPL v3
Bases:
BadDingo
Raised when an API calls a function in this module which requires the system dnf package, but dnf isn't available
- Since:
2.1
- class DNFuq(path, label='koji', arch=None, cachedir=None, cacheonly=False)[source]¶
Bases:
object
Utility class for creating queries against a DNF repository. Takes care of most of the dnf wiring lazily.
- Since:
2.1
- Parameters:
path (str) -- path or URL to the repository
label (str) -- repository label, for use in storing the repository cache
arch (str) -- override the architecture. By default the local system architecture is used.
cachedir (str) -- the base directory for storing repository caches. If omitted the system temp directory will be used.
cacheonly (bool)
- query()[source]¶
produces a new query for use against the repository
- Raises:
DNFUnavailable -- if the dnf module is not available
- Return type:
- search(keys=None, ownsfiles=None, whatconflicts=None, whatdepends=None, whatobsoletes=None, whatprovides=None, whatrequires=None, whatrecommends=None, whatenhances=None, whatsuggests=None, whatsupplements=None)[source]¶
produces a new query against the repository, with the given search keys and filters applied
- Parameters:
keys (List[str]) -- search terms. All items are matched if these are omitted.
ownsfiles (List[str]) -- limit to matches owning files in this list
whatconflicts (List[str]) -- limit to matches that have matching Conflicts header
whatdepends (List[str]) -- limit to matches that have matching Depends header
whatobsoletes (List[str]) -- limit to matches that have matching Obsoletes header
whatprovides (List[str]) -- limit to matches that have matching Provides header
whatrequires (List[str]) -- limit to matches that have matching Requires header
whatrecommends (List[str]) -- limit to matches that have matching Recommends header
whatenhances (List[str]) -- limit to matches that have matching Enhances header
whatsuggests (List[str]) -- limit to matches that have matching Suggests header
whatsupplements (List[str]) -- limit to matches that have matching Supplements header
- Returns:
query with the given filters applied
- Return type:
- class DNFuqFilterTerms[source]¶
Bases:
TypedDict
Represents the available filters applicable to the
DNFuq.search
method- Since:
2.1
- correlate_query_builds(session, found, err=False)[source]¶
Given a list of dnf query result Packages, correlate the packages back to koji builds. This uses a simple heuristic based on the sourcerpm header of the package. If the sourcerpm header is not available, then an NVR is guessed from the package source_name, version, and release.
- Parameters:
session (ClientSession) -- an active koji client session
found (List[dnf.package.Package]) -- the results of a dnf query, to be correlated back to koji build infos based on their source_name, version, and release
err (bool) -- whether to raise an error if a build could not be found. If err is False (the default), then any missing builds will be represented as a None value
- Returns:
list of tuples. Each tuple contains the initial DNF Package and the correlated koji build info dict
- Raises:
NoSuchBuild -- if err is True and a build could be correlated for a given DNF package
- Since:
2.1
- Return type:
- dnf_available()[source]¶
True if the dnf package and assorted internals could be successfully imported. False otherwise.
- Since:
2.1
- dnf_base(cachedir, arch=None, cacheonly=False)[source]¶
produces a dnf main configuration appropriate for use outside of managing a local system
- Parameters:
- Returns:
a prepared DNF base
- Raises:
DNFUnavailable -- if the dnf module is not available
ValueError -- if cachedir is not suppled
- Since:
2.1
- Return type:
dnf.base.Base
- dnf_sack(base, path, label='koji')[source]¶
Creates a dnf sack with a single repository, in order for queries to be created against that repo.
- Parameters:
- Raises:
DNFUnavailable -- if the dnf module is not availaable
- Returns:
a DNF sack for use in generating queries
- Since:
2.1
- Return type:
- dnfuq(path, label='koji', arch=None, cachedir=None, cacheonly=False)[source]¶
context manager providing a DNFuq instance configured with either a re-usable or temporary cache directory.
- Parameters:
path (str) -- path or URL to the repository
label (str) -- repository label, for use in storing the repository cache
arch (str) -- override the architecture. By default the local system architecture is used.
cachedir (str) -- the base directory for storing repository caches. If omitted the system temp directory will be used, and the cache will be deleted afterwards.
cacheonly (bool)
- Raises:
DNFUnavailable -- if the dnf module is not available
- Since:
2.1
- Return type:
- dnfuq_formatter(queryformat)[source]¶
Produces a formatter function based on a queryformat input string. This formatter can be invoked with three parameters -- a hawkey package, a build info dict, and a tag info dict. The result will be a sequence of one or more strings that interpolates fields from the three params. In the event that any of the fields are arrays, the results will be the zip of all fields, repeating, until the shortest array expires.